本文整理汇总了C++中msxml2::IXMLDOMNode::get_attributes方法的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMNode::get_attributes方法的具体用法?C++ IXMLDOMNode::get_attributes怎么用?C++ IXMLDOMNode::get_attributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msxml2::IXMLDOMNode
的用法示例。
在下文中一共展示了IXMLDOMNode::get_attributes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ND_nGetTableRowCount
UINT XMLPaser::ND_nGetTableRowCount( LPCTSTR strTable )
{
UINT nItemCount = 0;
MSXML2::IXMLDOMNode *pNode = NULL;
try
{
pNode = ND_pGetTableNode( strTable );
if ( pNode )
{
MSXML2::IXMLDOMNamedNodeMap* pNodeMap;
if ( SUCCEEDED( pNode->get_attributes( &pNodeMap ) ) && pNodeMap )
{
MSXML2::IXMLDOMNode *pAttributeNode = NULL;
for ( long i = 0; i < pNodeMap->Getlength(); i++ )
{
pNodeMap->get_item( i, &pAttributeNode );
if ( pAttributeNode )
{
BSTR bstrName;
_variant_t varRowName;
pAttributeNode->get_nodeName( &bstrName );
LPSTR pszName;
UnicodeToAnsi( bstrName, &pszName );
if ( strcmp( pszName, _T("ss:ExpandedRowCount") ) == 0 )
{
pAttributeNode->get_nodeValue( &varRowName );
if ( varRowName.vt == VT_BSTR )
{
LPSTR pszTableName;
UnicodeToAnsi( varRowName.bstrVal, &pszTableName );
nItemCount = atoi( pszTableName );
CoTaskMemFree( pszTableName );
}
}
CoTaskMemFree( pszName );
pAttributeNode->Release();
VariantClear( &varRowName );
::SysFreeString( bstrName );
}
}
pNodeMap->Release();
}
pNode->Release();
}
return ( nItemCount );
}
catch(...)
{
return ( 0 );
}
}
示例2: ND_pGetTableNode
// 이 함수의 리턴 값인 IXMLDOMNode 포인터는 쓰고 난 후에 Release를 해야한다.
MSXML2::IXMLDOMNode* XMLPaser::ND_pGetTableNode( LPCTSTR strTable )
{
MSXML2::IXMLDOMNode *pWorksheetNode = NULL;
MSXML2::IXMLDOMNode *pTableNode = NULL;
long lFoundWorksheet = -1;
try
{
m_pNodeList->reset();
for ( long i = 0; i < m_lTableCount; i++ )
{
m_pNodeList->get_item( i, &pWorksheetNode );
if ( pWorksheetNode )
{
MSXML2::IXMLDOMNamedNodeMap* pNodeMap;
if ( SUCCEEDED( pWorksheetNode->get_attributes( &pNodeMap ) ) && pNodeMap )
{
MSXML2::IXMLDOMNode *pAttributeNode = NULL;
pNodeMap->get_item( 0, &pAttributeNode );
if ( pAttributeNode )
{
BSTR bstrName;
_variant_t varTableName;
pAttributeNode->get_nodeName( &bstrName );
LPSTR pszName;
UnicodeToAnsi( bstrName, &pszName );
if ( strcmp( pszName, _T("ss:Name") ) == 0 )
{
pAttributeNode->get_nodeValue( &varTableName );
if ( varTableName.vt == VT_BSTR )
{
LPSTR pszTableName;
UnicodeToAnsi( varTableName.bstrVal, &pszTableName );
// Found Worksheet!
if ( stricmp( strTable, pszTableName ) == 0 )
{
lFoundWorksheet = i;
}
CoTaskMemFree( pszTableName );
}
}
CoTaskMemFree( pszName );
pAttributeNode->Release();
VariantClear( &varTableName );
::SysFreeString( bstrName );
}
pNodeMap->Release();
}
pWorksheetNode->Release();
}
}
if ( lFoundWorksheet < 0 )
throw ( 0 );
m_pNodeList->get_item( lFoundWorksheet, &pWorksheetNode );
if ( pWorksheetNode )
{
MSXML2::IXMLDOMNodeList* pNodeList;
pWorksheetNode->get_childNodes( &pNodeList );
if ( pNodeList )
{
for ( long i = 0; i < pNodeList->Getlength(); i++ )
{
pNodeList->get_item( i, &pTableNode );
if ( pTableNode )
{
BSTR bstrName;
pTableNode->get_nodeName( &bstrName );
LPSTR pszName;
UnicodeToAnsi( bstrName, &pszName );
if ( strcmp( pszName, _T("Table") ) == 0 )
{
CoTaskMemFree( pszName );
::SysFreeString( bstrName );
pNodeList->Release();
pWorksheetNode->Release();
return ( pTableNode );
}
CoTaskMemFree( pszName );
::SysFreeString( bstrName );
}
}
pNodeList->Release();
}
pWorksheetNode->Release();
}
//.........这里部分代码省略.........