|
Revision 179, 0.5 kB
(checked in by John, 4 years ago)
|
added examples
|
| Line | |
|---|
| 1 |
module juno.examples.xml.write; |
|---|
| 2 |
|
|---|
| 3 |
import juno.xml.all; |
|---|
| 4 |
|
|---|
| 5 |
void main() { |
|---|
| 6 |
auto settings = new XmlWriterSettings; |
|---|
| 7 |
settings.indent = true; |
|---|
| 8 |
|
|---|
| 9 |
scope writer = XmlWriter.create("book.xml", settings); |
|---|
| 10 |
|
|---|
| 11 |
writer.writeStartDocument(); |
|---|
| 12 |
writer.writeStartElement("books"); |
|---|
| 13 |
writer.writeStartElement("book"); |
|---|
| 14 |
writer.writeElementString("title", "Villette"); |
|---|
| 15 |
writer.writeElementString("author", "Charlotte Brontë"); |
|---|
| 16 |
writer.writeElementString("publisher", "Penguin"); |
|---|
| 17 |
writer.writeElementString("price", "£7.99"); |
|---|
| 18 |
} |
|---|