XML validation against an XSD fails in Oracle but it gets validated in XMLSpy -
xsd registered in oracle. using xmltype.schemavalidate validate xml against registered xsd. api gives error "lsx-00295: field element "item" not simple type". same xml file same xsd gets validated fine in altova xmlspy. somehow oracle giving complex type error.
anonymous script below:
declare lxml xmltype; l_err varchar2(4000); l_transformxml clob:='<?xml version="1.0" encoding="utf-8"?> <tdvpf:products numproducts="2" xsi:schemalocation="http://www.techdata.com/vpf vendorpricefiletemplate_volume.xsd" xmlns:tdvpf="http://www.techdata.com/vpf" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <product> <base> <distributorsku numitems="1"> <item index="2">a</item> </distributorsku> <vendor numitems="1"> <item index="2">a</item> </vendor> <vendorpartnumber numitems="1"> <item index="2">a</item> </vendorpartnumber> <endusertype numitems="1"> <item index="2">government</item> </endusertype> <endusersubtype numitems="1"> <item index="2">a</item> </endusersubtype> <vendorproductgroup numitems="1"> <item index="2">a</item> </vendorproductgroup> <productname numitems="1"> <item index="2">a</item> </productname> <productdescription numitems="1"> <item index="2">a</item> </productdescription> <cost numitems="1"> <item index="2">0.0</item> </cost> <msrp numitems="1"> <item index="2">0.0</item> </msrp> <operatingsystem numitems="1"> <item index="2">linux</item> </operatingsystem> <operatingsystemversion numitems="1"> <item index="2">a</item> </operatingsystemversion> <platform numitems="1"> <item index="2">64 bit</item> </platform> <version numitems="1"> <item index="2">a</item> </version> <edition numitems="1"> <item index="2">a</item> </edition> <licensetype numitems="1"> <item index="2">a</item> </licensetype> <licenseduration numitems="1"> <item index="2">a</item> </licenseduration> <packagetype numitems="1"> <item index="2">full package product</item> </packagetype> <mediatype numitems="1"> <item index="2">a</item> </mediatype> <maintenancesupporttype numitems="1"> <item index="2">a</item> </maintenancesupporttype> <maintenancesupportduration numitems="1"> <item index="2">a</item> </maintenancesupportduration> <licenseprogram numitems="1"> <item index="2">a</item> </licenseprogram> <language numitems="1"> <item index="2">a</item> </language> <productclass numitems="1"> <item index="2">applications</item> </productclass> <mediapartnumber numitems="1"> <item index="2">a</item> </mediapartnumber> <requireditems numitems="1"> <item index="2">a</item> </requireditems> <seats-qty numitems="1"> <item index="2">a</item> </seats-qty> <users-qty numitems="1"> <item index="2">a</item> </users-qty> <appliances-qty numitems="1"> <item index="2">a</item> </appliances-qty> <devices-qty numitems="1"> <item index="2">a</item> </devices-qty> <migrations-qty numitems="1"> <item index="2">a</item> </migrations-qty> <mailboxes-qty numitems="1"> <item index="2">a</item> </mailboxes-qty> <gigabytes-qty numitems="1"> <item index="2">a</item> </gigabytes-qty> <servers-qty numitems="1"> <item index="2">a</item> </servers-qty> <workstations-qty numitems="1"> <item index="2">a</item> </workstations-qty> <licenses-qty numitems="1"> <item index="2">a</item> </licenses-qty> <processors-qty numitems="1"> <item index="2">a</item> </processors-qty> <domains-qty numitems="1"> <item index="2">a</item> </domains-qty> <nodes-qty numitems="1"> <item index="2">a</item> </nodes-qty> </base> <licenseprogram> <points numitems="1"> <item index="2">0.0</item> </points> <minquantity numitems="1"> <item index="2">0.0</item> </minquantity> <maxquantity numitems="1"> <item index="2">0.0</item> </maxquantity> <volumelevel numitems="1"> <item index="2">a</item> </volumelevel> <groupmethod numitems="1"> <item index="2">programpool</item> </groupmethod> </licenseprogram> </product> </tdvpf:products> '; begin lxml := xmltype (l_transformxml).createschemabasedxml ('vendorpricefiletemplate_volume.xsd'); xmltype.schemavalidate (lxml); if lxml.isschemavalid () = 1 dbms_output.put_line ('xsd validation success'); end if; exception when others l_err := substr (sqlerrm, 1, 4000); dbms_output.put_line ('error: ' || l_err); end;
apparently schema defines item
element simpletype, means cannot contain attributes.
<item index="2">a</item>
Comments
Post a Comment