Example for using XMLStreamWriter. More...
Public Member Functions | |
void | testWriter () |
Write an example XML file to disk. | |
Static Private Member Functions | |
static void | Main (string[] args) |
Main function of WriterTest. |
Example for using XMLStreamWriter.
Definition at line 47 of file WriterTest.cs.
static void WriterTest::Main | ( | string[] | args ) | [inline, static, private] |
Main function of WriterTest.
args | unused command line arguments |
Definition at line 124 of file WriterTest.cs.
References testWriter().
{ WriterTest me = new WriterTest(); try { me.testWriter(); } catch(Exception e) { System.Console.Error.WriteLine(e); System.Console.Error.WriteLine(e.StackTrace); } }
void WriterTest::testWriter | ( | ) | [inline] |
Write an example XML file to disk.
Definition at line 52 of file WriterTest.cs.
References XMLStorage::XMLStreamWriter::back(), XMLStorage::XMLStreamWriter::close(), XMLStorage::XMLStreamWriter::create(), XMLStorage::XMLStreamWriter::put(), and XMLStorage::XMLStreamWriter::setContent().
Referenced by Main().
{ XMLStreamWriter wr = new XMLStreamWriter("writertest.xml"); wr.create("root"); wr.create("example1"); wr.create("PARAMS"); wr.create("TEXT"); wr.setContent("Testgruppe"); wr.back(); // </TEXT> wr.create("COLOR"); wr.create("RED"); wr.setContent("234"); wr.back(); // </RED> wr.create("GREEN"); wr.setContent("22"); wr.back(); // </GREEN> wr.create("BLUE"); wr.setContent("33"); wr.back(); // </BLUE> wr.back(); // </COLOR> wr.create("FONT"); wr.create("FONT_FILENAME"); wr.setContent("Arial.ttf"); wr.back(); // </FONT_FILENAME> wr.create("SIZE"); wr.setContent("12"); wr.back(); // </SIZE> wr.back(); // </FONT> wr.back(); // </PARAMS> wr.back(); // </example1> wr.create("example2"); wr.create("PARAMS"); wr.put("text", "Testgruppe"); wr.create("COLOR"); wr.put("red", new XMLInt(234)); wr.put("green", new XMLInt(22)); wr.put("blue", new XMLInt(33)); wr.back(); // </COLOR> wr.create("FONT"); wr.put("font_filename", "Arial.ttf"); wr.put("size", new XMLInt(12)); wr.back(); // </FONT> wr.back(); // </PARAMS> wr.back(); // </example2> wr.create("example3"); wr.create("Y_ACHSE"); wr.put("Stopbits", new XMLInt(1)); wr.put("Parity", "N"); wr.back(); wr.back(); // </example3> wr.back(); // </root> wr.close(); }