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, 
which has no GetChildCount() methods.

However I agree this would be useful to have. Patches welcome :D

> 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?
we could add a new GetChildrenCount(const wxXmlNode &tofind, bool bNS = 
TRUE, bool recurse = TRUE) function to return it


> - or how to get the number of wxXML_ELEMENT_NODE subnodes of 
> wxXML_ELEMENT_NODE 
> node?
I would add a GetChildrenCount() const function for this.


> I understand I can enumerate the nodes and count them, is it the only 
> possible 
> solution?
it highly depends on how to you want to organize your parser.
For me, the pattern I copied & pasted in previous mail has always been a 
winning pattern ;)

I.e. you scan all the XML document, handle unknown tags in the else{} 
part, and call subroutines to load other nodes in other elseif{} branches.

It's a lot of time I don't look at XML Schemas, SAX parser, etc.
You can get an idea of the "low-level" libxml2 API looking at 
http://xmlsoft.org/html/index.html

Francesco



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
wxCode-users mailing list
wxCode-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxcode-users

Reply via email to