|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] doc() function failing to load DTDMichael Ludwig mlu at as-guides.comWed Apr 15 11:48:44 PDT 2009
George Feinberg schrieb: > Michael, > > Your issue is somewhat product-specific. In this case you are using > Berkeley DB XML and it's dbxml shell program for testing. Hi George :-) Yes, exactly, dbxml shell for testing. > The problem is not the URI for the file but the file's reference to > the DTD. BDB XML uses Xerces-C for parsing/validation and > by default Xerces-C will look in the current directory for DTDs > referenced by a relative pathname (e.g. "Sender.dtd"). If you > change that to an absolute pathname or file: URI your query > will succeed. Yes, that works. > In BDB XML you have another option if you write it into your > program (vs using the dbxml shell). You can implement XmlResolver > and resolve entities such as DTDs yourself. That works fine, too. I took a look at the C++ sample program contained in the Berkeley DB XML distribution and implemented something similar to set a base URI for external entities, which I'm appending in case anyone is looking for it. Regards, Michael Ludwig public final class TestResolver extends XmlResolver { private String dir; public void setDirectory(String dir) { if (dir.endsWith("/")) this.dir = dir; else this.dir = dir + "/"; } public XmlInputStream resolveEntity( XmlTransaction txn, XmlManager mgr, String systemId, String publicId) throws XmlException { String path = dir + systemId; System.err.format("RESOLVER: %s -> %s%n", systemId, path); return mgr.createLocalFileInputStream(path); } } Usage: TestResolver resolver = new TestResolver(); resolver.setDirectory( "C:/MILU/dev"); xmlManager.registerResolver(resolver);
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






