You must release XMLString::transcode result with XMLString::release. p_Node->getChildNodes() return DOMNodeList with all nodes, not only element nodes. No need to create strFileSize with new. And Xerces can convert string to int so no need to create strFileSize at all.
I think this code is more correct (but far from ideal): DOMNodeIterator *i = doc->createNodeIterator(p_Node, DOMNodeFilter::SHOW_ELEMENT, 0, false); char *nodeValue; i->nextNode(); FileName = nodeValue = XMLString::transcode(i->nextNode()->getFirstChild()->getNodeValue()); XMLString::release(&nodeValue); FileSize = XMLString::parseInt(i->nextNode()->getFirstChild()->getNodeValue()); Category = nodeValue = XMLString::transcode(i->nextNode()->getFirstChild()->getNodeValue()); XMLString::release(&nodeValue); SubCategory = nodeValue = XMLString::transcode(i->nextNode()->getFirstChild()->getNodeValue()); XMLString::release(&nodeValue); UUHash = nodeValue = XMLString::transcode(i->nextNode()->getFirstChild()->getNodeValue()); XMLString::release(&nodeValue); Comments = nodeValue = XMLString::transcode(i->nextNode()->getFirstChild()->getNodeValue()); XMLString::release(&nodeValue); John Meyer wrote: > > Here's the XML > <?xml version="1.0" encoding="UTF-16" standalone="no" ?> > <files> > <file> > <name>If I am ever trapped in a horror film.doc</name> > <size>24576</size> > <category>cheats</category> > <subcategory>test</subcategory> > <uuhash>fdsfdsfds</uuhash> > <comments>test</comments> > </file> > > <file> > <name>CSAP data.xls</name> > <size>267776</size> > <category>cheats</category> > <subcategory>test</subcategory> > <uuhash>another test</uuhash> > <comments>test</comments></file> > <file> > <name>conversation3.txt</name> > <size>564</size> > <category>mods</category> > <subcategory>test</subcategory> > <uuhash>kjf;ldsjkf;dsjkfd;sl</uuhash> > <comments>This is a test</comments></file></files> > Here's the code: > > ARecord(); > DOMNodeList *childNodes = p_Node->getChildNodes(); > // FileName = XMLString::transcode(childNodes->item(0)->); > DOMNode *dnFileName = childNodes->item(0); > FileName = XMLString::transcode(dnFileName->getNodeValue()); > //FileName, Category, SubCategory, UUHash and Comments are all AnsiStrings > DOMNode *dnFileSize = childNodes->item(1); > AnsiString *strFileSize = new > AnsiString(XMLString::transcode(dnFileSize->getNodeValue())); > FileSize = strFileSize->ToInt(); > DOMNode *dnCategory = childNodes->item(2); > Category = XMLString::transcode(dnCategory->getNodeValue()); > DOMNode *dnSubcategory = childNodes->item(3); > SubCategory = XMLString::transcode(dnSubcategory->getNodeValue()); > DOMNode *dnHash = childNodes->item(4); > UUHash = XMLString::transcode(dnHash->getNodeValue()); > DOMNode *dnComments = childNodes->item(5); > Comments = XMLString::transcode(dnComments->getNodeValue()); > > Am I doing this right? > _________________________________________ > John Meyer > Programmer > ICQ#: 63450423 > More ways to contact me: http://wwp.icq.com/63450423 > _________________________________________ > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
