本文整理汇总了C++中IXMLDOMNodePtr类的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMNodePtr类的具体用法?C++ IXMLDOMNodePtr怎么用?C++ IXMLDOMNodePtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IXMLDOMNodePtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadVerificationNode
BOOL vmsMetalinkFile::ReadVerificationNode(IXMLDOMNode *pNode, vmsMetalinkFile_File *file)
{
IXMLDOMNodeListPtr spNodeList;
pNode->get_childNodes (&spNodeList);
if (spNodeList == NULL)
return FALSE;
IXMLDOMNodePtr spItem;
while (SUCCEEDED (spNodeList->nextNode (&spItem)) && spItem != NULL)
{
CComBSTR bstrName;
spItem->get_nodeName (&bstrName);
if (bstrName == L"hash")
{
vmsMetalinkFile_File_Hash hash;
if (ReadHashNode (spItem, &hash))
file->vHashes.add (hash);
}
spItem = NULL;
}
return TRUE;
}
示例2: ReadResourcesNode
BOOL vmsMetalinkFile::ReadResourcesNode(IXMLDOMNode *pNode, vmsMetalinkFile_File *file)
{
IXMLDOMNodeListPtr spNodeList;
pNode->get_childNodes (&spNodeList);
if (spNodeList == NULL)
return FALSE;
IXMLDOMNodePtr spItem;
while (SUCCEEDED (spNodeList->nextNode (&spItem)) && spItem != NULL)
{
CComBSTR bstrName;
spItem->get_nodeName (&bstrName);
if (bstrName == L"url")
{
vmsMetalinkFile_File_Url url;
if (ReadUrlNode (spItem, &url))
file->vMirrors.add (url);
}
spItem = NULL;
}
return TRUE;
}
示例3: return
bool
ZXmlParser::_add_before( IXMLDOMNodePtr newNode )
{
if ( IsRoot( ) )
{
m_LastError = "ZXmlParser::_add_before( ) : Can't add node at same level that the root node";
return( false );
}
// Create Reference Node for the Insertion
IXMLDOMNodePtr pParent;
m_CurrentNode->get_parentNode( &pParent );
_variant_t NodeRef = (IUnknown *) m_CurrentNode;
// Attach the Node to the document
if ( m_CurrentNode )
newNode = pParent->insertBefore( newNode, NodeRef );
else
if ( m_pDocRoot )
newNode = m_pDocRoot->insertBefore( newNode, NodeRef );
else
{
m_pDocRoot = newNode;
m_plDomDocument->documentElement = m_pDocRoot;
}
// Update Current Node (cast operation)
m_CurrentNode = newNode;
// Update information for this Node
GrabNodeInformation( m_CurrentNode );
return( true );
}
示例4: ReadUrlNode
BOOL vmsMetalinkFile::ReadUrlNode(IXMLDOMNode *pNode, vmsMetalinkFile_File_Url *url)
{
USES_CONVERSION;
IXMLDOMNamedNodeMapPtr spAttrs;
pNode->get_attributes (&spAttrs);
if (spAttrs == NULL)
return FALSE;
IXMLDOMNodePtr spType;
spAttrs->getNamedItem (L"type", &spType);
if (spType == NULL)
return FALSE;
COleVariant vt;
spType->get_nodeValue (&vt);
ASSERT (vt.vt == VT_BSTR);
if (vt.vt == VT_BSTR)
url->strProtocol = W2A (vt.bstrVal);
CComBSTR bstrText;
pNode->get_text (&bstrText);
if (bstrText.Length () == 0)
return FALSE;
url->strUrl = W2A (bstrText);
return TRUE;
}
示例5: ReadHashNode
BOOL vmsMetalinkFile::ReadHashNode(IXMLDOMNode *pNode, vmsMetalinkFile_File_Hash *hash)
{
USES_CONVERSION;
IXMLDOMNamedNodeMapPtr spAttrs;
pNode->get_attributes (&spAttrs);
if (spAttrs == NULL)
return FALSE;
IXMLDOMNodePtr spType;
spAttrs->getNamedItem (L"type", &spType);
if (spType == NULL)
return FALSE;
COleVariant vt;
spType->get_nodeValue (&vt);
ASSERT (vt.vt == VT_BSTR);
if (vt.vt == VT_BSTR)
hash->strAlgorithm = W2A (vt.bstrVal);
CComBSTR bstrText;
pNode->get_text (&bstrText);
if (bstrText.Length () == 0)
return FALSE;
hash->strChecksum = W2A (bstrText);
return TRUE;
}
示例6: ReadFilesNode
BOOL vmsMetalinkFile::ReadFilesNode(IXMLDOMNode *pFiles)
{
IXMLDOMNodeListPtr spNodeList;
pFiles->get_childNodes (&spNodeList);
if (spNodeList == NULL)
return FALSE;
IXMLDOMNodePtr spItem;
BOOL bHasOkFileNode = FALSE;
while (SUCCEEDED (spNodeList->nextNode (&spItem)) && spItem != NULL)
{
CComBSTR bstrName;
spItem->get_nodeName (&bstrName);
if (bstrName == L"file")
{
if (ReadFileNode (spItem))
bHasOkFileNode = TRUE;
}
spItem = NULL;
}
return bHasOkFileNode;
}
示例7: _tcsicmp
VARIANT XMLDoc::getVariant(const XMLNodePtr &node, const TCHAR *tagName, int instans) {
VARIANT result;
result.vt = NULL;
if(node!=NULL) {
int i=0;
for(XMLNodePtr p = node->firstChild; p != NULL; p = p->nextSibling) {
if(p->nodeType==NODE_ELEMENT &&
_tcsicmp(((XMLElementPtr)p)->tagName,tagName) == 0 &&
i++ == instans) {
IXMLDOMNodeListPtr childList = p->childNodes;
LONG length;
childList->get_length(&length);
for(int j = 0; j < length; j++) {
IXMLDOMNodePtr item;
childList->get_item(j, &item);
DOMNodeType itemType;
item->get_nodeType(&itemType);
if(itemType == NODE_TEXT) {
item->get_nodeValue(&result);
return result;
}
}
return result;
}
}
}
return result;
}
示例8: LoadPropertyFromXml
BOOL CSkinClass::LoadPropertyFromXml(IXMLDOMNodePtr ptrNode)
{
IXMLDOMNodePtr pNode = NULL;
IXMLDOMNamedNodeMapPtr pNamedNodeMap = NULL;
DOMNodeType nodeType = NODE_INVALID;
long len = 0;
BOOL allSuc = TRUE;
ptrNode->get_attributes(&pNamedNodeMap);
pNamedNodeMap->get_length(&len);
for (int i=0; i<len; i++){
pNamedNodeMap->get_item(i, &pNode);
pNode->get_nodeType(&nodeType);
if (nodeType != NODE_ATTRIBUTE)
continue;
CComBSTR bstrName;
CComVariant varValue;
pNode->get_nodeName(&bstrName);
pNode->get_nodeValue(&varValue);
if (varValue.vt != VT_BSTR)
continue;
CString strName = bstrName;
CString strValue = varValue.bstrVal;
if (strName.CompareNoCase(_T("name")) != 0) {
SetProp(strName, strValue);
} else {
ASSERT(m_strClassName.IsEmpty());
SetClassName(strValue);
}
}
return allSuc;
}
示例9: GetAttributeValue
_bstr_t GetAttributeValue(IXMLDOMNodePtr node, const _bstr_t& name)
{
IXMLDOMNodePtr attr = GetAttributeNode(node, name);
if (attr == NULL)
return _bstr_t();
return attr->GetnodeValue();
}
示例10: Parse
BOOL vmsMetalinkFile::Parse(LPCSTR pszFile)
{
USES_CONVERSION;
IXMLDOMDocumentPtr spXML;
IXMLDOMNodePtr spNode;
spXML.CreateInstance (__uuidof (DOMDocument));
if (spXML == NULL)
return FALSE;
spXML->put_async (FALSE);
VARIANT_BOOL bRes;
spXML->load (COleVariant (pszFile), &bRes);
if (bRes == FALSE)
return FALSE;
spXML->selectSingleNode (L"metalink", &spNode);
if (spNode == NULL)
return FALSE;
IXMLDOMNodeListPtr spNodeList;
spNode->get_childNodes (&spNodeList);
if (spNodeList == NULL)
return FALSE;
IXMLDOMNodePtr spItem;
BOOL bHasOkFilesNode = FALSE;
while (SUCCEEDED (spNodeList->nextNode (&spItem)) && spItem != NULL)
{
CComBSTR bstrName;
spItem->get_nodeName (&bstrName);
if (bstrName == L"description")
{
CComBSTR bstrText;
spItem->get_text (&bstrText);
m_strDescription = W2A (bstrText);
}
else if (bstrName == L"files")
{
if (ReadFilesNode (spItem))
bHasOkFilesNode = TRUE;
}
spItem = NULL;
}
return bHasOkFilesNode;
}
示例11: GetPathValue
_bstr_t GetPathValue(IXMLDOMNodePtr node, const _bstr_t& path)
{
if (node == NULL)
return _bstr_t();
IXMLDOMNodePtr n = node->selectSingleNode(path);
if (n == NULL)
return _bstr_t();
return n->Gettext();
}
示例12: GrabNodeInformation
bool
ZXmlParser::_add_after( IXMLDOMNodePtr newNode )
{
// If m_CurrentNode->NextSibling == NULL then must call AddLastChildNode on Parent Node
// Because we can't use InsertBefore on a NULL Reference ;o )
//
// We are sure that a Parent node exist because before we control that we aren't not on root node.
if ( m_CurrentNode->nextSibling == NULL )
{
// Get Parent Node
IXMLDOMNodePtr pParent;
m_CurrentNode->get_parentNode( &pParent );
// Set Parent node as Current Node
m_CurrentNode = pParent;
GrabNodeInformation( pParent );
// Add Node as Last Child Node
return( AddLastChildNode( m_Name ) );
}
// Create Reference Node for the Insertion
IXMLDOMNodePtr pParent;
m_CurrentNode->get_parentNode( &pParent );
_variant_t NodeRef = (IUnknown *) m_CurrentNode->nextSibling;
// Attach the Node to the document
if ( m_CurrentNode )
newNode = pParent->insertBefore( newNode, NodeRef );
else
if ( m_pDocRoot )
newNode = m_pDocRoot->insertBefore( newNode, NodeRef );
else
{
m_pDocRoot = newNode;
m_plDomDocument->documentElement = m_pDocRoot;
}
// Update Current Node (cast operation)
m_CurrentNode = newNode;
// Update information for this Node
GrabNodeInformation( m_CurrentNode );
return( true );
}
示例13: InsetXMLNode
void CXMLTree::InsetXMLNode(MSXML2::IXMLDOMNodePtr iNode, HTREEITEM hParentItem)
{
IXMLDOMNodeListPtr iChildren = iNode->childNodes;
IXMLDOMNodePtr iChild = NULL;
while ((iChild = iChildren->nextNode()) != NULL)
{
CString s((BSTR) iChild->nodeName);
HTREEITEM i = InsertItem(s, hParentItem);
iChild.AddRef();
SetItemData(i, (DWORD) (IXMLDOMNode *) iChild);
//rekurze
InsetXMLNode(iChild, i);
}
}
示例14: GetAttributeNode
IXMLDOMNodePtr GetAttributeNode(IXMLDOMNodePtr node, const _bstr_t& name)
{
if (node == NULL)
return NULL;
IXMLDOMNamedNodeMapPtr attributes = node->Getattributes();
if (attributes == NULL)
return NULL;
IXMLDOMNodePtr att = attributes->getNamedItem(name);
return att;
}
示例15: SetNamedNodeText
/**************************************************************************
* written by moonknit
*
* @history
* created 2005-10-31
*
* @Description
* XML의 attribute나 element text를 변경 또는 추가한다.
* update or insert item text
*
* @Parameters
* (in _bstr_t) sname - search name
* (in/out CEzXMLParser*) parser - 검색할 xml 클래스
* (in _bstr_t) text - 변경할 내용
* (in int) type - 변경할 대상의 속성
* 0 : attribute
* 1 : element text
* (in IXMLDOMNodePtr) node - 검색 root node
*
* @Returns
* (BOOL)
* 0 : failed
* 1 : updated
* 2 : inserted
**************************************************************************/
int SetNamedNodeText(_bstr_t sname, CEzXMLParser* parser, _bstr_t text, int type, IXMLDOMNodePtr node)
{
if(!parser) return 0;
if(type == 0)
{
IXMLDOMNodePtr nodeptr = NULL;
nodeptr = node->attributes->getNamedItem(sname);
if(nodeptr == NULL)
{
IXMLDOMAttributePtr attptr = parser->CreateAttribute(sname, text);
if(attptr == NULL) return 0;
// create attribute
node->attributes->setNamedItem(attptr);
return 2;
}
else
{
// update attribute
nodeptr->text = text;
}
}
else
{
IXMLDOMNodeListPtr listptr;
listptr = parser->SearchNodes(node, sname);
if(listptr == NULL || listptr->length == 0)
{
// create element
IXMLDOMElementPtr elptr = parser->CreateElement(sname);
if(elptr == NULL)
return 0;
elptr->text = text;
if(node->appendChild(elptr) == NULL)
return 0;
return 2;
}
else
{
// update element text
listptr->item[0]->text = text;
}
}
return 1;
}