AW: [jdom-interest] Weird parser behaviour

Marcel Stor marcel at frightanic.com
Wed Sep 17 06:54:04 PDT 2003


jdom-interest-admin at jdom.org wrote:
> Hi all,
> 
> I've got a document that's throwing exceptions at me upon parsing. I
> know the document is valid. XMLSpy tells me it's valid and so does the
> parser if use the classes from the org.w3c.dom package.
> 
> This works:
> DocumentBuilderFactory factory =
> DocumentBuilderFactory.newInstance(); factory.setValidating(true);
> factory.setNamespaceAware(true); DocumentBuilder builder =
> factory.newDocumentBuilder(); builder.parse(myFile); 
> 
> This throws a JDOMParseException:
> SAXBuilder builder = new SAXBuilder(true);
> builder.build(myFile);
> The message says that an element named "IT-P_CDB" hadn't been
> declared. 
> 
> This is an excerpt from the W3C schema definition:
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema targetNamespace="http://www.it-p.ch/namespace"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns="http://www.it-p.ch/namespace" elementFormDefault="qualified"
> attributeFormDefault="unqualified">
> 	<xs:element name="IT-P_CDB">
> 
> And here is an excerpt from the XML file:
> <?xml version="1.0" encoding="UTF-8"?>
> <IT-P_CDB xmlns="http://www.it-p.ch/namespace"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.it-p.ch/namespace
> http://www.praut.com/CDB_LDAP.xsd" type="LDAP">
> 	<customer>

Ohhh, and yes, the code is fine if I turn off validation.

Regards,
Marcel




More information about the jdom-interest mailing list