OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Resolving a DTD in an XML file called through document()

[ Lists Home | Date Index | Thread Index ]

I’m attempting to transform baseFile.xml using xslTransform.xsl. The xslTransform.xsl file uses some information from dataFile.xml which it refereces using document(). The dataFile.xml file has a DOCTYPE defined by dataFile.dtd.

 

I’ve been attempting to do this using JAXP. My code looks something like this:

 

TransformerFactory tfactory = TransformerFactory.newInstance();

tfactory.setURIResolver(new CustomURIResolver());

InputStream xslTransform = ClassLoader.getSystemResourceAsStream("xslTransform.xsl");

Transformer transformer = tfactory.newTransformer(new StreamSource(xslTransform));

 

transformer.setParameter("dataFile",”dataFile.xml”);

 

InputStream baseFile = ClassLoader.getSystemResourceAsStream(“baseFile.xml”);

 

transformer.transform(new StreamSource(baseFile),

                                new StreamResult(new FileOutputStream(“result.txt)));

 

I can successfully register a custom URI resolver that returns the “dataFile.xml” when it’s called out during the transform. But, none of the objects above have a setEntityResolver method that I can use to resolve the reference to “dataFile.dtd” that’s in “dataFile.xml”.

 

Somewhere inside the transform method, it obviously must create an XMLReader and use it to parse that externally referenced file. But, there doesn’t appear to be any way to get a reference to that XMLReader or to get the transform method to set the reader’s EntityResolver for me.

 

Surely this is possible. What’s the trick?

 

            --Rhett

 





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS