Relative URIs are resolved against the base URI of the document in which
they're contained. If no base URI has been specified (i.e. the application
didn't set the system ID on the InputSource [1]) the parser falls back to
using the "current working directory" for resolving relative URIs.

Thanks.

[1]
http://xerces.apache.org/xerces2-j/javadocs/api/org/xml/sax/InputSource.html#setSystemId(java.lang.String)

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]

Prashant Reddy <[EMAIL PROTECTED]> wrote on 10/08/2007 08:49:59 AM:

> I think the relative paths you have specified in the schemaLocation will
> be resolved against the "working dir". The working dir is usually the
> directory at the cmd prompt when you launched the JVM.
>
> Have you tried giving absolute path to the XSD files ?
>
> A more portable solution to finding schema files locally is to use
> EntityResolver[1].
>
> If you are using JAXP 1.3/ JDK 1.5+ see :
> https://jaxp.dev.java.net/article/jaxp-1_3-article.html
>
>
> [1]:http://java.sun.com/j2se/1.5.0
/docs/api/org/xml/sax/EntityResolver.html
>
> Hope this helps.
> -Prashant
>
>
> On Mon, 2007-10-08 at 13:17 +0100, Chris Bray wrote:
> > All.
> >
> > Please go easy on me as I'm a newbie here, if this is a really obvious
> > problem I'm really sorry!
> > I've been using Xerces to validate XML for a while now, and I've found
a
> > troublesome scenario.
> >
> > In the top of my xml files I have a line specifying the location of the

> > external schemas required for this xml file like so:
> >
> >     xsi:schemaLocation="http://www.diggsml.org/0.9.2
> > ../Schemas/diggs/core.xsd http://www.diggsml.org/0.9.2/geotechnical
> > ../Schemas/diggs/geotechnical.xsd "
> >
> > In this case specifying two namespaces and their associated schema
files
> > (files exist and paths are correct).
> >
> > However this doesn't work using Xerces. I am required to change my
> > schemaLocation attribute so that the first path points to its xsd, then

> > subsequent entries are relative to that first xsd, not to the current
> > file, like so:
> >
> >     xsi:schemaLocation=" http://www.diggsml.org/0.9.2
> > ../Schemas/diggs/core.xsd http://www.diggsml.org/0.9.2/geotechnical
> > ../geotechnical.xsd "
> >
> > Is there any way I can change this to work like the first example, as
> > other parsers (XMLSpy and Stylus Studio in particular) require the
first
> > syntax, all paths relative to current doc, what I believe to be correct

> > behaviour. I don't know how to build Xerces-J from source to fix(?)
this
> > myself but I'd be willing to try if anyone can help me get it building.
> >
> > Since my customers are all using XMLSpy etc I'm having to produce my
> > example files in the earlier syntax, stopping my from using Xerces to
> > validate them.
> >
> > As the biggest advocate of Free/OpenSource software in our group (jEdit

> > with Xerces plugin in particular) I really don't want to have to change

> > to use XMLSpy or Stylus Studio but this is quite awkward for me!
> >
> > That ended up being a longer mail than I'd expected! I hope you can
> > help, if there's any more information you need (or a small set of
sample
> > files) let me know.
> >
> >
> > Chris Bray
> > Software Engineer (DIGGS Project)
> > Keynetix Ltd.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to