Bonjour,
J'ai un problème que je n'arrive pas à résoudre; je vous en remercie par avance d'y jeter un coup d’œil.
Je souhaite faire des fusion de fichiers XMl en un seul que j'utiliserai avec xsl.
F1.xml
F2.xml:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 <NewsLetterListeCertificat xmlns="http://tempuri.org/NewsLetterListeCertificat.xsd"> <NewsLetterListeCertificat> <ID_CERTIF>5518</ID_CERTIF> <CD_CERTIF>RUVFBOJAN11</CD_CERTIF> <LB_PROD_US>Animal/denrées animales et produits d'origine animale/Viandes et produits carnés/viande fraîches d'espèces domestiques/espèce bovine/</LB_PROD_US> <ID_PROD_US>203</ID_PROD_US> <LB_PAYS>RUSSIE</LB_PAYS> <DT_VALID>31/05/2011</DT_VALID> <CH_NOM_FICHIER>RUVFBOJAN11.pdf</CH_NOM_FICHIER> <CH_NOM_IMAGE>RUVFBOJAN11@.pdf</CH_NOM_IMAGE> <CD_PROD_US>VFB</CD_PROD_US> </NewsLetterListeCertificat> </NewsLetterListeCertificat>
Voila j’arrive bien à faire la fusion mais je n'arrive pas à me débarrasser des namespace
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 <NewsLetterListeDocComp xmlns="http://tempuri.org/NewsLetterListeDocComp.xsd"> <NewsLetterListeDocComp> <ID_BRPT>455</ID_BRPT> <ID_PROD_US>266</ID_PROD_US> <LB_PROD_US>Animal/Alimentation animale/</LB_PROD_US> <ID_PAYS>36</ID_PAYS> <LB_PAYS>BRESIL</LB_PAYS> <LB_FICHIER>BRESIL_Attestation sanitaire Alimentation animale</LB_FICHIER> <FG_ETAT>V</FG_ETAT> <CH_NOM_FICHIER>BR ALI AVR 11.doc</CH_NOM_FICHIER> <DT_VALID>26/05/2011</DT_VALID> </NewsLetterListeDocComp> </NewsLetterListeDocComp>
Cequi me donne le fichier Final.xml
Voici le code VB qui fait la fusion
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
29
30
31 <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet href="NewsLetter.xsl" type="text/xsl"?> <nl:NewsLetter xmlns:nl="http://www.expadon-dgal/EXPADON"> <NewsLetterListeCertificat xmlns="http://tempuri.org/NewsLetterListeCertificat.xsd"> <NewsLetterListeCertificat> <ID_CERTIF>5518</ID_CERTIF> <CD_CERTIF>RUVFBOJAN11</CD_CERTIF> <LB_PROD_US>Animal/denrées animales et produits d'origine animale/Viandes et produits carnés/viande fraîches d'espèces domestiques/espèce bovine/</LB_PROD_US> <ID_PROD_US>203</ID_PROD_US> <LB_PAYS>RUSSIE</LB_PAYS> <DT_VALID>31/05/2011</DT_VALID> <CH_NOM_FICHIER>RUVFBOJAN11.pdf</CH_NOM_FICHIER> <CH_NOM_IMAGE>RUVFBOJAN11@.pdf</CH_NOM_IMAGE> <CD_PROD_US>VFB</CD_PROD_US> </NewsLetterListeCertificat> </NewsLetterListeCertificat> <NewsLetterListeDocComp xmlns="http://tempuri.org/NewsLetterListeDocComp.xsd"> <NewsLetterListeDocComp> <ID_BRPT>455</ID_BRPT> <ID_PROD_US>266</ID_PROD_US> <LB_PROD_US>Animal/Alimentation animale/</LB_PROD_US> <ID_PAYS>36</ID_PAYS> <LB_PAYS>BRESIL</LB_PAYS> <LB_FICHIER>BRESIL_Attestation sanitaire Alimentation animale</LB_FICHIER> <FG_ETAT>V</FG_ETAT> <CH_NOM_FICHIER>BR ALI AVR 11.doc</CH_NOM_FICHIER> <DT_VALID>26/05/2011</DT_VALID> </NewsLetterListeDocComp> </NewsLetterListeDocComp> </nl:NewsLetter>
Ce n'est pas normal d'avoir des namespace dans les élément du xml en plus de celui du fichier??
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 Dim docGene, docEtab, docFich As New XmlDocument docGene.Load(String.Format("{0}Gene.xml", fullFileName)) docEtab.Load(String.Format("{0}FicheTechs.xml", fullFileName)) docFich.Load(String.Format("{0}ListeEtab.xml", fullFileName)) Dim impNode As XmlNode = docGene.ImportNode(docEtab.DocumentElement, True) docGene.DocumentElement.AppendChild(impNode) impNode = docGene.ImportNode(docFich.DocumentElement, True) docGene.DocumentElement.AppendChild(impNode) docGene.Save(String.Format("{0}Gene.xml", fullFileName))
Merci par avance de toute aide.
Partager