[jdom-interest] Validating with SAXBuilder

Paul Reeves p_a_reeves at hotmail.com
Wed Aug 10 12:42:08 PDT 2005


on line 3 the attribute value is in single quotes- that ain't xml, try using 
double quotes

i.e. change  'http://www.w3.org/2001/XMLSchema-instance' to 
"http://www.w3.org/2001/XMLSchema-instance"


>From: Kostas Karadamoglou <karadamoglou_k at yahoo.gr>
>To: jdom-interest at jdom.org
>Subject: [jdom-interest] Validating with SAXBuilder
>Date: Wed, 10 Aug 2005 19:06:02 +0100
>
>Hi again!
>
>I am trying to validate a xml file that does not have schema reference. The 
>header of the xml file is the following:
>
><?xml version="1.0" encoding="UTF-8"?>
>
><irisCacheDB xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
>     <database dbID="Northwind">
>         <table tableID="Customers">
>...
>
>I initialize the builder object the following way:
>
>         try{
>             URL schema = 
>CacheContext.class.getResource("/essex/kkarad/cache/model/IrisSchema.xsd");
>             SAXBuilder builder=new SAXBuilder(true);
>
>builder.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",schema.toString());
>             Document doc=builder.build(this.confFile);
>         }catch(Exception ex){
>             ex.printStackTrace();
>         }
>
>Unfortunately the builder object returns an Exception:
>
>org.jdom.input.JDOMParseException: Error on line 3 of document 
>file:/C:/Development/Projects/CC401/IrisCacheServer/iris.xml: Document is 
>invalid: no grammar found.
>         at org.jdom.input.SAXBuilder.build(SAXBuilder.java:465)
>...
>
>How can I solve this problem? How can I made SAXBuilder validate the xml?
>
>thank you in advance, Kostas
>
>_______________________________________________
>To control your jdom-interest membership:
>http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com




More information about the jdom-interest mailing list