Re: creer un element dans un doc a partir d'un string

Stephane Bortzmeyer <[email protected]>
Newsgroups gmane.text.xml.french.tech
Message-ID <[email protected]>
On Wed, Mar 08, 2006 at 07:21:02PM +0100,
 [email protected] <[email protected]> wrote 
 a message of 33 lines which said:

> Je possede une string que j'aimerais transformer  en Element.

Ben, il faudrait donner d'avantage de détails sur votre environnement
de développement. DOM ? Quel niveau de DOM ? En quel langage ?

(LoadXmlString, que quelqu'un a imprudemment conseillé, semble
spécifique à .NET.)

Par exemple, en Python avec minidom, cela donne :

from xml.dom.minidom import parseString

dom = parseString("""
   <phrase>
                  <separateur>;</separateur>
                  <code>5454</code>
                  <param>val1</param>
                  <param>val2</param>
                  <param>val3</param>
            </phrase>
""")  
print "Parsed with success, root element is \"%s\"" % dom.documentElement.tagName
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.