From: Francesco M. <f18...@ya...> - 2006-09-28 16:03:04
|
Ildar ha scritto: > Francesco, > > Thank you, I got the idea. > > However, 2 more questions: > > #1 > > wxString s3 = node.Find(wxT("level2-1")).GetFirstChild().GetName(); > > result: > s3 == "text" // as you mentioned > > but > > wxString s4 = node.Find(wxT("level2-1")).Get(wxT("text")); > > result: > s4 == "" wxXml2Node::Get returns a wxXml2Node, not a wxString. I don't know why the compiler accepts the assignment of a wxXml2Node to a wxString... couldn't you trace it with a debugger and see what happens? > #2 > > is the following possible? > > |- wxXML_ELEMENT_NODE with name "level2-1" and content="" > |- wxXML_TEXT_NODE with name "" and content="hello" > |- wxXML_TEXT_NODE with name "" and content="bye" > > wxXML_ELEMENT_NODE - contains 2 text nodes. sure; it's possible. IIRC there are some rules which makes libxml2 split a text into two text nodes but I don't remember them right now. However consider also the case of this XML fragment: <node> hello <b>XML</b> world! </node> the "node" node has two text nodes interleaved by an element node (with name="b" and with a single text node as child). Francesco |