本文整理汇总了C++中msxml2::IXMLDOMNodePtr::get_text方法的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMNodePtr::get_text方法的具体用法?C++ IXMLDOMNodePtr::get_text怎么用?C++ IXMLDOMNodePtr::get_text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msxml2::IXMLDOMNodePtr
的用法示例。
在下文中一共展示了IXMLDOMNodePtr::get_text方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAttrsOfNode
int CXmlBase::GetAttrsOfNode(map<CString, CComBSTR>& mapAttrs, MSXML2::IXMLDOMNodePtr pNode)
{
MSXML2::IXMLDOMNamedNodeMapPtr pAttrs;
MSXML2::IXMLDOMNodePtr pAttr;
HRESULT hr;
CComBSTR bstrText;
CString str;
long lAttrCount = 0;
mapAttrs.clear();
if (NULL == pNode)
{
//WRITELOG("END, pNode为空");
return 0;
}
pAttrs = pNode->Getattributes();
if (pAttrs == NULL)
{
//WRITELOG("END, 取得节点属性集合失败");
return 0;
}
lAttrCount = pAttrs->Getlength();
for (int i=0; i<lAttrCount; i++)
{
pAttr = pAttrs->Getitem(i);
if (pAttr == NULL)
{
//WRITELOG("取得第[%d]个属性为空", i);
continue;
}
hr = pAttr->get_nodeName(&bstrText);
if (FAILED(hr))
{
//WRITELOG("取得第[%d]个属性名为空", i);
continue;
}
if (!ConvertBSTR2CString(str, bstrText.m_str))
{
//WRITELOG("转换第[%d]个属性名 失败", i);
continue;
}
hr = pAttr->get_text(&bstrText);
if (FAILED(hr))
{
//WRITELOG("取得第[%d]个属性值 失败,属性[%s]", i, str);
continue;
}
mapAttrs.insert(make_pair(str, bstrText));
}
return (int)mapAttrs.size();
}
示例2: GetStringValue
////////////////////////////////////////////////////////////////////////////
// Helper function:
////////////////////////////////////////////////////////////////////////////
CString CXMLDocument::GetStringValue(LPCSTR szAttrib, MSXML2::IXMLDOMNode* pNode)
{
CComBSTR bstrValue;
MSXML2::IXMLDOMNamedNodeMapPtr pAttributes;
MSXML2::IXMLDOMNodePtr pItemNode;
if (SUCCEEDED(pNode->get_attributes(&pAttributes)) && (pAttributes != NULL))
pAttributes->getNamedItem(CComBSTR(szAttrib), &pItemNode);
if (pItemNode)
pItemNode->get_text(&bstrValue);
return CString(bstrValue);
}
示例3: getAttributeValue
bool XMLElement::getAttributeValue(const char *attributeName,
std::string& attributeValue) const {
bool found = false;
MSXML2::IXMLDOMNamedNodeMapPtr attrs;
MSXML2::IXMLDOMNodePtr attr;
BSTR bstr;
if (nodePtr) {
if ((nodePtr->get_attributes(&attrs)) == S_OK) {
if ((attrs->raw_getNamedItem(_bstr_t(attributeName), &attr)) == S_OK) {
if ((attr->get_text(&bstr)) == S_OK) {
attributeValue = bstrToString(bstr).c_str();
found = true;
}
}
}
}
return found;
}
示例4: GetAttributeByIndex
// 获取当前结点的指定序号的属性的名称
int CBpXMLNode::GetAttributeByIndex(int nIndex, CString &strAttributeValue) const
{
if (m_pDOMNode == NULL || nIndex <= 0)
return XML_ERROR;
MSXML2::IXMLDOMNamedNodeMap *pAttributeMap = NULL;
m_pDOMNode->get_attributes(&pAttributeMap);
if (pAttributeMap == NULL)
return XML_ERROR;
MSXML2::IXMLDOMNodePtr pAttNode = pAttributeMap->item[nIndex];
if (pAttNode == NULL)
return XML_ERROR;
BSTR bstrText = NULL;
pAttNode->get_text(&bstrText);
strAttributeValue = bstrText;
::SysFreeString(bstrText);
return XML_OK;
}
示例5: GetAttributeByName
// 获取当前结点的指定属性的值
int CBpXMLNode::GetAttributeByName(const wchar_t *szAttributeName, CString &strAttributeValue) const
{
if (m_pDOMNode == NULL)
return XML_ERROR;
MSXML2::IXMLDOMNamedNodeMap *pAttributeMap = NULL;
m_pDOMNode->get_attributes(&pAttributeMap);
if (pAttributeMap == NULL)
return XML_ERROR;
MSXML2::IXMLDOMNodePtr pAttNode = pAttributeMap->getNamedItem(szAttributeName);
if (pAttNode == NULL)
return XML_ERROR;
BSTR bstrText = NULL;
pAttNode->get_text(&bstrText);
strAttributeValue = bstrText;
::SysFreeString(bstrText);
return XML_OK;
}
示例6: ParseSOAPRequest
int CSOAPUtil::ParseSOAPRequest(char* xml, int xmlSize, SOAP_REQUEST_INFO* info)
{
int res = NO_ERR;
MSXML2::IXMLDOMDocumentPtr xmlDoc;
HRESULT hr = xmlDoc.CreateInstance(MSXML2::CLSID_DOMDocument);
if(FAILED(hr)) {
return ERR_FALSE;
}
xmlDoc->put_async(VARIANT_FALSE);
xmlDoc->put_preserveWhiteSpace(VARIANT_TRUE);
if( LoadDOMDocument(xml, xmlSize, xmlDoc) != NO_ERR ) {
xmlDoc.Release();
xmlDoc = NULL;
return ERR_FALSE;
}
//���
MSXML2::IXMLDOMElementPtr pElemRoot;
MSXML2::IXMLDOMNodePtr mediaNode = NULL;
xmlDoc->get_documentElement(&pElemRoot);
if( pElemRoot == NULL ) {
res = ERR_FALSE;
goto Err_End;
}
for( int i=0; i<pElemRoot->childNodes->length; i++ ) {
MSXML2::IXMLDOMNodePtr bodyNode = pElemRoot->childNodes->Getitem(i);
CComBSTR localName;
bodyNode->get_baseName(&localName);
if( localName == NULL ) {
continue;
}
if(CompareNoCase(L"Body", localName.m_str) == 0 ) {
for( int j=0; j<bodyNode->childNodes->length; j++ ) {
MSXML2::IXMLDOMNodePtr actionNode = bodyNode->childNodes->Getitem(j);
CComBSTR actionName;
actionNode->get_baseName(&actionName);
if( actionName == NULL ) {
continue;
}
info->actionName = actionName;
for( int k=0; k<actionNode->childNodes->length; k++) {
MSXML2::IXMLDOMNodePtr argNode = actionNode->childNodes->Getitem(k);
CComBSTR argName;
argNode->get_baseName(&argName);
if( argName == NULL ) {
continue;
}
CComBSTR argVal;
argNode->get_text(&argVal);
info->argList.insert(pair<wstring,wstring>(argName.m_str, argVal.m_str));
}
}
break;
}
}
Err_End:
xmlDoc.Release();
xmlDoc = NULL;
return res;
}
示例7: put_XDataXMLConfigFile
//////////////////////////////////////////////////////////////////////////
//简要描述 : 设置扩展属性配置文件
//输入参数 :
//返 回 值 :
//
//
//修改日志 :
//////////////////////////////////////////////////////////////////////////
STDMETHODIMP CDwgWriter::put_XDataXMLConfigFile(BSTR sXMLFile)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
if (sXMLFile == NULL) return S_OK;
CString sXml = sXMLFile;
if (sXml.IsEmpty()) return S_OK;
m_XDataCfgs.RemoveAll();
try
{
CXMLFile xmlfile;
xmlfile.load(sXml);
MSXML2::IXMLDOMNodePtr pNode;
MSXML2::IXMLDOMNodePtr pExtAttrNode = NULL;
xmlfile.GetNode("LAYERS", pNode);
if (pNode == NULL)
{
//AfxMessageBox("XML配置文件不正确,请检查。");
m_dwgWriter.WriteLog("XML配置文件不正确,请检查。");
return S_FALSE;
}
pNode = pNode->GetfirstChild();
if (pNode == NULL)
{
//AfxMessageBox("XML配置文件不正确,请检查。");
m_dwgWriter.WriteLog("XML配置文件不正确,请检查。");
return S_FALSE;
}
CComBSTR bsNodeName;
CComBSTR bsExtAttrs;
CString sLayerName;
CString sRegAppName;
CString sExtAttrs;
while (pNode != NULL)
{
//得到图层名
pNode->get_nodeName(&bsNodeName);
sLayerName = bsNodeName;
//去掉前面的_前缀,解决数字开头的节点问题
CString sSign = "";
sSign = sLayerName.Mid(0, 1);
if (sSign.CompareNoCase("_") == 0)
{
sLayerName = sLayerName.Mid(1);
}
XDataAttrLists* pExtAttrs = new XDataAttrLists();
//得到图层下的注册应用名
if (pNode->hasChildNodes())
{
pExtAttrNode = pNode->GetfirstChild();
while (pExtAttrNode != NULL)
{
pExtAttrNode->get_nodeName(&bsNodeName);
sRegAppName = bsNodeName;
//去掉前面的_前缀,解决数字开头的节点问题
sSign = sRegAppName.Mid(0, 1);
if (sSign.CompareNoCase("_") == 0)
{
sRegAppName = sRegAppName.Mid(1);
}
pExtAttrNode->get_text(&bsExtAttrs);
sExtAttrs = bsExtAttrs;
CStringList* pAttrLst = new CStringList();
//解析注册应用名下的属性字段名称
CString sAttr;
int iPos = sExtAttrs.Find(',');
while (iPos > 0)
{
sAttr = sExtAttrs.Mid(0, iPos);
sExtAttrs = sExtAttrs.Mid(iPos + 1);
if (!sAttr.IsEmpty())
{
pAttrLst->AddTail(sAttr);
}
iPos = sExtAttrs.Find(',');
}
if (iPos == -1)
{
if (!sExtAttrs.IsEmpty())
{
pAttrLst->AddTail(sExtAttrs);
}
}
pExtAttrs->SetAt(sRegAppName, pAttrLst);
//得到下一个注册应用名的配置
//.........这里部分代码省略.........