Duplication de l'attribut de l'élément root
salut mes amis,
j'utilise xmltextwriter pour générer un fichier xml.J'ai deux problème:
1)la duplication de l'attribut root dans les autres éléments:
code:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
XmlTextWriter myXmlTextWriter = new XmlTextWriter ("D:/New Folder/MyXmlff.xml",System.Text.Encoding.UTF8);
myXmlTextWriter.Formatting = Formatting.Indented;
myXmlTextWriter.WriteStartDocument(false);
myXmlTextWriter.WriteStartElement("root");
myXmlTextWriter.WriteAttributeString("xmlns","urn:iso:std:iso:20022:tech:xsd:pain.001.001.02");
myXmlTextWriter.WriteStartElement("pain.001.001.02");
myXmlTextWriter.WriteStartElement("BtchBookg",batch.ToString());
myXmlTextWriter.WriteEndElement();
myXmlTextWriter.Flush();
myXmlTextWriter.WriteEndElement();
myXmlTextWriter.WriteEndElement();
myXmlTextWriter.Close(); |
Output file:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<root xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.02">
<pain.001.001.02>
<Salarié xmlns="A01">
<!--Section A : Group Header-->
<GrpHdr>
<MsgId />
<CreDtTm ="25/02/2011 06:29:09" />
<BtchBookg xmlns="True" />
<NbOfTxs xmlns="1" />
<CtrlSum xmlns="100" />
<Grpg />
<InitgPty> |
comme vous voyez,l'attribut xmlns du root se duplique dans les fils
2) je veux avoir des balise comme ca:
<livre>les miserables</livre>
et NON
<livre xmlns=les miserables />
je souhaite que vous avez comris mon but
merci