Commit XML doc patch.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38962 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2006-04-30 11:37:12 +00:00
parent f644bc116b
commit 434cf5a448
3 changed files with 111 additions and 16 deletions

View File

@@ -1,9 +1,58 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Name: xmlnode.tex
%% Purpose: wxXmlDocument documentation
%% Author: Francesco Montorsi
%% Created: 2006-04-18
%% RCS-ID: $Id$
%% Copyright: (c) 2006 Francesco Montorsi
%% License: wxWindows license
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{\class{wxXmlDocument}}\label{wxxmldocument}
This class holds XML data/document as parsed by XML parser in the root node.
wxXmlDocument internally uses the expat library which comes with wxWidgets to parse the given stream.
A simple example of using XML classes is:
\begin{verbatim}
wxXmlDocument doc;
if (!doc.Load(wxT("myfile.xml"))
return false;
// start processing the XML file
if (doc.GetRoot()->GetName() != wxT("myroot-node"))
return false;
wxXmlNode *child = doc.GetRoot()->GetChildren();
while (child) {
if (child->GetName() == wxT("tag1")) {
// process text enclosed by <tag1></tag1>
wxString content = child->GetNodeContent();
...
// process properties of <tag1>
wxString propvalue1 = child->GetPropVal(wxT("prop1"), wxT("default-value"));
wxString propvalue2 = child->GetPropVal(wxT("prop2"), wxT("default-value"));
...
} else if (child->GetName() == wxT("tag2")) {
// process tag2 ...
}
child = child->GetNext();
}
\end{verbatim}
\wxheading{Derived from}
\helpref{wxObject}{wxobject}