Re: xpath...

<[email protected]>
Newsgroups gmane.text.xml.french.tech
Message-ID <020501c6a104$4b772b40$0201a8c0@JARLIER>
Merci beaucoup. C'était bien mon problème.
Et vous n'auriez pas une idée pour mon premier problème?

INFO  [STDOUT] Exception :
2006-07-05 15:38:22,896 INFO  [STDOUT] java.lang.ClassCastException:
org.apache.xerces.dom.DeferredTextImpl

Quand je fais ca:
 

if(allLevels = true)
{

          NodeList children = dimElt.getChildNodes();    //IS NOT NULL
	    
          for(int i=0; i<children.getLength(); i++)
          {
		Element elt = (Element)children.item(i);      //PROBLEM HERE

		NodeList listChild =
elt.getElementsByTagName(EthicFlow_DomXMLConfigConstants.ELEMENT_CHILD);
	
for(int j=0; j<listChild.getLength(); j++)
            {
		    Element childElt = (Element)listChild.item(j);
String name = domXMLParser_getElementValue(childElt);
                list.add(name);
}
         }
}

 Pensez-vous que cela soit dû à des espaces dans mon XML ? pourtant je pense
avoir bien vérifié. J'ai aussi cette erreur après: 
org.xml.sax.SAXParseException: Content is not allowed in prolog.

En plus je ne peux pas utiliser autre chose que ce getChildNodes() parce que
si je cherche en faisant getElementByTagName(« Children ») et ensuite
getElementByTagName(« child ») je vais avoir des redondances.

Comment puis-je résoudre ca ? Même en retirant <?xml...UTF8... j'obtiens la
même erreur...

A+ Merci encore
Sophie

-----Message d'origine-----
De : [email protected] [mailto:[email protected]] De la part
de Eric van der Vlist
Envoyé : jeudi 6 juillet 2006 14:14
À : [email protected]
Objet : [xml-tech] Re: xpath...

Bonjour,
Le jeudi 06 juillet 2006 à 13:58 +0200, [email protected] a écrit :
> Another question as well...:
> 
> If I have this XML:
> 
> <config evaluator="string-compare" condition="Function" maxId="6">
>       <children>
>          <child id="General Director" level="100" active="true">
>          	<labels/>
> 		<children>
>          		<child id="Director (Private Bank)" level="80"
> active="true">
>         			<labels/>
>       	            <children>
>          				<child id="Director (Entreprise)"
> level="60" active="true">
>         					<labels/>
> 			         		<!--children>
> 	
> ......................................
> 			         		</children-->
>       				</child>
>          			</children>
>       		</child>
> 	      </children>
> 	 </child>		
>      </children>
>    </config>
> 
> Is it false to use this path to get the Element node Director (Private
> Bank)?
> 
> String xpath = "/config/children//child[@id=' Director (Private Bank)']";

Si vous enlevez l'espace avant "Director" dans votre expression XPath,
cela devrait fonctionner :) ...

Cordialement,

Eric van der Vlist

-- 
GPG-PGP: 2A528005
Freelance consulting and training.
                                            http://dyomedea.com/english/
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
(ISO) RELAX NG   ISBN:0-596-00421-4 http://oreilly.com/catalog/relax
(W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema
------------------------------------------------------------------------


-- Attached file included as plaintext by Ecartis --

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQBErP5qDvn+ZCpSgAURAoBuAJ96fYrBw4np+I+WTIc++xQGajgkUQCffJHm
8+K6iyugY3Ilw90Poub6Ad4=
=ioCs
-----END PGP SIGNATURE-----


--
Devenez redacteur <XML>fr et contribuez au developpement du
xml francophone (http://xmlfr.org/infos/redacteurs/) !

Liste de diffusion "[email protected]" (http://xmlfr.org).

Cette liste est a votre disposition pour discuter en francais de 
tout sujet technique lie a XML.

Pour resilier votre abonnement, envoyez un message contenant 
la commande "unsubscribe" a [email protected]
(mailto:[email protected]?Subject=unsubscribe)


__________ NOD32 1.1646 (20060706) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.