Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Referencing a second XML within a JAR

Reply
Thread Tools

Referencing a second XML within a JAR

 
 
Daniel Frey
Guest
Posts: n/a
 
      02-10-2006
Hi

I am using XML to persist Java objects (with XStream). I have a general
leak of knowledge how ENTITY references within a XML can point to
another XML in a JAR. I.e. the following XML would reference a file
called file1.xml in the same directory:

<?xml version='1.0'?>
<!DOCTYPE root [ <!ENTITY file1 SYSTEM "file1.xml"> ]>
<root id="0">
&file1;
...
</root>

But I do not have both files in the same directory. Instead they are
located in different JARs. Do you know how to address an XML in a JAR?
Can I use kind of an absolute link like

<!DOCTYPE root [ <!ENTITY file1 SYSTEM
"/my/package/in/a/jar/file1.xml"> ]>

to point to the jared external XML. Any idea would be highly
appreciated.

Cheers
Daniel Frey

 
Reply With Quote
 
 
 
 
Joe Kesselman
Guest
Posts: n/a
 
      02-10-2006
Daniel Frey wrote:
> Do you know how to address an XML in a JAR?


XML doesn't understand the concept of jarfiles. All it works with is
URIs. So there's no guaranteed portable solution.

Many (not all) XML processors will let you plug in an "entity resolver"
or "uri resolver", which is code you've written to describe where and
how they should try to search when attempting to retrieve additional
information. If you write one that understands which jarfiles you want
to search, and how to do that search and pull the data out of them, that
will do what you want.

*SOME* processors may have this kind of capability built in -- I've seen
a few programs that understand URIs starting with jar: as requests to
retrieve one entry from a jarfile -- but you'd have to check the docs
for your program.

There may be other solutions -- but again, that's going to be a matter
of exactly what your software supports. And if you can't make it work
with your tools, you may have to either change tools or do something
different.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
java -cp a.jar -jar b.jar => Works on Windows, not on Debian cyberco Java 4 02-14-2006 06:27 AM
jaas.jar, jta.jar jdbc-stdext.jar missing from jdk1.5 RPM muttley Java 0 10-20-2005 02:40 PM
Differences of xercesImpl.jar, xercesImpl-J.jar, dom3-xercesImpl.jar ? Arnold Peters Java 0 01-05-2005 10:59 PM
Differences of xercesImpl.jar, xercesImpl-J.jar, dom3-xercesImpl.jar ? Arnold Peters XML 0 01-05-2005 10:59 PM
Referencing web service complex data type within a second web service (like a delegate) Mike Dearman ASP .Net Web Services 1 06-23-2004 03:11 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57