Public Member Functions | Static Private Member Functions

Example3 Class Reference

Example to use XMLStorage for writing and reading XML files. More...

List of all members.

Public Member Functions

void testWrite ()
 Write an example XML file to disk.
void testRead ()
 Read the example file back again.

Static Private Member Functions

static void Main (string[] args)
 Main function of Example3.

Detailed Description

Example to use XMLStorage for writing and reading XML files.

Author:
martin

Definition at line 48 of file Example3.cs.


Member Function Documentation

static void Example3::Main ( string[]  args ) [inline, static, private]

Main function of Example3.

Parameters:
argsunused command line arguments

Definition at line 105 of file Example3.cs.

References testRead(), and testWrite().

    {
        Example3 me = new Example3();

        try {
            me.testWrite();
            me.testRead();
        } catch(Exception e) {
            System.Console.Error.WriteLine(e);
            System.Console.Error.WriteLine(e.StackTrace);
        }
    }

Here is the call graph for this function:

void Example3::testRead (  ) [inline]

Read the example file back again.

Definition at line 72 of file Example3.cs.

References XMLStorage::XMLPos::back(), XMLStorage::XMLPos::get(), XMLStorage::XMLPos::go(), XMLStorage::XMLInt::intValue(), and XMLStorage::XMLDoc::readFile().

Referenced by Main().

    {
        XMLDoc doc = new XMLDoc();

         // Einlesen des XML-Files
        doc.readFile("example3.xml");

        XMLPos pos = new XMLPos(doc);

        int stopbits = 0;
        string parity = "";

         // Abfrage der Attributwerte des Elements "Y_ACHSE"
        if (pos.go("Y_ACHSE")) {
            stopbits = new XMLInt(pos, "Stopbits").intValue();
            parity = pos.get("Parity");

            pos.back();
        }

         // Ausgabe der ermittelten Werte
        System.Console.Out.WriteLine("Stopbits: " + stopbits);
        System.Console.Out.WriteLine("Parity: " + parity);

//      assertTrue("Stopbits", 1==stopbits); 
//      assertEquals("Parity", "N", parity); 
    }

Here is the call graph for this function:

void Example3::testWrite (  ) [inline]

Write an example XML file to disk.

Definition at line 53 of file Example3.cs.

References XMLStorage::XMLIntRef::assign(), XMLStorage::XMLPos::back(), XMLStorage::XMLPos::create(), XMLStorage::XMLPos::put(), and XMLStorage::XMLDoc::writeFile().

Referenced by Main().

    {
        XMLDoc doc = new XMLDoc();
        XMLPos pos = new XMLPos(doc);

         // Zusammenstellen der XML-Struktur im Dokument 'doc'
        pos.create("Y_ACHSE");
          new XMLIntRef(pos, "Stopbits").assign(1);
          pos.put("Parity", "N");
        pos.back();

         // Schreiben der XML-Datei
        doc.writeFile("example3.xml");
    }

Here is the call graph for this function:


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