<!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.1491" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi, </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Yes, you are right. JDOM delegates schema
validation.</FONT></DIV>
<DIV><FONT face=Arial size=2>Sorry for this error, and thank you for this
information.</FONT></DIV>
<DIV><FONT face=Arial size=2>Then, I was looking at my xerces.jar
, but it's the same as online's </FONT></DIV>
<DIV><FONT face=Arial size=2>xerces.jar 937 Ko 2004-Feb-04
)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>But if it is a xerces's problem, what should I
do ? with xerces and Apache I mean.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>About my file, rules.xsd, I have found
another schema declaration : </FONT></DIV>
<DIV><FONT face=Arial size=2>And JDOM, sorry, xerces works with it . ( and also
another XSD Schema Validation )</FONT></DIV>
<DIV><FONT face=Arial size=2>But maybe we can make shorter ?</FONT></DIV>
<DIV><FONT face=Arial
size=2>---------------------------------------------------------------------------------------</FONT></DIV>
<DIV><FONT face=Arial size=2><xsd:element name =
"filtre"><BR>
<xsd:complexType><BR>
<xsd:simpleContent><BR>
<xsd:extension base =
"xsd:string"><BR>
<xsd:attribute name = "name" use =
"required"/><BR>
</xsd:extension><BR>
</xsd:simpleContent><BR>
</xsd:complexType><BR>
</xsd:element> </FONT></DIV>
<DIV><FONT face=Arial
size=2>-----------------------------------------------------------------------------------------</FONT></DIV>
<DIV><FONT face=Arial size=2>better than </FONT></DIV>
<DIV><FONT face=Arial size=2>------</FONT></DIV>
<DIV><FONT face=Arial size=2><xsd:sequence minOccurs="0"
maxOccurs="unbounded"><BR>
<xsd:element name="filtre" minOccurs="1"
maxOccurs="unbounded"/><BR></xsd:sequence></FONT></DIV>
<DIV><FONT face=Arial
size=2>-------------------------------------------------------------------</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Best regards</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Chris</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=per.norrman@austers.se href="mailto:per.norrman@austers.se">Per
Norrman</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=christian.avril@dpma.finances.gouv.fr
href="mailto:christian.avril@dpma.finances.gouv.fr">Christian Avril</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Cc:</B> <A title=jdom-interest@jdom.org
href="mailto:jdom-interest@jdom.org">jdom-interest@jdom.org</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Saturday, March 05, 2005 12:33
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [jdom-interest] Jdom
attribut not declared ... but can use</DIV>
<DIV><FONT face=Arial size=2></FONT><FONT face=Arial
size=2></FONT><BR></DIV>Hi,<BR><BR>XMLSpy thinks that the XML is valid. Wether
it is valid or not,<BR>is a xerces vs W3C Schema issue, since JDOM delegates
schema<BR>validation to the XML parser.<BR><BR>/pmn<BR><BR><BR><BR>Christian
Avril skrev:<BR>> Does somebody know why I don't see any error with JDOM
?<BR>> ( See rules.xml and rules.xsd on bottom )<BR>> Because there are
4 errors : The 'name' attribute is not declared in <BR>>
rules.xsd.... <filtre name = "filter1"><BR>> It's an error because
the element <filtre> is not declared as a complex <BR>> element
.<BR>> With another website online validator , I have found this 4 errors
.<BR>> But with JDOM , no error, and I can even obtain the name attribut
....( <BR>> which is not decalred....)<BR>> Is it a bug or not ?<BR>>
...<BR>> log.info(" Filtre Name :
" + <BR>> onefilter.getAttribute("name").getValue()
);<BR>> gives -> Filtre Name : filter1
...etc<BR>> <BR>> """"""""""""""""""""""""""""""""""""""""""""""<BR>>
With another validator : 4 errors found<BR>>
"""""""""""""""""""""""""""""""""""""""""""""""<BR>> *Validation error:
*<BR>> <BR>> <?xml version="1.0"?> <habilitations xmlns:xsi =
<BR>> "<A
href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</A>"
<BR>> xsi:noNamespaceSchemaLocation = "rules.xsd"> <population name =
"pop1"> <BR>> Error at (6,13): The 'name' attribute is not declared. An
error occurred <BR>> at , (6, 13).<filtre name = <BR>>
"filter1">ou=3106,ou=structures,ou=centrale,ou=mefi,o=gouv,c=fr</filtre>
<BR>> Error at (7,13): The 'name' attribute is not declared. An error
occurred <BR>> at , (7, 13).<filtre name =
"filter2">fonction=PROGRAMMEUR</filtre> <BR>> </population>
<population name = "pop2"> Error at (11,13): The 'name' <BR>>
attribute is not declared. An error occurred at , (11, 13).<filtre name
<BR>> =
"filter1">ou=structures,ou=centrale,ou=mefi,o=gouv,c=fr</filtre>
Error <BR>> at (12,13): The 'name' attribute is not declared. An error
occurred at , <BR>> (12, 13).<filtre name =
"filter2">fonction=PUPITREUR</filtre> <BR>> </population>
<population name = "pop3"> Error at (16,13): The 'name' <BR>>
attribute is not declared. An error occurred at , (16, 13).<filtre name
<BR>> =
"filter1">ou=structures,ou=centrale,ou=mefi,o=gouv,c=fr</filtre>
Error <BR>> at (17,13): The 'name' attribute is not declared. An error
occurred at , <BR>> (17, 13).<filtre name =
"filter2">ousigle=MCF/DIVERS</filtre> <BR>> </population>
</habilitations><BR>> <BR>> <BR>>
"""""""""""""""""""""""""""""""""""<BR>> But with JDOM no error
found<BR>>
"""""""""""""""""""""""""""""""""""<BR>>
String fichierxml =
args[0];<BR>> SAXBuilder
builder = new <BR>> SAXBuilder("org.apache.xerces.parsers.SAXParser",
true);<BR>> <BR>>
builder.setFeature("<A
href="http://apache.org/xml/features/validation/schema">http://apache.org/xml/features/validation/schema</A>",
<BR>> true);<BR>> try
{<BR>>
Document doc = builder.build(fichierxml);<BR>> .../...<BR>>
-------------------------------------------------------------------------------<BR>>
See my files:<BR>> <BR>> rules.xml<BR>>
-------------------------------------------------------------------------------<BR>>
<?xml version="1.0"?><BR>> <habilitations xmlns:xsi="<A
href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</A>"<BR>>
xsi:noNamespaceSchemaLocation="rules.xsd"><BR>>
<BR>> <population
name="pop1"><BR>> <filtre <BR>>
name="filter1">ou=3106,ou=structures,ou=centrale,ou=mefi,o=gouv,c=fr</filtre><BR>>
<filtre
name="filter2">fonction=PROGRAMMEUR</filtre><BR>>
</population><BR>> <BR>>
<population name="pop2"><BR>> <filtre
<BR>>
name="filter1">ou=structures,ou=centrale,ou=mefi,o=gouv,c=fr</filtre><BR>>
<filtre
name="filter2">fonction=PUPITREUR</filtre><BR>>
</population><BR>> <BR>>
<population name="pop3"><BR>> <filtre
<BR>>
name="filter1">ou=structures,ou=centrale,ou=mefi,o=gouv,c=fr</filtre><BR>>
<filtre
name="filter2">ousigle=MCF/DIVERS</filtre><BR>>
</population> <BR>> <BR>>
</habilitations><BR>>
------------------------------------------------------------------------------------------<BR>>
<BR>> rules.xsd<BR>>
------------------------------------------------------------------------------------------<BR>>
<xsd:schema xmlns:xsd="<A
href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>"><BR>>
<BR>> <xsd:element
name="habilitations"><BR>>
<xsd:complexType><BR>>
<xsd:sequence minOccurs="0"
maxOccurs="unbounded"><BR>>
<xsd:element name="population" minOccurs="0" <BR>>
maxOccurs="unbounded"><BR>>
<xsd:complexType><BR>>
<xsd:sequence minOccurs="0"
maxOccurs="unbounded"><BR>>
<xsd:element name="filtre" minOccurs="1" <BR>>
maxOccurs="unbounded"/><BR>>
</xsd:sequence><BR>>
<xsd:attribute name="name" type="xsd:string" <BR>>
use="required"/><BR>>
</xsd:complexType><BR>>
</xsd:element> <BR>>
</xsd:sequence><BR>>
</xsd:complexType> <BR>>
</xsd:element><BR>> </xsd:schema><BR>>
-----------------------------------------------------------------------------------------------<BR>>
<BR>> <BR>> <BR>> <BR>> <BR>>
------------------------------------------------------------------------<BR>>
<BR>> _______________________________________________<BR>> To control
your jdom-interest membership:<BR>> <A
href="http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com">http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com</A><BR><BR></BLOCKQUOTE></BODY></HTML>