Bonjour,
voici ce qui devrait répondre à vore problème:
c'est du vbscript facilement transposabe dans d'autres langages
Set xml = LoadXMLString ("votre string")
Function LoadXMLString(strToLoad)
Dim objXML
Set objXML = CreateObject("Msxml2.FreeThreadedDOMDocument.4.0")
objXML.async = False
objXML.setProperty "NewParser", True
objXML.setProperty "SelectionLanguage", "XPath"
objXML.setProperty "SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'"
objXML.loadXML (strToLoad)
Set LoadXMLString = objXML
End Function
cordialement
Yoni Rachovitch
-----Message d'origine-----
De : xml-tech-bounce@xmlfr.org [mailto:xml-tech-bounce@xmlfr.org]De la
part de Herve AGNOUX
Envoyé : mercredi 3 mai 2006 01:34
À : xml-tech@xmlfr.org
Objet : [xml-tech] Re: Creation d'un DOM document a partir d'un string
Pour que l'on puisse vous répondre, pourriez-vous nous donner un peu plus
d'informations sur votre contexte ?... j'ai l'impression que vous travaillez
en java, mais je ne vois pas trop à quoi correspond votre "xInterrogate" ?
Le Mardi 2 Mai 2006 15:23, ziad.elkhatib@mpsa.com a écrit :
> Bonjour,
>
> Je possede un String dans lequel il y a du XML. Je voudrais faire un xpath
> sur ce String. Pour cela, j'essaye de transformer mon String:
>
> ByteArrayInputStream documentStream = new
> ByteArrayInputStream(xmlFlux.getBytes());
> NodeList phraseNodeList = xInterrogate.evaluate("phrase",documentStream);
>
> sachant que :
> xmlFlux = <phrases><phrase><code>V34490</code></phrase></phrases>
>
> Dans ce cas precis j'obtiens:
> phraseNodeList.getLength() = 0 alors qu'il devrait me retourner 1 !
>
> Merci
>
>
> --
> Devenez redacteur <XML>fr et contribuez au developpement du
> xml francophone (http://xmlfr.org/infos/redacteurs/) !
>
> Liste de diffusion "xml-tech@xmlfr.org" (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 xml-tech-request@xmlfr.org
> (mailto:xml-tech-request@xmlfr.org?Subject=unsubscribe)
--
SARL diaam informatique - 04 77 25 43 28
Ingenierie, développements de systèmes d'information
http://www.diaam-informatique.com
--
Devenez redacteur <XML>fr et contribuez au developpement du
xml francophone (http://xmlfr.org/infos/redacteurs/) !
Liste de diffusion "xml-tech@xmlfr.org" (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 xml-tech-request@xmlfr.org
(mailto:xml-tech-request@xmlfr.org?Subject=unsubscribe)
--
Devenez redacteur <XML>fr et contribuez au developpement du
xml francophone (http://xmlfr.org/infos/redacteurs/) !
Liste de diffusion "xml-tech@xmlfr.org" (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 xml-tech-request@xmlfr.org
(mailto:xml-tech-request@xmlfr.org?Subject=unsubscribe)
Received on Wed May 3 10:28:37 2006