Project

Profile

Help

entity and resource resolution for source doc

Added by Anonymous about 18 years ago

Legacy ID: #3527832 Legacy Poster: Roger I Martin (martin3)

Using 8.6.1 I'm trying to resolve entities and resources locally. I've gotten the source parser ((TransformerFactoryImpl)factory).getConfiguration().setSourceParserClass("com.sun.org.apache.xerces.internal.parsers.SAXParser"); System.out.println("set svg entity resolver "+((TransformerFactoryImpl)factory).getConfiguration().getSourceParserClass()); org.xml.sax.XMLReader svgReader=((TransformerFactoryImpl)factory).getConfiguration().getSourceParser(); svgReader.setEntityResolver(new com.neuralworks.xml.svg.sax.SVGEntityResolver()); ... set a entity resolver and continue getting: --- set svg entity resolver com.sun.org.apache.xerces.internal.parsers.SAXParser vector objects C:\lg3d\bin..\ext\dynamic\anim01.svg Error java.net.UnknownHostException: www.w3.org net.sf.saxon.xpath.DynamicError: java.net.UnknownHostException: www.w3.org at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:223) at net.sf.saxon.event.Sender.send(Sender.java:110) at net.sf.saxon.event.Sender.send(Sender.java:44) at net.sf.saxon.Controller.transform(Controller.java:958) at org.jdesktop.lg3d.dynamic.x3d.util.Operation.transform(Operation.java:86) at org.jdesktop.lg3d.dynamic.x3d.Producer.<init>(Producer.java:229) --- The source document starts with: --- <?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg width="8cm" height="3cm" viewBox="0 0 800 300" xmlns="http://www.w3.org/2000/svg" version="1.1"> --- Setting factory.setURIResolver() does get called for stylesheet includes and are resolved. Every attempt at resolving the source document offline has failed. I've tried before and after setting up the template for the stylesheet. Not certain when and where the resolver should be set. When I am working directly with the xerces XMLReader everything in my source docs resolve.


Replies (1)

RE: entity and resource resolution for source - Added by Anonymous about 18 years ago

Legacy ID: #3527935 Legacy Poster: Michael Kay (mhkay)

It's not clear to me where you are setting the EntityResolver. The cleanest approach is to supply the source document as a SAXSource, with the SAXSource containing its own XMLReader preconfigured to use your EntityResolver. Another approach is to subclass the XMLReader, and nominate your subclass as the SourceParserClass - your subclass can then set the EntityResolver on its base class (or you can do the same by nominating an XMLFilter as the SourceParser).

    (1-1/1)

    Please register to reply