X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/12d9e30820444b48882ab9e29139611b99a84495..c6ebc32af0bd65527ab148d512dfdd67f3fcbd0a:/contrib/utils/wxrcedit/xmlhelpr.cpp diff --git a/contrib/utils/wxrcedit/xmlhelpr.cpp b/contrib/utils/wxrcedit/xmlhelpr.cpp index c5a56f854e..55b5ade824 100644 --- a/contrib/utils/wxrcedit/xmlhelpr.cpp +++ b/contrib/utils/wxrcedit/xmlhelpr.cpp @@ -17,7 +17,7 @@ #pragma hdrstop #endif -#include "wx/xml/xml.h" +#include "wx/xrc/xml.h" #include "wx/wx.h" #include "wx/tokenzr.h" #include "xmlhelpr.h" @@ -55,19 +55,36 @@ wxXmlNode *XmlFindNode(wxXmlNode *parent, const wxString& path) -void XmlWriteValue(wxXmlNode *parent, const wxString& name, const wxString& value) +wxXmlNode *XmlCreateNode(wxXmlNode *parent, const wxString& name) { - wxXmlNode *n = XmlFindNode(parent, name); - if (n == NULL) + wxXmlNode *n; + wxString nm; + + wxStringTokenizer tkn(name, _T("/")); + n = parent; + while (tkn.HasMoreTokens()) { - wxString pname = name.BeforeLast(_T('/')); - if (pname.IsEmpty()) pname = name; - wxXmlNode *p = XmlFindNode(parent, pname); - if (p == NULL) p = parent; - n = new wxXmlNode(wxXML_ELEMENT_NODE, name.AfterLast(_T('/'))); - p->AddChild(n); - n->AddChild(new wxXmlNode(wxXML_TEXT_NODE, wxEmptyString)); + parent = n; + nm = tkn.GetNextToken(); + n = XmlFindNodeSimple(parent, nm); + if (n) continue; + + // n == NULL: + n = new wxXmlNode(wxXML_ELEMENT_NODE, nm); + parent->AddChild(n); } + n->AddChild(new wxXmlNode(wxXML_TEXT_NODE, wxEmptyString)); + + return n; +} + + + +void XmlWriteValue(wxXmlNode *parent, const wxString& name, const wxString& value) +{ + wxXmlNode *n = XmlFindNode(parent, name); + if (n == NULL) + n = XmlCreateNode(parent, name); n = n->GetChildren();