[From nobody Fri Mar 4 15:40:49 2005 Return-Path: <jdom-interest-bounces@jdom.org> Delivered-To: el@grit.de Received: from localhost (localhost [127.0.0.1]) by mail.grit.de (Postfix) with ESMTP id 060DD370E5 for <el@grit.de>; Sat, 5 Mar 2005 00:40:06 +0100 (CET) Received: from servlets.kattare.com (servlets.com [69.59.195.135]) by mail.grit.de (Postfix) with ESMTP id E334F370E0 for <el@grit.de>; Sat, 5 Mar 2005 00:40:03 +0100 (CET) Received: from servlets.kattare.com (localhost [127.0.0.1]) by servlets.kattare.com (8.12.10/8.12.11) with ESMTP id j24NXXiY001975; Fri, 4 Mar 2005 15:33:35 -0800 Received: from csmtp.b-one.net (csmtp.b-one.net [195.47.247.21]) by servlets.kattare.com (8.12.10/8.12.11) with ESMTP id j24NXPVY026628 for <jdom-interest@jdom.org>; Fri, 4 Mar 2005 15:33:31 -0800 Received: from [10.0.1.129] (unknown [84.217.11.189]) by csmtp.b-one.net (Postfix) with ESMTP id 6A2F2FB9E6; Sat, 5 Mar 2005 00:33:21 +0100 (CET) Message-ID: <4228F03C.4070404@austers.se> Date: Sat, 05 Mar 2005 00:33:16 +0100 From: Per Norrman <per.norrman@austers.se> User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: sv, en-us, en MIME-Version: 1.0 To: Christian Avril <christian.avril@dpma.finances.gouv.fr> Subject: Re: [jdom-interest] Jdom attribut not declared ... but can use References: <000c01c520a0$dc482920$382409a0@alize> In-Reply-To: <000c01c520a0$dc482920$382409a0@alize> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: jdom-interest@jdom.org X-BeenThere: jdom-interest@jdom.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: JDOM Mailing List for General Issues and Updates <jdom-interest.jdom.org> List-Unsubscribe: <http://www.jdom.org/mailman/listinfo/jdom-interest>, <mailto:jdom-interest-request@jdom.org?subject=unsubscribe> List-Archive: <http://www.jdom.org/pipermail/jdom-interest> List-Post: <mailto:jdom-interest@jdom.org> List-Help: <mailto:jdom-interest-request@jdom.org?subject=help> List-Subscribe: <http://www.jdom.org/mailman/listinfo/jdom-interest>, <mailto:jdom-interest-request@jdom.org?subject=subscribe> Sender: jdom-interest-bounces@jdom.org Errors-To: jdom-interest-bounces@jdom.org X-Virus-Scanned: by AMaViS 0.3.12pre8 Hi, XMLSpy thinks that the XML is valid. Wether it is valid or not, is a xerces vs W3C Schema issue, since JDOM delegates schema validation to the XML parser. /pmn Christian Avril skrev: > 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....) > Is it a bug or not ? > ... > log.info(" Filtre Name : " + > onefilter.getAttribute("name").getValue() ); > gives -> Filtre Name : filter1 ...etc > > """""""""""""""""""""""""""""""""""""""""""""" > With another validator : 4 errors found > """"""""""""""""""""""""""""""""""""""""""""""" > *Validation error: * > > <?xml version="1.0"?> <habilitations xmlns:xsi = > "http://www.w3.org/2001/XMLSchema-instance" > xsi:noNamespaceSchemaLocation = "rules.xsd"> <population name = "pop1"> > Error at (6,13): The 'name' attribute is not declared. An error occurred > at , (6, 13).<filtre name = > "filter1">ou=3106,ou=structures,ou=centrale,ou=mefi,o=gouv,c=fr</filtre> > Error at (7,13): The 'name' attribute is not declared. An error occurred > at , (7, 13).<filtre name = "filter2">fonction=PROGRAMMEUR</filtre> > </population> <population name = "pop2"> Error at (11,13): The 'name' > attribute is not declared. An error occurred at , (11, 13).<filtre name > = "filter1">ou=structures,ou=centrale,ou=mefi,o=gouv,c=fr</filtre> Error > at (12,13): The 'name' attribute is not declared. An error occurred at , > (12, 13).<filtre name = "filter2">fonction=PUPITREUR</filtre> > </population> <population name = "pop3"> Error at (16,13): The 'name' > attribute is not declared. An error occurred at , (16, 13).<filtre name > = "filter1">ou=structures,ou=centrale,ou=mefi,o=gouv,c=fr</filtre> Error > at (17,13): The 'name' attribute is not declared. An error occurred at , > (17, 13).<filtre name = "filter2">ousigle=MCF/DIVERS</filtre> > </population> </habilitations> > > > """"""""""""""""""""""""""""""""""" > But with JDOM no error found > """"""""""""""""""""""""""""""""""" > String fichierxml = args[0]; > SAXBuilder builder = new > SAXBuilder("org.apache.xerces.parsers.SAXParser", true); > > builder.setFeature("http://apache.org/xml/features/validation/schema", > true); > 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:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> > > <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> > ----------------------------------------------------------------------------------------------- > > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > To control your jdom-interest membership: > http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com _______________________________________________ To control your jdom-interest membership: http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com ]