我使用xerces C++來處理xml文件嗎?但getNodeValue()和setNodeValue()不工作,但getNodeName()正在工作。有沒有人有任何建議?C++ xml解析器函數不能正常工作
if(currentNode->getNodeType() && currentNode->getNodeType() == DOMNode::ELEMENT_NODE)
{
// Found node which is an Element. Re-cast node as element
DOMElement* currentElement= dynamic_cast< xercesc::DOMElement* >(currentNode);
if(XMLString::equals(currentElement->getTagName(), TAG_ApplicationSettings))
{
// Already tested node as type element and of name "ApplicationSettings".
// Read attributes of element "ApplicationSettings".
const XMLCh* xmlch_OptionA = currentElement->getAttribute(ATTR_OptionA);
m_OptionA = XMLString::transcode(xmlch_OptionA);
XMLCh* t,*s;
//s= XMLString::transcode("manish");
//currentNode->setElementText(s);
t=(XMLCh*)currentNode->getNodeName();
s=(XMLCh*)currentNode->getNodeValue();
COUT < getNodeValue())< < 「\ n」 個;
有沒有錯誤,它只是不工作 – user513164 2011-04-04 11:45:04
所以你解析的節點是什麼,你在期待什麼,你在得到什麼? – 2011-04-04 14:13:07