Functions

example-parse.cpp File Reference

#include <xmlstorage.h>
#include <iostream>
Include dependency graph for example-parse.cpp:

Go to the source code of this file.

Functions

void test_read1 ()
void test_read2 ()
int main ()

Function Documentation

int main (  )

Definition at line 92 of file example-parse.cpp.

References test_read1(), and test_read2().

{
    test_read1();
    test_read2();

    return 0;
}

Here is the call graph for this function:

void test_read1 (  )

Definition at line 48 of file example-parse.cpp.

References XMLStorage::XMLPos::back(), XMLStorage::XMLPos::go(), XMLStorage::XMLDoc::read_file(), and XMLStorage::XMLDoc::write_file().

Referenced by main().

{
    XMLDoc doc;

     // Einlesen des XML-Files
    doc.read_file("example1.xml");
    doc.write_file("example1-out.xml");

    XMLPos pos(&doc);
    string filename;

     // Abfrage eines Elementinhalts, beispielsweise von FONT_FILENAME
    if (pos.go("PARAMS/FONT/FONT_FILENAME")) {
        filename = pos->get_content();
        pos.back();
    }

     // Ausgabe des ermittelten Werts
    cout << "font filename: " << filename << '\n';
}

Here is the call graph for this function:

Here is the caller graph for this function:

void test_read2 (  )

Definition at line 70 of file example-parse.cpp.

References XMLStorage::XMLPos::back(), XMLStorage::XMLPos::go(), XMLStorage::XMLDoc::read_file(), and XMLStorage::XMLDoc::write_file().

Referenced by main().

{
    XMLDoc doc;

     // Einlesen des XML-Files
    doc.read_file("example2.xml");
    doc.write_file("example2-out.xml");

    XMLPos pos(&doc);
    string filename;

     // Abfrage eines Attributwerts, beispielsweise von "font_filename"
    if (pos.go("PARAMS/FONT")) {
        filename = pos["font_filename"];
        pos.back();
    }

     // Ausgabe des ermittelten Werts
    cout << "font filename: " << filename << '\n';
}

Here is the call graph for this function:

Here is the caller graph for this function: