[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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


classloader.getsystemresourceasstream

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

 


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.