Problème de manipulation de xml - fonction ReplaceChild ?

Résolu
cs_tataye Messages postés 21 Date d'inscription jeudi 30 janvier 2003 Statut Membre Dernière intervention 30 juin 2009 - 15 sept. 2008 à 11:53
cs_tataye Messages postés 21 Date d'inscription jeudi 30 janvier 2003 Statut Membre Dernière intervention 30 juin 2009 - 16 sept. 2008 à 10:12
Bonjour,

J'ai un petit souci pour un de mes traitements xml en asp :

En gros j'ai un xml1
<xml1>
<champA />
<champB>valeur B</champB>
<champC>valeur C</champC>
</xml1>

et un xml2
<xml2>
toto

tata

titi

</xml2>

et j'aimerai obtenir le xml suivant en ajoutant dans le noeud champA le contenu du xml2, élément xml2 exclus :
<xml1>
<champA>
toto

tata

titi

</champA>
<champB>valeur B</champB>
<champC>valeur C</champC>
</xml1>

Avec la fonction appendChild, je ne sais qu'ajouter l'intégralité du xml2, balise xml2 inclus :

Set noeud = xml1.SelectSingleNode( "//champA" ) : If Not noeud Is Nothing Then noeud.appendChild xml2.documentElement

Pourriez-vous m'aiguiller svp ?

1 réponse

cs_tataye Messages postés 21 Date d'inscription jeudi 30 janvier 2003 Statut Membre Dernière intervention 30 juin 2009
16 sept. 2008 à 10:12
Set noeud = xml1.SelectSingleNode( "//champA" )
For Each n In xml2.selectNodes("/xml2/*")
  noeud.appendChild n
Next
3
Rejoignez-nous