开发者

MSXML2: How can I get value of a node?

开发者 https://www.devze.com 2023-03-04 23:12 出处:网络
I have this node MSXML2::IXMLDOMNodePtr node; node->Getxml() returns\"<level3>333<level4 atribute=\"444\"><level5>555<level6>666</level6></level5></level4&

I have this node

MSXML2::IXMLDOMNodePtr node;    

node->Getxml() returns "<level3>333<level4 atribute="444"><level5>555<level6>666</level6></level5></level4></level3>"

node->Gettext(); return开发者_如何学Pythons "333555666"

node->GetnodeValue() throws exception if node is not an attribute.

How can I get the value 333 ???


You have to walk the children of the node you have in hand - you can get a list using childNodes after checking the node has children of course, then you can use Gettext() to extract the individual element texts.

It's quite painful to code to the MSXML DOM, in my experience. Glad to see you are using the built-in smart pointers, anyway.

0

精彩评论

暂无评论...
验证码 换一张
取 消