| Author |
Locate SYSTEM entities when SAX parsing an XML document
|
Peter Chase
Ranch Hand
Joined: Oct 30, 2001
Posts: 1970
|
|
I am trying to use javax.xml.parsers.SAXParser to parse an XML document. It is OK until the XML document tries to use SYSTEM entities to reference another XML document. You know the idea: - Here's the existing parsing code: - I need to tell the SAXParser how to find file "foo.xml". It is not an ordinary file, or an HTTP resource, but I could easily provide a method to locate it, via the relative path. I could return a Reader or an InputStream. The problem is I don't know what hook would allow me to do so. Any suggestions?
|
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.<br /> <br />#:^P
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12266
|
|
Isn't that the idea behind the EntityResolver interface? Presumably you could implement the resolveEntity method in your custom class and create an InputSource pointing to the file. See org.xml.sax.EntityResolver in the Javadocs Bill
|
Java Resources at www.wbrogden.com
|
 |
 |
|
|
subject: Locate SYSTEM entities when SAX parsing an XML document
|
|
|