<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1479" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>JDOM SAXBuilder validation
schema<BR>-----------------------------------------------------<BR>Does somebody
know if we are obliged to mention the name of the schema xsd just inside of the
file XML ?<BR>OR if we can place it only in the program Java ?</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>--------------------<BR>For example in
Java,<BR>--------------------<BR>when I use only the builder.setFeature() ...
it'works very well, because the name and the path of the schema xsd
</FONT></DIV>
<DIV><FONT face=Arial size=2>is already written in the XML file, and <STRONG>I
don't need to use the builder.setProperty()</STRONG> : </FONT></DIV>
<DIV><FONT face=Arial
size=2>---------------------------------------------------</FONT></DIV>
<DIV><FONT face=Arial size=2>...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> SAXBuilder builder = new
SAXBuilder("org.apache.xerces.parsers.SAXParser", true);<BR>
builder.setFeature("<A
href="http://apache.org/xml/features/validation/schema">http://apache.org/xml/features/validation/schema</A>",
true);<BR> // builder.setProperty("<A
href="http://apache.org/xml/properties/schema/external-schemaLocation">http://apache.org/xml/properties/schema/external-schemaLocation</A>",<BR>
//
"<A
href="file:///C:/Projets/Jdom-1-0/xml/countries.xsd">file:///C:/Projets/Jdom-1-0/xml/countries.xsd</A>");<BR></FONT></DIV>
<DIV><FONT face=Arial size=2>...
<BR>--------------------------<BR>File
countries.xml<BR>--------------------------<BR><?xml version="1.0"
encoding="UTF-8"?><BR><countries xmlns:xsi="<A
href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</A>"
<BR>xsi:noNamespaceSchemaLocation="countries.xsd">
<!-- the name of my schema is in the file XML ! --><BR> <country
name="England" capital="London"/><BR> <country name="Wales"
capital="Cardiff"/><BR> <country name="Scotland"
capital="Edinburgh"/><BR></countries></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>--------------------------<BR>File
countries.xsd<BR>--------------------------<BR><?xml version="1.0"
encoding="UTF-8"?><BR><xs:schema xmlns:xs="<A
href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>"><BR> <xs:element
name="countries"><BR> <xs:complexType><BR> <xs:sequence
minOccurs="0"
maxOccurs="unbounded"><BR> <xs:element
ref="country"/><BR> </xs:sequence><BR> </xs:complexType><BR> </xs:element><BR> <xs:element
name="country"><BR> <xs:complexType><BR> <xs:attribute
name="name" type="xs:string"
use="required"/><BR> <xs:attribute name="capital"
type="xs:string"
use="required"/><BR> </xs:complexType><BR> </xs:element><BR></xs:schema></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>But, <STRONG>if I don't want to have the name of
the schema reference into the XML file</STRONG>, but only in the java program,
<BR>how Can I do ? I think I need the builder.setProperty() </FONT></DIV>
<DIV><FONT face=Arial size=2>But if I delete the name of the schema from the XML
file, I have the error : <BR>------------------<BR>Error on line 3 of document
<A
href="file:///C:/Projets/Jdom-1-0/xml/countries.xml">file:///C:/Projets/Jdom-1-0/xml/countries.xml</A>:
<BR>cvc-elt.1: Cannot find the declaration of element 'countries'.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>And I know there is no problem with the path
C:/Projets/Jdom-1-0/xml/countries.xml</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Can somebody help ?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thank's in advance</FONT></DIV>
<DIV><FONT face=Arial size=2>I hope this problem can help
somebody<BR></FONT></DIV>
<DIV><FONT face=Arial size=2>Chris</FONT></DIV></BODY></HTML>