Nima , Remember also to free the returned string using xmlFree() as it is
allocated on heap via xmlNodeListGetString() xmlChar* pszNodeContent =
NULL; pszNodeContent =
xmlNodeListGetString(m_ptrXMLDoc,ptrCurrXMLNode->children,1); if (pszNodeContent) { printf(“Value
of <pic_file>
= %s”, (const char*)pszNodeContent); xmlFree(pszNodeContent); pszNodeContent
= NULL; } -- Lav From: Lav Mehrotra Nima , Plz use the following API() xmlNodeListGetString(xmlDocPtr doc , xmlNodePtr list , int
inline ) Get the (xmlDocPtr doc) from xmlParseFile(const char*
filename) API or xmlParseMemory(const char* buffer , int size) Get the Current (xmlNodePtr list) for ur node
<pic_file> by traversing the DOM Document Tree , until u encounter
a node with xmlNodePtr->name as same as pic_file ( Take the help
of xmlStrcmp() API ) . Say this node is xmlNodePtr pXmlNodePicFile Once u have this pXmlNodePicFile u cannot blindly use
pXmlNodePicFile->content as the TEXT Content MyPicFileName.pdf is also a
child node of the pXmlNodePicFile So pass the 1st child of pXmlNodePicFile to xmlNodeListGetString()
API like this xmlNodeListGetString(doc, pXmlNodePicFile->children ,
1) Regds, Lav From:
xml-bounces gnome org [mailto:xml-bounces gnome org] On Behalf Of Nima Tiran Hi all, I'm newbie here and got a simple question: I'm parsing an XML file and having a node like: <pic_file>MyPicFileName.pdf</pic_file> in XML file, just wondering how can I retrieve
"MyPicFileName" from this node? Thnx Nima DISCLAIMER: |