On Sat, Jul 18, 2009 at 6:31 PM, Ujjal Saha <[email protected]>wrote:
> Hi guys, > > I want to read the content of a xml tag/node. The Node is having child > nodes > But I want to read the content of that node only. > > Following two approaches I tried, But I am unable to get the content of a > particular node: > > 1. When I am calling the API xmlNodeGetContent, the API is returning > the string of the current node with all its child node. So I am not > able to use the API. > > 2. When I am trying the access *NodePtr->content* [ content field of the > node pointer] > I am getting null. > > Is there any other way to get the content of a particular node only. > If you have other particular needs you will need to do it your self. All that you need to do is loop through the children of the node that you want process and to check what kind of element each children is and decide if you want to keep their text value or not. Concatenate the text values of the node types that you think that are worth it and ignore the others. You probably want to keep all XML_TEXT_NODE and XML_CDATA_SECTION_NODE until you find the first XML_ELEMENT_NODE. -- Emmanuel Rodriguez
_______________________________________________ xml mailing list, project page http://xmlsoft.org/ [email protected] http://mail.gnome.org/mailman/listinfo/xml
