[MSXML3][VBA] Attribut xmlns de la balise racine
Bonjour à tous,
Je dois générer des fichiers XML à partir d'une applicatiopn Access en VbA
Je suis parti sur la base de la syntaxe du tutoriel de Arkam.
(avec des With ……. End With)
http://arkham46.developpez.com/artic...b/?page=page_4
Je dois créer un attribut au niveau de la balise
Code:
1 2
| <Document>
xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" |
en utilisant la syntaxe suivante :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| With oXML.appendChild(oXML.createElement("Document"))
' ces 3 lignes créent 2 Attributs (rouges)
Set docAttrib = oXML.createAttribute("xmlns")
docAttrib.Text = "urn:iso:std:iso:20022:tech:xsd:pain.008.001.02"
.Attributes.setNamedItem docAttrib
With .appendChild(oXML.createElement("CstmrDrctDbtInitn"))
With .appendChild(oXML.createElement("GrpHdr"))
With .appendChild(oXML.createElement("MsgId"))
.Text = Left(TxtAcronyme & " " & DATEHEURE, 35)
End With
With .appendChild(oXML.createElement("CreDtTm"))
.Text = DATEHEURE
End With
With .appendChild(oXML.createElement("NbOfTxs"))
.Text = TxtNbOfTxs
End With
With .appendChild(oXML.createElement("CtrlSum"))
.Text = TxtCtrlSum
End With
With .appendChild(oXML.createElement("InitgPty"))
With .appendChild(oXML.createElement("Nm"))
.Text = Left(TxtNomSociete, 70)
End With
End With
End With
End With |
Cela provoque la création de l’attribut au niveau de la balise <Document> (ce qui est souhaité)
Et également, après au niveau de la balise "Child" suivante
Code:
< CstmrDrctDbtInitn >
(ce qui n’est pas souhaité)
Comment Faire ?.
J’ai trouvé ce lien sur le forum, mais je n’arrive pas à mettre en œuvre la syntaxe
http://www.developpez.net/forums/d76...balise-racine/
Je maîtrise mal la syntaxe XML
Merci de votre aide.
Cordialement
FEVEC