Re: [Simple-support] External entity reference problems
Brought to you by:
niallg
|
From: Lars C. <lar...@na...> - 2012-10-15 10:36:17
|
Hi! Thanks for your answer. To me it looks like StAX behaves as I would expect (or as I understand the xml spec), i.e. looks for the external entity in the same directory where the file containing the entity reference are. SimpleXML (or the underlying used API’s) looks in the path where the program was started and expects the file to be there. The problems arise when the external entity does not have an absolute path, just referenced as “file.xml”. If I add an absolute path to the entity reference it works fine in both SimpleXML and StAX. I can’t put an absolute path in the external reference because the file will be moved around in different paths, and that will not be flexible enough. The directory where the XML files are located is not a part of the classpath. Best regards, Lars From: Niall Gallagher [mailto:gal...@ya...] Sent: den 14 oktober 2012 12:48 To: 'sim...@li...'; Lars Carlsson Subject: Re: [Simple-support] External entity reference problems Hi, I think this is a problem with the StAX configuration you are using or perhaps your classpath. Simple does not directly deal with the XML, it only wraps various APIs like StAX, DOM, and XmlPull. Thanks, Niall --- On Wed, 10/10/12, Lars Carlsson <lar...@na...<mailto:lar...@na...>> wrote: From: Lars Carlsson <lar...@na...<mailto:lar...@na...>> Subject: [Simple-support] External entity reference problems To: "'sim...@li...'" <sim...@li...<mailto:sim...@li...>> Received: Wednesday, 10 October, 2012, 9:39 AM 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 -----Inline Attachment Follows----- ------------------------------------------------------------------------------ Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev -----Inline Attachment Follows----- _______________________________________________ Simple-support mailing list Sim...@li...</mc/compose?to=...@li...> https://lists.sourceforge.net/lists/listinfo/simple-support |