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

Re: Relative URI "my-report.dtd"; can not be resolved

Subject: Re: Relative URI "my-report.dtd"; can not be resolved withouta document URI.
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Wed, 30 Apr 2003 21:24:41 +0200
relative uri xml
Brad Clark wrote:
I'm using xsl/fop to generate dynamic pdf's from xml. The xml has an
associated dtd which defines a number of entities. When the xml is
not dynamic but is loaded from a file, which resides in the same
directory as the dtd, the pdf gets generated fine. When the xml comes
from a dynamic string, the dtd specified in the DOCTYPE isn't found.

The problem is that the InputSource for the XML parser doesn't have a ystem ID.

I know the reason is because the transformer doesn't have a base
directory to use for the relative uri. I defined a URIResolver and
called setURIResolver but it never seems to call the resolve callback.

This is no surprise: the problem odccurs as the XML parser reads from the string. The parser doesn't use the URI resolver, this mechanism is used by the XSLT processor.

String test =
...
try {
return new SAXSource(new InputSource(new FileReader(new
File(REPORT_INPUT_BASEDIR + href))));

Use something like this for the string try { InputSource is = new InputSource(new StringReader(test)); is.setSystemId(REPORT_INPUT_BASEDIR + href); return new SAXSource(is); ...

Exact handling of the system Id may vary a bit, maybe you'll
have to adjust it so that if the DTD files are in /foo/bar/*.dtd
you may have to set it to either /foo/bar, /foo/bar/ or
/foo/bar/dummy or perhaps /foo/bar/existing-file.xml.

Alternatively, and possibly more robust, is to use an entity
resolver.

J.Pietschmann


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

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
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.