X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/77bfb902226a65423999d6d5f15d68ea5398587f..97929f6bd992c185834656b5e3fff5a50ba7360a:/interface/wx/xml/xml.h diff --git a/interface/wx/xml/xml.h b/interface/wx/xml/xml.h index fccaf5341f..cabd080e2f 100644 --- a/interface/wx/xml/xml.h +++ b/interface/wx/xml/xml.h @@ -34,9 +34,11 @@ enum wxXmlNodeType Node has a name and may have content and attributes. Most common node types are @c wxXML_TEXT_NODE (name and attributes are irrelevant) - and @c wxXML_ELEMENT_NODE (e.g. in @c \hi\ there is an element - with name="title", irrelevant content and one child @c wxXML_TEXT_NODE - with content="hi"). + and @c wxXML_ELEMENT_NODE. + + Example: in \hi\ there is an element with the name + @c title and irrelevant content and one child of type @c wxXML_TEXT_NODE + with @c hi as content. If @c wxUSE_UNICODE is 0, all strings are encoded in the encoding given to wxXmlDocument::Load (default is UTF-8). @@ -353,8 +355,8 @@ public: Represents a node attribute. - Example: in @c "\", @c "src" is attribute with value - @c "hello.gif" and @c "id" is a attribute with value @c "3". + Example: in \, @c src is an attribute + with value @c hello.gif and @c id is an attribute with value @c 3. @library{wxxml} @category{xml} @@ -426,39 +428,37 @@ public: @code wxXmlDocument doc; - if (!doc.Load(wxT("myfile.xml"))) - return @false; + if (!doc.Load("myfile.xml")) + return false; // start processing the XML file - if (doc.GetRoot()-GetName() != wxT("myroot-node")) - return @false; + if (doc.GetRoot()->GetName() != "myroot-node") + return false; - wxXmlNode *child = doc.GetRoot()-GetChildren(); + wxXmlNode *child = doc.GetRoot()->GetChildren(); while (child) { - if (child-GetName() == wxT("tag1")) { + if (child->GetName() == "tag1") { // process text enclosed by tag1/tag1 - wxString content = child-GetNodeContent(); + wxString content = child->GetNodeContent(); ... // process attributes of tag1 wxString attrvalue1 = - child-GetAttribute(wxT("attr1"), - wxT("default-value")); + child->GetAttribute("attr1", "default-value"); wxString attrvalue2 = - child-GetAttribute(wxT("attr2"), - wxT("default-value")); + child->GetAttribute("attr2", "default-value"); ... - } else if (child-GetName() == wxT("tag2")) { + } else if (child->GetName() == "tag2") { // process tag2 ... } - child = child-GetNext(); + child = child->GetNext(); } @endcode @@ -468,10 +468,10 @@ public: @code 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: - doc.Save(wxT("myfile2.xml"), wxXML_NO_INDENTATION); + doc.Save("myfile2.xml", wxXML_NO_INDENTATION); @endcode Using default parameters, you will get a reformatted document which in general @@ -479,8 +479,8 @@ public: @code wxXmlDocument doc; - doc.Load(wxT("myfile.xml")); - doc.Save(wxT("myfile2.xml")); // myfile2.xml != myfile.xml + doc.Load("myfile.xml"); + doc.Save("myfile2.xml"); // myfile2.xml != myfile.xml @endcode @library{wxxml} @@ -505,7 +505,7 @@ public: Loads the given filename using the given encoding. See Load(). */ 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().