[jdom-interest] Validating with SAXBuilder
Per Norrman
per.norrman at austers.se
Wed Aug 10 14:13:56 PDT 2005
Hi,
it's in the FAQ: http://jdom.org/docs/faq.html#a0360
/pmn
Kostas Karadamoglou skrev:
> 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