Ildar ha scritto:
> hi all,
>
> I'm new here and might miss the page that describes what I need. Please, send
> me the link to the page this case.
>
>
> I'm playing with the following XML.
>
>
>
>
> hello
>
>
>
> I need to get the content of /root/level1/level2-1.
> My code is as
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 == ""
shouldn't it return "hello"?
#
and one more ;)
is there a way to get a count of nodes?
e.g.
- Find(...) allows to get the N-th node which meets the condition, but what's
the number of nodes which meet the condition?
- or how to get the number of wxXML_ELEMENT_NODE subnodes of wxXML_ELEMENT_NODE
node?
I understand I can
>> the results are:
>>
>> s == "level2-1" // the same as expected
>> s1 == "" // I expected to get "hello"
>> s2 == "hello" // ?
> yes, sure. no bugs.
> This is really a FAQ and I should add it somewhere.
>
> The results you get are because your XML tree is parsed as:
nonetheless, this is not reall
Ildar ha scritto:
> and one more ;)
>
> is there a way to get a count of nodes?
currently no; that's because wxXml2 API derives from wxXml API because
when I wrote it I wanted to port some wxXml code to a newer API with DTD
validation and thus I made wxXml2 API mostly compatible with wxXml one,
Armel Asselin ha scritto:
>>> the results are:
>>>
>>> s == "level2-1" // the same as expected
>>> s1 == "" // I expected to get "hello"
>>> s2 == "hello" // ?
>> yes, sure. no bugs.
>> This is really a FAQ and I should add it somewhere.
>>
>> The results you get are because your XML tree is parsed
>> nonetheless, this is not really XSL-like (which Ildar expected). It could
>> be
>> cool to have a GetAllText ( ) all the simple text of all sub nodes
>> concatenated.
> I just added to CVS the GetNodeContent() functions which does exactly
> that.
cool :)
Armel
-
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"));
>