Hi,
I am trying to create a XML document with specific prefixes, something like the following:
- <my:doc>
- <book:item property:changed="12/3/2009">Title </book>
- <author:item property:changed="12/3/2009">admin</author>
- </doc>
I am creating a node the following way:
XmlDocument xmlDom;
XmlElement xmlItem;
XmlText xmlText;
xmlItem = xmlDom.CreateElement("MyTag");
XmlAttribute attr = xmlDom.CreateAttribute("attribute");
attr.InnerText = "Text";
xmlItem.Attributes.Append(attr);
xmlText = xmlDom.CreateTextNode("some text");
xmlItem.AppendChild(xmlText);
And the result is something like:
<
MyTag attribute="Text">some text</
MyTag>
I tried to add these prefixes with the xmlDom.CreateAttribute("","",""); method, but this doesn't seem to work. I am also stuck at setting the prefix/namespace of the XML tag (e.g.
prefix:MyTag).
Any help would be appreciated... thanks in advance.