Berikut contoh sederhana mengenai XMLWriter :
Dim writer As XmlWriter = bla.. bla.. bla...
writer.WriteStartElement("BookCollection")
writer.WriteStartElement("book")
writer.WriteElementString("title", "A")
writer.WriteElementString("price", "19.95")
writer.WriteEndElement()
writer.WriteStartElement("book")
writer.WriteElementString("title", "B")
writer.WriteElementString("price", "39.95")
writer.WriteEndElement()
writer.WriteEndElement()
writer.Flush()
Dan hasil nya sbb:
<?xml version="1.0" encoding="utf-8" ?>
- <BookCollection>
- <book>
<title>A</title>
<price>19.95</price>
</book>
<book>
<title>B</title>
<price>39.95</price>
</book>
</BookCollection>
Tidak ada komentar:
Posting Komentar