From: Lara Callaway (_lara_@visitmail.com)
Date: 19/05/2004 - 08:36
Merci beaucoup pour ton aide, ça marche très bien. J'aimerai cependant faire
une petite modification.
Immaginons que mes fichiers XML deviennent comme cela :
****************************
XML1.XML
<BIBLIO>
<LIVRES>
<LIVRE num="1">
<TRUC1>truc 1<TRUC1>
<TRUC2>truc 1<TRUC2>
<LIVRE>
<LIVRE num="2">
<TRUC1>truc 2<TRUC1>
<TRUC2>truc 2<TRUC2>
<LIVRE>
<LIVRES>
<BIBLIO>
****************************
XML2.XML
<BIBLIO>
<LIVRES>
<LIVRE num="1">
<TRUC1>truc 3<TRUC1>
<TRUC2>truc 3<TRUC2>
<LIVRE>
<LIVRES>
<BIBLIO>
****************************
J'ai donc mon livre qui descend d'un niveau. J'ai modifié le code mais ça ne
fonctionne plus. J'immagine qu'il faut que je change les noms des fonctions de
noeuds ?? Parce que j'ai juste changé livres/livre[@num='1'].
J'ai une erreur du genre : "Le noeud de position d'insertion doit être un noeud
enfant du noeud sous lequel effectuer l'insertion."
Voilà mon code :
****************************
function recuplivre (XMLFile1, XMLFile2) 'ce sont mes fichiers XML
Dim objXML1
Dim objRoot1
Set objXML1 = server.CreateObject("Microsoft.XMLDOM")
if objXML1.load (Server.MapPath(XMLFile1)) then
Set objRoot1 = objlivreXML1.documentElement
else
set objXML1= Nothing
response.write("erreur")
response.end
end if
Dim objXML2
Dim objRoot2
Set objXML2= server.CreateObject("Microsoft.XMLDOM")
if objXML2.load (Server.MapPath(XMLFile2)) then
Set objRoot2= objXML2.documentElement
else
set objXML2= Nothing
response.write("erreur")
response.end
end if
Dim objlivreXML2
Set objlivreXML2 = objRoot2.selectSingleNode("livres/livre[@num='1']")
Dim objlivreXML1
Set objlivreXML1 = objRoot1.selectSingleNode("livres/livre[@num='1']")
Set objRoot1 = objRoot1.replaceChild(objlivreXML2, objlivreXML1)
objXML1.save (Server.MapPath(XMLFile1))
set objXML1= Nothing
set objXML2= Nothing
end function
****************************
Selon Ricaud Matthieu <matthieu.ricaud@cned.fr>:
>
> Bonjour,
>
> Je te propose une solution en asp avec MSXML
--
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)
Archive générée par hypermail 2.1.3 le 28/06/2004 - 11:06 UTC
webmaster@xmlfr.org
|