[Fixed] Validation issue - Sax
G-day
I use an instance of XMLReader. its config is :
parseur = XMLReaderFactory.createXMLReader();
// gre les prfixes "xmlns:*"
parseur.setFeature("http://xml.org/sax/features/namespace-prefixes",true);
parseur.setFeature("http://xml.org/sax/features/namespaces",true);
parseur.setFeature("http://xml.org/sax/features/validation",true);
parseur.setFeature("http://apache.org/xml/features/validation/schema",true);
parseur.setFeature("http://apache.org/xml/features/validation/schema-full-checking",true)
the schema location is defined in the xml document in input :
<sh:StandardBusinessDocument xsi:schemaLocation="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader
http://www.gs1globalregistry.net/2.0/schemas/sbdh/StandardBusinessDocumentHeader.xsd urn:ean.ucc:2
http://www.gs1globalregistry.net/2.0/schemas/CatalogueItemNotificationProxy.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:sh="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader"
xmlns:gdsn="urn:ean.ucc:gdsn:2"
xmlns:eanucc203="urn:ean.ucc:2">
When I parse it, I get the following error message :cvc-elt.1: Cannot find the declaration of element 'sh:StandardBusinessDocument'.
I assume it can't find the schema. have you any idea of my mistake ?
I downloaded the schema on PC and modified the root node like this :
<sh:StandardBusinessDocument xsi:schemaLocation="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader
file:/C:/jdevstudio1013.2/jdev/mywork/BMS_Package_Align_Catalogue_Item_Synchronisation/Catalogue_Item_Synchronisation_Implementers_Packet/Schemas/sbdh/StandardBusinessDocumentHeader.xsd urn:ean.ucc:2
file:/C:/jdevstudio1013.2/jdev/mywork/BMS_Package_Align_Catalogue_Item_Synchronisation/Catalogue_Item_Synchronisation_Implementers_Packet/Schemas/CatalogueItemNotificationProxy.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:sh="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader"
xmlns:gdsn="urn:ean.ucc:gdsn:2"
xmlns:eanucc203="urn:ean.ucc:2">
in this case, it works fine, the schema is found. But I would like to use the schema defined with the http link.
Thanks a lot
Message was edited by:
bullit

