Does somebody know why I don't see any error
with JDOM ?
( See rules.xml and rules.xsd on bottom
)
Because there are 4 errors : The 'name' attribute is not declared in rules.xsd....
<filtre name = "filter1">
It's an error because the element <filtre> is
not declared as a complex
element .
With another website online validator , I have found this 4 errors .
But with JDOM , no error, and I can even
obtain the name attribut ....( which is not decalred....)
log.info(" Filtre Name :
" + onefilter.getAttribute("name").getValue()
);
gives -> Filtre Name :
filter1 ...etc
""""""""""""""""""""""""""""""""""""""""""""""
With another validator : 4 errors found
"""""""""""""""""""""""""""""""""""""""""""""""
Validation error:
Error at (6,13): The 'name' attribute is not
declared. An error occurred at , (6, 13).ou=3106,ou=structures,ou=centrale,ou=mefi,o=gouv,c=fr
Error at (7,13): The 'name' attribute is not
declared. An error occurred at , (7, 13).fonction=PROGRAMMEUR
Error at (11,13): The 'name' attribute is not
declared. An error occurred at , (11, 13).ou=structures,ou=centrale,ou=mefi,o=gouv,c=fr
Error at (12,13): The 'name' attribute is not
declared. An error occurred at , (12, 13).fonction=PUPITREUR
Error at (16,13): The 'name' attribute is not
declared. An error occurred at , (16, 13).ou=structures,ou=centrale,ou=mefi,o=gouv,c=fr
Error at (17,13): The 'name' attribute is not
declared. An error occurred at , (17, 13).ousigle=MCF/DIVERS
"""""""""""""""""""""""""""""""""""
But with JDOM no error found
"""""""""""""""""""""""""""""""""""
String
fichierxml = args[0];
try
{
Document doc = builder.build(fichierxml);
.../...
-------------------------------------------------------------------------------
See my files:
rules.xml
-------------------------------------------------------------------------------
<?xml
version="1.0"?>
<habilitations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="rules.xsd">
<population name="pop1">
<filtre
name="filter1">ou=3106,ou=structures,ou=centrale,ou=mefi,o=gouv,c=fr</filtre>
<filtre
name="filter2">fonction=PROGRAMMEUR</filtre>
</population>
<population
name="pop2">
<filtre
name="filter1">ou=structures,ou=centrale,ou=mefi,o=gouv,c=fr</filtre>
<filtre
name="filter2">fonction=PUPITREUR</filtre>
</population>
<population
name="pop3">
<filtre
name="filter1">ou=structures,ou=centrale,ou=mefi,o=gouv,c=fr</filtre>
<filtre
name="filter2">ousigle=MCF/DIVERS</filtre>
</population>
</habilitations>
------------------------------------------------------------------------------------------
rules.xsd
------------------------------------------------------------------------------------------
<xsd:element
name="habilitations">
<xsd:complexType>
<xsd:sequence minOccurs="0"
maxOccurs="unbounded">
<xsd:element name="population" minOccurs="0"
maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence minOccurs="0"
maxOccurs="unbounded">
<xsd:element name="filtre" minOccurs="1"
maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string"
use="required"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
-----------------------------------------------------------------------------------------------