Bonjour

Je dois creer un fichier xml qui ressemble a ca :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ie:DFRCD815A
  xmlns:tms="http://......."
  xmlns:fr="http://......"
  xmlns:ie="http://......."
  xmlns:xsi="http.........">
 
 <ie:Body>
  <ie:SubmittedDraftOfEaad>
   <ie:ConsigneeTrader>
     <ie:Traderid>
        .......
      </ie:Traderid>

J'arrive a creer ca :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ie:DFRCD815A fr:fr=""
   tms:tms=""
   xsi:xsi=""
   xmlns:tms="http://.............."
   xmlns:fr="http://..........."
   xmlns:ie="http://.........."
   xmlns:xsi="http://...........">
  <Body>
   <SubmittedDraftOfEaad>
    <ConsigneeTrader>
     <Traderid>
        ..........
     </Traderid>

Comme vous pouvez le voir il me manque les ie: -> namespace a chaque noeud
et le code me genere :
fr:fr="" tms:tms="" xsisi="" ca en trop


Voici mon code :
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
32
33
34
35
string tms = <a href="http://......;" target="_blank">http://......;</a>
string ie = <a href="http://.......;" target="_blank">http://.......;</a>
string fr = <a href="http://.........;" target="_blank">http://.........;</a>
string xsi = <a href="http://........;" target="_blank">http://........;</a>
 
XmlDocument docXml = new XmlDocument();
 
XmlDeclaration docNode = docXml.CreateXmlDeclaration("1.0", "UTF-8", "yes");
docXml.AppendChild(docNode);
XmlElement CD801A = docXml.CreateElement("ie", "DFRCD815A", ie);
docXml.AppendChild(CD801A);
 
 
//attribut
XmlAttribute IE1 = docXml.CreateAttribute("tms", "tms", tms);
CD801A.SetAttributeNode(IE1);
XmlAttribute IE2 = docXml.CreateAttribute("fr", "fr", fr);
CD801A.SetAttributeNode(IE2);
XmlAttribute IE3 = docXml.CreateAttribute("xsi", "xsi", xsi);
 
CD801A.SetAttributeNode(IE3);
 
XmlNode Body = docXml.CreateElement("Body");
CD801A.AppendChild(Body);
 
 
XmlNode SubmittedDraftOfEaad = docXml.CreateElement("SubmittedDraftOfEaad");
Body.AppendChild(SubmittedDraftOfEaad);
 
//ConsigneeTrader
XmlNode DestinataireNode = docXml.CreateElement("ConsigneeTrader");
SubmittedDraftOfEaad.AppendChild(DestinataireNode);
XmlNode IdDestNode = docXml.CreateElement("Traderid");
IdDestNode.AppendChild(docXml.CreateTextNode(LeDAE.StrNumAcciseDest));
DestinataireNode.AppendChild(IdDestNode);

j'espere que quelqu'un pourra m'aider

merci d'avance