[jdom-interest] JDOM SAXBuilder validation schema with Java

Christian Avril christian.avril at dpma.finances.gouv.fr
Tue Dec 28 02:34:57 PST 2004


Steve,

Thank you . It works.
I have now a example with a file XML without a schema's reference ( But  I keep also the other example with the reference inside )
I don't know if one solution or the other is the best standard. 

File countriesbuild_test.xml
----------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<countries>
 <country name="England" capital="London"/>
 <country name="Wales" capital="Cardiff"/>
 <country name="Scotland" capital="Edinburgh"/>
</countries>


And I use the setProperty() in Java 
----------------------------------------------------
    builder.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",
                      "file:///C:/Projets/Jdom-1-0/xml/countries_test.xsd");


And the validation is OK
-----------------------------------
xml/countriesbuild_test.xml is well formed

OR , 
-------
if I delete an attribute ( for example : name="England" )
I have : Error on line 3 of document file:///C:/Projets/Jdom-1-0/xml/countriesbuild_test.xml: cvc-complex-type.4: Attribute 'name' must appear on element 'country'.
The validation works.

Thank's

Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.jdom.org/pipermail/jdom-interest/attachments/20041228/db8b41c2/attachment.htm


More information about the jdom-interest mailing list