Hi.
I created an xml file by hand which has a root node and several child nodes like this
Code:
<AnyRootNode anyAttribute="anyValue">
<AnyChildNode anyChildAttribute="anotherValue"/>
<AnyChildNode anyChildAttribute="anotherValue"/>
</AnyRootNode>
I use the following way trying to get the list of child nodes:
Code:
MSXML::IXMLDOMDocumentPtr docPtr;
hResult =
docPtr.CreateInstance (MSXML::CLSID_DOMDocument);
if (FAILED (hResult)){
return FALSE;
}
variant_t vResult =
docPtr->load(XML_FILEPATH);
if (((bool) vResult) == FALSE){
return FALSE;
}
MSXML::IXMLDOMNodePtr pNode =
docPtr->selectSingleNode("AnyRootNode");
if (pNode==NULL){
return FALSE;
}
MSXML::IXMLDOMNodeList* resultList =
pNode->GetchildNodes();
// **** HERE I ALWAYS GET A VALUE OF ZERO ****
// WHY ???
long listLength = resultList->Getlength();
...but what's wrong with that ?
I expected to get a node list length of 2 for the example above.