XML schema location

T

Tobias.Bischof

Hi,

i'm using xerces2 to deal with XML files my JAVA app stores data in.
Now i have my schema located in %program-path%/resources but want to be
free to store my XML files wherever i want and also don't want to
hard-code %program-path%/resources into the XML file.

I think Xerces looks in the Java-Classpath for the schema but this
didn't work..

Is there any way to tell Xerces where to look for the schema at
runtime?

Thanks alot!
 
G

George Bina

Hi,

The best solution is to use a catalog to map from the schema locations
from your file to actual locak schema documents. Xerces supports XML
Catalogs, see http://xerces.apache.org/xerces2-j/faq-xcatalogs.html
Another possibility is to set your own entity resolver and resolve the
document locations to the actual documents.

Best Regards,
George
 
J

Joe Kesselman

To specify your own search algorithm, write and plug in an Entity
Resolver. (I believe that's used for schemas as well.) See the Xerces
docs for details.
 
J

Joe Kesselman

.... Or URI Resolver. (I've forgotten whether both are supported or if
there was a namechange in that interface; should be easy to check.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top