Functions

example-xpath.cpp File Reference

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

Go to the source code of this file.

Functions

void test_write ()
void test_read ()
int main ()

Function Documentation

int main (  )

Definition at line 89 of file example-xpath.cpp.

References test_read(), and test_write().

{
    test_write();
    test_read();

    return 0;
}

Here is the call graph for this function:

void test_read (  )

Definition at line 68 of file example-xpath.cpp.

References XMLStorage::XMLPos::count(), XMLStorage::XMLPos::filter(), XMLStorage::XMLPos::go(), XMLStorage::XMLDoc::read_file(), and XMLStorage::XMLDoc::write().

Referenced by main().

{
    XMLDoc doc;

     // Einlesen des XML-Files
    doc.read_file("example-xpath.xml");

    XMLPos pos(&doc);

    cout << "matching 'Test/Child': " << pos.count("Test/Child") << endl;
    cout << "matching 'Test/Child[@id=\"1234\"]': " << pos.count("Test/Child[@id=\"1234\"]") << endl;

    XMLDoc target_doc;
    pos.filter("Test/Child[@id=\"1234\" and @txt=\"abc\"]", target_doc);
    target_doc.write(cout);

    pos.go("Test/Child[ 3 ]");
    cout << "content: " << pos->get_content() << endl;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void test_write (  )

Definition at line 46 of file example-xpath.cpp.

References XMLStorage::XMLWriter::back(), XMLStorage::XMLWriter::create(), and XMLStorage::XMLWriter::set_content().

Referenced by main().

{
    XMLWriter out("example-xpath.xml");

    out.create("Test");
      out.create("Child");
      out.set_content("Wert1");
      out.back();

      out.create("Child");
      out["id"] = XMLInt(1234);
      out["txt"] = "abc";
      out.set_content("Wert2");
      out.back();

      out.create("Child");
      out.set_content("Wert3");
      out.back();
    out.back();
}

Here is the call graph for this function:

Here is the caller graph for this function: