You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Am trying to validate my xml with xsd using XML4JS and xsd has "xs:choice".
When i use choice for the element with Type of reference it is failing with below error.
AssertionError [ERR_ASSERTION]: { 'xsd:choice':
[ { 'xsd:annotation':
[ { 'xsd:documentation':
[ '\n Purchase\n order schema.\n ' ] } ],
'xsd:choice':
[ { '$': { minOccurs: '1', maxOccurs: '1' },
'xsd:element':
[ { '$': { name: 'purchaseOrder', type: 'PurchaseOrderType' } } ] } ],
'xs:any':
[ { '$': { namespace: '##other', processContents: 'lax' } } ] } ] }
at assert (/Users/test-user/workspace/poc/xmltojson/node/node_modules/xml4js/lib/assert.js:10:5)
at /Users/test-user/workspace/poc/xmltojson/node/node_modules/xml4js/lib/xsd.js:584:9
at parseNamespacePrefixes (/Users/test-user/workspace/poc/xmltojson/node/node_modules/xml4js/lib/xsd.js:502:3)
at /Users/test-user/workspace/poc/xmltojson/node/node_modules/xml4js/lib/xsd.js:548:7
at Parser.<anonymous> (/Users/test-user/workspace/poc/xmltojson/node/node_modules/xml4js/node_modules/xml2js/lib/xml2js.js:492:18)
at Parser.emit (events.js:198:13)
at SAXParser.onclosetag (/Users/test-user/workspace/poc/xmltojson/node/node_modules/xml4js/node_modules/xml2js/lib/xml2js.js:453:26)
at emit (/Users/test-user/workspace/poc/xmltojson/node/node_modules/sax/lib/sax.js:624:35)
at emitNode (/Users/test-user/workspace/poc/xmltojson/node/node_modules/sax/lib/sax.js:629:5)
at closeTag (/Users/test-user/workspace/poc/xmltojson/node/node_modules/sax/lib/sax.js:889:7)
<?xml version=\"1.0\"?><purchaseOrder orderDate=\"1999-10-20\" validDate=\"1999-10-20\" xmlns=\"http://www.example.com/PO\"><shipTo country=\"US\"><name>Alice Smith</name><street>123 Maple Street</street><city>Mill Valley</city><state>CA</state><zip>90952</zip></shipTo><billTo country=\"US\"><name>Robert Smith</name><street>8 Oak Avenue</street><city>Old Town</city><state>PA</state><zip>95819</zip></billTo><comment>Hurry, my lawn is going wild!</comment><items><item partNum=\"872-AA\"><productName>Lawnmower</productName><quantity>1</quantity><USPrice>148.95</USPrice><comment>Confirm this is electric</comment></item><item partNum=\"926-AA\"><productName>Baby Monitor</productName><quantity>1</quantity><USPrice>39.98</USPrice><shipDate>1999-05-21</shipDate></item></items></purchaseOrder>
Am trying to validate my xml with xsd using XML4JS and xsd has "xs:choice".
When i use choice for the element with Type of reference it is failing with below error.
XSD :
The text was updated successfully, but these errors were encountered: