这是我的解析代码:
MSXML2::IXMLDOMNodePtr pNode = m_pXmlDoc->selectSingleNode(kNameOfChild.c_str());
MSXML2::IXMLDOMNodeListPtr pIDOMNodeList = NULL;
MSXML2::IXMLDOMNodePtr pIDOMNode = NULL;
long numOfChildNodes= 0;
BSTR bstrItemText;
HRESULT hr;
MSXML2::IXMLDOMElementPtr pChildNode = m_pXmlDoc->getElementsByTagName(kNameOfChild.c_str());
hr = m_pXmlDoc->get_childNodes(&pIDOMNodeList);
hr = pIDOMNodeList->get_length(&numOfChildNodes);
还有我的 xml 文件:
<?xml version="1.0"?>
<GovTalkMessage>
<EnvelopeVersion>1.0</EnvelopeVersion>
<Header>
<MessageDetails>
<Class>MOSWTSC2</Class>
<Qualifier>acknowledgement</Qualifier>
<Function>submit</Function>
<TransactionID>20021202ABC</TransactionID>
<CorrelationID>B07B9ED3176193DDC4EC39063848A927</CorrelationID>
<ResponseEndPoint PollInterval="10">
https://secure.gateway.gov.uk/poll
</ResponseEndPoint>
<GatewayTimestamp>2001-01-31T10:20:18.345</GatewayTimestamp>
</MessageDetails>
<SenderDetails/>
</Header>
<GovTalkDetails>
<Keys/>
</GovTalkDetails>
<Body/>
</GovTalkMessage>
- kNameOfchild 是“限定符”
- pNode 始终为 NULL
- pChildNode 始终为 NULL
- 小时回报
S_OK
- numOfChildNodes 始终为 0
那么,我做错了什么?谢谢