how to reference XSD Schema location while parsing XML via SAX Xerces?
< ?xml version="1.0" encoding="ISO-8859-1"?> < com.firma
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
< !-- xsi:noNamespaceSchemaLocation="F:\...\myschema_v2.5.xsd"
Must I reference this element really within the XML Doc??? I hope, not…
— >
I also set it as follows in Java code, which is not elegant, while schema location is fixed(not appropriate for production)
SaxParser.setProperty(
"http://java.sun.com/xml/jaxp/properties/schemaSource",
"F:…\myschema_v2.5.xsd"
);
Best Answer
include the schema in your jar and load it using getResourceAsStream in the following way