[Simple-support] External entity reference problems
Brought to you by:
niallg
|
From: Lars C. <lar...@na...> - 2012-10-10 17:15:00
|
Hello! I am using simpleXml and I really like it a lot. I have a special case though where I am referring a xml file that contains an external entity referencing to another xml file. The reference looks like this: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE run [ <!ENTITY e SYSTEM "file.xml"> ]> <run><iMessageList class="java.util.ArrayList">&e;</iMessageList></run> I run a program from path A and reference the 2 xml files that are located in path B. When I load the xml file and parse it with Java streaming API for Xml (StAX) it works fine. When I do the same with SimpleXml I get an error indicating it cannot find the path of the file. The path that simpleXml expects is the path A, where I started the program and not path B where I have the xml files. I checked the XML spec (http://www.w3.org/TR/REC-xml/#dt-extent) and I can find some info about this: "Unless otherwise provided by information outside the scope of this specification (e.g. a special XML element type defined by a particular DTD, or a processing instruction defined by a particular application specification), relative URIs are relative to the location of the resource within which the entity declaration occurs." Anyone knows if this is a bug? Best regards and thanks for a great XML api! Lars |