SV: [jdom-interest] Weird parser behaviour

Per Norrman pernorrman at telia.com
Wed Sep 17 09:44:05 PDT 2003


Try

  builder.setFeature("http://apache.org/xml/features/validation/schema",
true);

/pmn


> -----Ursprungligt meddelande-----
> Från: jdom-interest-admin at jdom.org 
> [mailto:jdom-interest-admin at jdom.org] För Marcel Stor
> Skickat: den 17 september 2003 15:37
> Till: jdom-interest at jdom.org
> Ämne: [jdom-interest] Weird parser behaviour
> 
> 
> 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>
> 
> How can this be? Hope anyone has got a clue...
> 
> Regards,
> Marcel
> 
> _______________________________________________
> To control your jdom-interest membership: 
> http://lists.denveronline.net/mailman/options/jdom-interest/yo
uraddr at yourhost.com




More information about the jdom-interest mailing list