Rodger Lucas wrote: > <?xml version="1.0" encoding="UTF-8"?> > <!DOCTYPE Root PUBLIC "-//Innovance Networks, Inc.//Framework XML > Service//EN" > > "file:/D:/MyProjects/planning/planning0385/nt4/config/piCOM.dtd">
I think this should be "file:///D:/...". > The absolute path is a problem as our customers will definitely > install our product in different directories on their PC. Unless your application installs an EntityResolver that maps the absolute URI to another location. I recommend this option but if you go this route, you should change the URI to some "standard" location. For example: "http://www.mycompany.com/product/grammar.dtd" It doesn't matter where it is because the application will always remap it. But it helps you organize your grammars (and other entities) better. > outputFormat.setDoctype(PUBLIC_ID, null ); The DOCTYPE line in the XML document *must* contain a system identifier if the public identifier is specified. Therefore, all of the following are correct: <!DOCTYPE root > <!DOCTYPE root []> <!DOCTYPE root SYSTEM 'grammar.dtd'> <!DOCTYPE root PUBLIC '-//Grammar//EN' 'grammar.dtd'> but this is *not*: <!DOCTYPE root PUBLIC '-//Grammar//EN'> > source.setSystemId( dtdUrl.toString() ); > parser.parse(source); // NOTE: source is This is the URI of the source document. But since the system identifier specified in the DOCTYPE line is absolute, it won't use the document's URI as a base to locate the DTD. It is better to use an EntityResolver. For example: import java.io.IOException; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; import org.xml.sax.SAXException; public class MyEntityResolver implements EntityResolver { public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException { // resolve entity if (systemId.equals("file:/D:/MyProjects/planning/planning0385/nt4/config/piCOM.dtd")) { InputSource source = new InputSource(); source.setSystemId("file:/D:/TestProperties/piCOM.dtd"); return source; } // give up return null; } } Disclaimer: I didn't check this code. > I believe the DOCTYPE is missing. If so how do you specify a DOCTYPE > without the dtd? Do you mean "how do you specify a DTD without a DOCTYPE"??? At the moment, you can't. We're working on it. > If I could actually avoid using a DTD all together that would be even > better. .. ie skip validation Even better. Don't use it if you don't need it. > Any help would be appreciated. (my knowledge of XML is very small) We all start somewhere. But don't worry, it's like falling off a horse... Just pray the horse doesn't trample you when you're down. ;) -- Andy Clark * [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
