#include <xmlstorage.h>#include <iostream>
Go to the source code of this file.
Functions | |
| void | test_write () |
| void | test_read () |
| int | main () |
| int main | ( | ) |
Definition at line 91 of file example3.cpp.
References test_read(), and test_write().
{
test_write();
test_read();
return 0;
}

| void test_read | ( | ) |
Definition at line 65 of file example3.cpp.
References XMLStorage::XMLPos::back(), XMLStorage::XMLPos::go(), and XMLStorage::XMLDoc::read_file().
{
XMLDoc doc;
// Einlesen des XML-Files
doc.read_file("example3.xml");
XMLPos pos(&doc);
int stopbits = 0;
string parity;
// Abfrage der Attributwerte des Elements "Y_ACHSE"
if (pos.go("Y_ACHSE")) {
stopbits = XMLInt(pos, "Stopbits");
parity = pos["Parity"];
pos.back();
}
// Ausgabe der ermittelten Werte
cout << "Stopbits: " << stopbits << '\n';
cout << "Parity: " << parity << '\n';
}

| void test_write | ( | ) |
Definition at line 49 of file example3.cpp.
References XMLStorage::XMLPos::back(), XMLStorage::XMLPos::create(), and XMLStorage::XMLDoc::write_file().
{
XMLDoc doc;
XMLPos pos(&doc);
// Zusammenstellen der XML-Struktur im Dokument 'doc'
pos.create("Y_ACHSE");
pos["Stopbits"] = XMLInt(1);
pos["Parity"] = "N";
pos.back();
// Schreiben der XML-Datei
doc.write_file("example3.xml");
}

1.7.2