repair the example code; get rid of useless wxT() from it

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57112 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2008-12-04 21:50:52 +00:00
parent 8b6264b43e
commit 1707da0c37

View File

@@ -426,39 +426,37 @@ public:
@code @code
wxXmlDocument doc; wxXmlDocument doc;
if (!doc.Load(wxT("myfile.xml"))) if (!doc.Load("myfile.xml"))
return @false; return @false;
// start processing the XML file // start processing the XML file
if (doc.GetRoot()-GetName() != wxT("myroot-node")) if (doc.GetRoot()->GetName() != "myroot-node")
return @false; return @false;
wxXmlNode *child = doc.GetRoot()-GetChildren(); wxXmlNode *child = doc.GetRoot()->GetChildren();
while (child) { while (child) {
if (child-GetName() == wxT("tag1")) { if (child-GetName() == "tag1") {
// process text enclosed by tag1/tag1 // process text enclosed by tag1/tag1
wxString content = child-GetNodeContent(); wxString content = child->GetNodeContent();
... ...
// process attributes of tag1 // process attributes of tag1
wxString attrvalue1 = wxString attrvalue1 =
child-GetAttribute(wxT("attr1"), child->GetAttribute("attr1", "default-value");
wxT("default-value"));
wxString attrvalue2 = wxString attrvalue2 =
child-GetAttribute(wxT("attr2"), child->GetAttribute("attr2", "default-value");
wxT("default-value"));
... ...
} else if (child-GetName() == wxT("tag2")) { } else if (child->GetName() == "tag2") {
// process tag2 ... // process tag2 ...
} }
child = child-GetNext(); child = child->GetNext();
} }
@endcode @endcode
@@ -468,10 +466,10 @@ public:
@code @code
wxXmlDocument doc; wxXmlDocument doc;
doc.Load(wxT("myfile.xml"), wxT("UTF-8"), wxXMLDOC_KEEP_WHITESPACE_NODES); doc.Load("myfile.xml", "UTF-8", wxXMLDOC_KEEP_WHITESPACE_NODES);
// myfile2.xml will be indentic to myfile.xml saving it this way: // myfile2.xml will be indentic to myfile.xml saving it this way:
doc.Save(wxT("myfile2.xml"), wxXML_NO_INDENTATION); doc.Save("myfile2.xml", wxXML_NO_INDENTATION);
@endcode @endcode
Using default parameters, you will get a reformatted document which in general Using default parameters, you will get a reformatted document which in general
@@ -479,8 +477,8 @@ public:
@code @code
wxXmlDocument doc; wxXmlDocument doc;
doc.Load(wxT("myfile.xml")); doc.Load("myfile.xml");
doc.Save(wxT("myfile2.xml")); // myfile2.xml != myfile.xml doc.Save("myfile2.xml"); // myfile2.xml != myfile.xml
@endcode @endcode
@library{wxxml} @library{wxxml}
@@ -505,7 +503,7 @@ public:
Loads the given filename using the given encoding. See Load(). Loads the given filename using the given encoding. See Load().
*/ */
wxXmlDocument(const wxString& filename, wxXmlDocument(const wxString& filename,
const wxString& encoding = wxT("UTF-8")); const wxString& encoding = "UTF-8"));
/** /**
Loads the XML document from given stream using the given encoding. See Load(). Loads the XML document from given stream using the given encoding. See Load().