5.6.2 XML Document to Use (purchaseOrder.xml and purchaseOrder-fail.xml)
Cosminexus XML Processor provides the following types of XML documents for validation by the XML Schema:
-
XML document that is validated successfully (purchaseOrder.xml)
-
XML document that fails validation (purchaseOrder-fail.xml)
- Organization of this subsection
(1) XML document (purchaseOrder.xml)
The following shows an XML document (purchaseOrder.xml) that is validated successfully.
<?xml version="1.0"?> <po:purchaseOrder xmlns:po="http://www.myshopping.com/schema/purchaseOrder" xmlns:psd="http://www.myshopping.com/schema/personalData"> <po:shipTo age="20"> <psd:firstName>John</psd:firstName> <psd:familyName>Doe</psd:familyName> <psd:occupation>accountant</psd:occupation> <psd:email>johnD@bpl.com</psd:email> <psd:tel>050-1234-1234</psd:tel> <psd:address country="US"> <psd:street>Universal street 100</psd:street> <psd:city>Carson</psd:city> <psd:state>Nevada</psd:state> <psd:zip>10-456</psd:zip> </psd:address> </po:shipTo> <po:billTo age="20"> <psd:firstName>Jane</psd:firstName> <psd:familyName>Doe</psd:familyName> <psd:occupation>lawyer</psd:occupation> <psd:email>janeD@bpl.com</psd:email> <psd:tel>033-1111-2345</psd:tel> <psd:address country="US"> <psd:street>Times Square 555</psd:street> <psd:city>New York</psd:city> <psd:state>New York</psd:state> <psd:zip>155-5600</psd:zip> </psd:address> <po:credit year="2007" month="10"> <po:creditHolder>Jane Doe</po:creditHolder> <po:creditNumber>1111444422229999</po:creditNumber> <po:creditCompany>CardCompanyA</po:creditCompany> </po:credit> </po:billTo> <po:items> <po:item> <po:productName productID="DTPC2000S">DeskTop PC</po:productName> <po:quantity>1</po:quantity> <po:price>1500</po:price> <po:shipDate>2004-05-20</po:shipDate> </po:item> <po:item> <po:productName productID="DC500MP">Digital Camera</po:productName> <po:quantity>1</po:quantity> <po:price>450</po:price> <po:shipDate>2004-05-20</po:shipDate> </po:item> <po:item> <po:productName productID="LP800S">Printer</po:productName> <po:quantity>1</po:quantity> <po:price>200</po:price> <po:shipDate>2004-05-20</po:shipDate> </po:item> </po:items> </po:purchaseOrder>
(2) XML document (purchaseOrder-fail.xml)
The following shows a fragment of an XML document (purchaseOrder-fail.xml) that fails validation.
... ... <po:credit year="2007" month="10"> <po:creditHolder>Jane Doe</po:creditHolder> <po:creditNumber>111144442222999955</po:creditNumber> <po:creditCompany>CardCompanyA</po:creditCompany> </po:credit> ... ...
This XML document is identical with the one described in 5.6.2 (1) XML document (purchaseOrder.xml) except for the definition of the credit number starting with <po:creditNumber>. An 18-digit number is used as the value for the credit number starting with <po:creditNumber>. However, the sample schema document defines the credit number as 16 digits, resulting in an error at the time of validation.