How to wrtie a XML License Line in C#?
Posted
by Nano HE
on Stack Overflow
See other posts from Stack Overflow
or by Nano HE
Published on 2010-03-25T09:08:57Z
Indexed on
2010/03/25
9:13 UTC
Read the original article
Hit count: 189
My want to write a XML file as this:
<?xml version="1.0" encoding="UTF-8"?>
<Equipment xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<License licenseId="" licensePath="" />
Some piece of my code attached here
// Create a new file in D:\\ and set the encoding to UTF-8
XmlTextWriter textWriter = new XmlTextWriter("D:\\books.xml", System.Text.Encoding.UTF8);
// Format automatically
textWriter.Formatting = Formatting.Indented;
// Opens the document
textWriter.WriteStartDocument();
// Write the namespace declaration.
textWriter.WriteStartElement("books", null);
// Write the genre attribute.
textWriter.WriteAttributeString("xmlns", "xsd", null, "http://www.w3.org/2001/XMLSchema");
textWriter.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance");
And now I need to write the License Line below in C#
<License licenseId="" licensePath="" />
But I don't know how to move on for I found the Line ended with the special /> .Thank you.
© Stack Overflow or respective owner