Hi, (yes, I'd consider crimson OT for a general list too, but there isn't a crimson list and http://xml.apache.org/mail.html says it's okay.)
I have some standard JAXP 1.1 code (listed at the end) that works with Xerces and fails with Crimson. It seems Crimson doesn't like XML namespaces. If I try to create a DOM by parsing: <!DOCTYPE foo [ <!ELEMENT foo (#PCDATA)> ]> <foo xmlns="http://www.foo.com"/> I'll get an error claiming 'Attribute "xmlns" is not declared for element "foo".' That makes perfect sense from a pre-namespaces perspective, but shouldn't a namespace-aware parser be able to handle this? thanks, --Jeff -------- Broken.java -------- import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; public class Broken { public static void main(String args[]) throws Exception { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); // The default is false. See http://xml.apache.org/~edwingo/jaxp-faq.html dbf.setValidating(true); DocumentBuilder db = dbf.newDocumentBuilder(); //db.setErrorHandler(new StandardErrorHandler()); Document doc = db.parse(new java.io.File(args.length==0?"foo.xml":args[0])); } } -------- foo.xml -------- <!DOCTYPE foo [ <!ELEMENT foo (#PCDATA)> ]> <foo xmlns="http://www.foo.com"/> The error is: Error parsing entity SYSTEM "file:/home/jeff/tmp/java/jdom/src/java/foo.xml", line 4 : Attribute "xmlns" is not declared for element "foo". Exception in thread "main" org.xml.sax.SAXParseException: Attribute "xmlns" is not declared for element "foo". at org.apache.crimson.parser.Parser2.error(Parser2.java:3160) at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1411) at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:500) at org.apache.crimson.parser.Parser2.parse(Parser2.java:305) at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442) at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:185) at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:197) at UseDOM.main(UseDOM.java:22) --------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
