I was wondering if it possible to refer to the location of an XML doc within itself.
The isssue is as follows:
I am using the XInclude processing instruction to include an XML doc (y.xml)
into some another XML doc (x.xml), so
x.xml looks like this:
<x xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="y.xml" parse="xml"/>
</x>
Both x.xml and y.xml reside within the same location of the same jar.
Parsing of x.xml fails, due to the fact that the parser is looking for y.xml in the application working directory i.e. c:\intellij\project, and not where the xml files in fact reside:
org.xml.sax.SAXParseException: Include operation failed. Resource error reading file as XML (href='y.xml'). Reason: c:\intellij\project\y.xml (The system cannot find the file specified)
As per system requirements though, I can only use a relative path to the xml files and not an absolute path (e.g. file://c:/myjar.jar!/y.xml) because depending on the deployment schema, the actual location of the files may vary. The only thing which will always remain the same is files' location in relation to one another i.e. same directory.
So my question is how within an xml doc to refer to where this doc resides (if it is in fact possible)?
Thanks in adavance
PS. this message was actually intented for Java/XML-specific forums and in fact has been posted there already. I just thought that it wouldn't hurt to re-post it here, just in case if by any chance some XML guru is hanging around here
