Public Member Functions | Static Public Member Functions

de.mfuchs.WriterTest Class Reference

Example for using XMLStreamWriter. More...

List of all members.

Public Member Functions

void testWriter () throws IOException
 Write an example XML file to disk.

Static Public Member Functions

static void main (String[] args)
 Main function of WriterTest.

Detailed Description

Example for using XMLStreamWriter.

Author:
martin

Definition at line 54 of file WriterTest.java.


Member Function Documentation

static void de.mfuchs.WriterTest.main ( String[]  args ) [static]

Main function of WriterTest.

Parameters:
argsunused command line arguments

Definition at line 132 of file WriterTest.java.

References de.mfuchs.WriterTest.testWriter().

    {
        WriterTest me = new WriterTest();

        try {
            me.testWriter();
        } catch(Exception e) {
            e.printStackTrace();
        }
    }

Here is the call graph for this function:

void de.mfuchs.WriterTest.testWriter (  ) throws IOException

Write an example XML file to disk.

Exceptions:
Exception

Definition at line 60 of file WriterTest.java.

References de.mfuchs.xmlstorage.stream.XMLStreamWriter.back(), de.mfuchs.xmlstorage.stream.XMLStreamWriter.close(), de.mfuchs.xmlstorage.stream.XMLStreamWriter.create(), de.mfuchs.xmlstorage.stream.XMLStreamWriter.put(), and de.mfuchs.xmlstorage.stream.XMLStreamWriter.setContent().

Referenced by de.mfuchs.WriterTest.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();
    }

Here is the call graph for this function:


The documentation for this class was generated from the following file: