Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyrighted material John Tullis 6/1/2014 page 1 An XML Purchase Order John Tullis DePaul Instructor

Similar presentations


Presentation on theme: "Copyrighted material John Tullis 6/1/2014 page 1 An XML Purchase Order John Tullis DePaul Instructor"— Presentation transcript:

1 Copyrighted material John Tullis 6/1/2014 page 1 An XML Purchase Order John Tullis DePaul Instructor

2 Copyrighted material John Tullis 6/1/2014 page 2 XML Order Creating an XML purchase order 1st, the constraints. It must be a valid XML document. It must be a well-formed XML document. Finally, it must make sense (e.g., it must expresses the requirements of expressing a purchase order. To make sense, the recommendation made was to make sure your XML purchase order could handle the information provided in the purchase order example given in the EDI presentation given in week 4.

3 Copyrighted material John Tullis 6/1/2014 page 3 XML Order

4 Copyrighted material John Tullis 6/1/2014 page 4 XML Order Well-formedness & validity Well-formed - the state of an XML document that conforms to all the rules for well-formedness expressed in the XML Specification. Well-formedness includes the presence of any sub-elements that are properly nested, as well as all properly declared entity/attribute references. Valid - the state of an XML document that conforms to all the rules expressed in its DTD.

5 Copyrighted material John Tullis 6/1/2014 page 5 XML Order How can you be sure of validity & well-formedness? You can use the Mark-1 eyeball. But it is easier to use an XML processor/parser. To find one, search the Web for combinations like XML + parser. Examples include (but are not limited to): XMLSpy (found at: DataChannel XML Larval MSXML Check out the XML/XSL/XLL Software section of

6 Copyrighted material John Tullis 6/1/2014 page 6 XML Order How can you be sure it makes sense? You have to use your eyes and your mind. No validating XML parser can tell you whether or not the information you are expressing in your document makes sense based on your business need. Therefore, it cannot tell you whether or not you are correctly specifying what you need for a purchase order - but it can tell you whether what you have expressed is both well-formed and valid.

7 Copyrighted material John Tullis 6/1/2014 page 7 XML Order Lets begin

8 Copyrighted material John Tullis 6/1/2014 page 8 XML Order Do some XML

9 Copyrighted material John Tullis 6/1/2014 page 9 XML Order Does it make sense? Yes. The order header provides information about the order that occurs up front. The supplier organization section provides information about the company fulfilling the order. The billing address section provides billing information. The shipping address section provides that information. The item information provides information about items. The order summary provides information about the order that occurs at the end.

10 Copyrighted material John Tullis 6/1/2014 page 10 XML Order

11 Copyrighted material John Tullis 6/1/2014 page 11 XML Order The DTD first cut

12 Copyrighted material John Tullis 6/1/2014 page 12 XML Order The DTD and the XML together stuff Is it well-formed? Yes. Valid? Yes. Sensible? So far!

13 Copyrighted material John Tullis 6/1/2014 page 13 XML Order The Order Header For the DTD: For the XML example: Note: the PO number was submitted, and the date, but the time stamp was generated. This is a back end requirement (I am asserting this for this example).

14 Copyrighted material John Tullis 6/1/2014 page 14 XML Order

15 Copyrighted material John Tullis 6/1/2014 page 15 XML Order Supplier Organization information For the DTD:

16 Copyrighted material John Tullis 6/1/2014 page 16 XML Order Supplier Organization information For the XML: Acme Aspirin Company 101 XML Parser Trail Kauai HW USA Alfred Abel For this organization, the 2nd address field is empty. Note this is expressed as:. This is an empty element tag.

17 Copyrighted material John Tullis 6/1/2014 page 17 XML Order

18 Copyrighted material John Tullis 6/1/2014 page 18 XML Order Billing information For the DTD:

19 Copyrighted material John Tullis 6/1/2014 page 19 XML Order Billing information For the XML: Heidi Happy H & P Emporium 2000 Translator Drive Dallas TX USA For the billing address, both address fields are used. Note in the above, the & for H&P must be expressed as &

20 Copyrighted material John Tullis 6/1/2014 page 20 XML Order

21 Copyrighted material John Tullis 6/1/2014 page 21 XML Order Shipping information For the DTD:

22 Copyrighted material John Tullis 6/1/2014 page 22 XML Order Shipping information For the XML: Pete Painfree H & P Warehouse 5410 Secret Passage Plano TX USA For the shipping address, both address fields are used. Again, note we have to escape the & character.

23 Copyrighted material John Tullis 6/1/2014 page 23 XML Order

24 Copyrighted material John Tullis 6/1/2014 page 24 XML Order Item information For the DTD: Note the + at the end of the items declaration. This means there may be one or more items in the XML.

25 Copyrighted material John Tullis 6/1/2014 page 25 XML Order Items purchased information For the XML: Regular Strength Aspirin 512 Each $ $ Extra Strength Aspirin 45 Case $ $

26 Copyrighted material John Tullis 6/1/2014 page 26 XML Order

27 Copyrighted material John Tullis 6/1/2014 page 27 XML Order Order Summary information For the DTD: Heres the last of it!

28 Copyrighted material John Tullis 6/1/2014 page 28 XML Order Order Summary information For the XML: % Note that for this order there is no tax on the order or tax on the shipping costs of the order. No discount has been applied.

29 Copyrighted material John Tullis 6/1/2014 page 29 XML Order

30 Copyrighted material John Tullis 6/1/2014 page 30 XML Order Is the XML PO acceptable? Is it well-formed? Does it conform to the rules of XML grammer, including handling all special characters? Yes. Is it valid? Is it well formed? Yes. Does it have a DTD? Yes. Does it comply with the rules specified in the DTD? Yes. Does it make sense? Well, does it support the example PO? Yes. And that was the goal given in the assignment.

31 Copyrighted material John Tullis 6/1/2014 page 31 XML Order Complete DTD:

32 Copyrighted material John Tullis 6/1/2014 page 32 XML Order Complete XML: Acme Aspirin Company 101 XML Parser Trail Kauai HW USA Alfred Abel Heidi Happy H & P Emporium 2000 Translator Drive Dallas TX USA Pete Painfree H & P Warehouse 5410 Secret Passage XML continued: Plano TX USA Regular Strength Aspirin 512 Each $ $ Extra Strength Aspirin 45 Case $ $ %

33 Copyrighted material John Tullis 6/1/2014 page 33 XML Order XML Recommendations Keep it simple. If you dont need to use attributes, dont use them. The entity names should either correspond with database field names or should be clear to a human reader of the file. If the message size is not an issue, the sending program should include the DTD in the body of the message with the XML. This ensures both ends (sending/receiving) use the same DTD. Use a validating XML parser to build and check your work. I used XMLSpy to build the example for this presentation and to check the assignments. It is located at:

34 Copyrighted material John Tullis 6/1/2014 page 34 XML Invoice The next slide shows the paper invoice example. I will show you my version of an invoice in XML using the XMLSpy tool. Differences between an order and an invoice: An invoice is from the supplier to the purchaser. There will normally be an invoice number, and invoice date, a shipment method, a shipper, and a ship date. There may be a payment terms specification such as Net 30, Net 60, or Due Upon Receipt. There may be some commentary indicating how the purchaser can get in touch with the supplier if they need to do so.

35 Copyrighted material John Tullis 6/1/2014 page 35 Acme Aspirin Company 1011 XML Parser Trail Kauai, Hawaii, Fax INVOICE NO: DATE: November 15, 1999 To: Ship To: Heidi HappyPete Painfree H&P EmporiumH&P Warehouse 2000 Translator Drive5410 Secret Passage Dallas, TX 75201Plano, TX SALESPERSONP.O. NUMBERDATE SHIPPEDSHIPPED VIAF.O.B. POINTTERMS Alfred Abel34561Nov 10, 1999USPSN/A QUANTITYDESCRIPTIONUNIT PRICEAMOUNT – Regular Strength Aspirin1.00$ – Extra Strength Aspirin50.00$2, SUBTOTAL$2, SALES TAX0.00 SHIPPING & HANDLING25.00 TOTAL DUE$2, Make all checks payable to: Acme Aspirin Company If you have any questions concerning this invoice, call: Alfred THANK YOU FOR YOUR BUSINESS! N1*SE*Acme Aspirin Company N/L N3*101 XML Parser Trail N/L N4*Kauai*HI*99293 N/L BIG* * * *34561 N/L N1*ST*Pete Painfree N/L N2*H&P Warehouse N/L N3*5410 Secret Passage N/L N4*Plano*TX*75299 N/L IT1*2*45*CA*50.00**VP* N/L PID*F****Extra Strength Aspirin N/L IT1*1*512*EA*1.00**VP* N/L PID*F****Regular Strength Aspirin N/L TDS* N/L AMT*TZ*25.00 N/L CTT*2 N/L


Download ppt "Copyrighted material John Tullis 6/1/2014 page 1 An XML Purchase Order John Tullis DePaul Instructor"

Similar presentations


Ads by Google