本文整理汇总了C++中IXMLDOMNode::get_nextSibling方法的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMNode::get_nextSibling方法的具体用法?C++ IXMLDOMNode::get_nextSibling怎么用?C++ IXMLDOMNode::get_nextSibling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IXMLDOMNode
的用法示例。
在下文中一共展示了IXMLDOMNode::get_nextSibling方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NextSibling
/*
Function name : CXML::NextSibling
Description : This will move to the current node to the sibling of the current node.
: if no more sibling is available retruns false.
Return type : bool
Tested : Ok
*/
bool CXML::NextSibling()
{
if(!m_pICurrentNode)
return false;
IXMLDOMNode * pITempNode = m_pICurrentNode;
IXMLDOMNode * pNode = NULL;
pITempNode->AddRef();
m_hr = pITempNode->get_nextSibling(&pNode);
pITempNode->Release();
if (!SUCCEEDED(m_hr)|| !pNode)
return false;
if(m_pICurrentNode)
{
m_pICurrentNode->Release();
m_pICurrentNode = NULL;
}
m_pICurrentNode = pNode;
m_pICurrentNode->AddRef();
pNode->Release();
return true;
}
示例2: xmlGetAttributeValueBOOL
BOOL TxSkin::elVBOX::loadXML( IXMLDOMNode* node, LPCWSTR baseurl )
{
BOOL ret = skin_element::loadXML(node, baseurl);
m_adapt = xmlGetAttributeValueBOOL(node, TEXT("adapt"), TRUE);
IXMLDOMNode* child = NULL;
node->get_firstChild(&child);
while(child)
{
BSTR name = NULL;
child->get_nodeName(&name);
if(name)
{
skin_element* el = m_skin->createElement(name, m_skin);
if(el)
{
if(el->loadXML(child, baseurl))
{
addElement(el);
} else
{
delete el;
}
}
SysFreeString(name);
}
IXMLDOMNode* newChild = NULL;
child->get_nextSibling(&newChild);
child->Release();
child = newChild;
}
return ret;
}
示例3: insertFileItem
int DicomImageSet::insertFileItem(IXMLDOMDocument *pDom, IXMLDOMNode * pRoot, const QString &folderName, const QString &fileName)
{
DicomImage * dicomImage = new DicomImage ();
if (!dicomImage->readHeader((QDir(folderName).absoluteFilePath(fileName)).toStdString().c_str()))
{
//fail to resolve header information
return 0;
}
int nElement;
char * patientsName = dicomImage->getCharTag(DicomImage::TAG_PATIENTS_NAME, nElement);
char * patientsId = dicomImage->getCharTag(DicomImage::TAG_PATIENT_ID, nElement);
char * protocolName = dicomImage->getCharTag(DicomImage::TAG_PROTOCOL_NAME, nElement);
double * pInstanceNumber = dicomImage->getNumericTag(DicomImage::TAG_INSTANCE_NUMBER, nElement);
double * pAcquisitionNumber = dicomImage->getNumericTag(DicomImage::TAG_ACQUISITION_NUMBER, nElement);
double * pAcquisitionDate = dicomImage->getNumericTag(DicomImage::TAG_ACQUISITION_DATE, nElement);
int instanceNumber = pInstanceNumber?(int)pInstanceNumber[0]:-1;
int acquisitionNumber = pAcquisitionNumber?(int)pAcquisitionNumber[0]:-1;
int acquisitionDate = pAcquisitionDate?(int)pAcquisitionDate[0]:0;
IXMLDOMNode * pParent = findParentNode(pDom, pRoot, patientsName, patientsId, acquisitionDate, protocolName, acquisitionNumber);
if (!pParent)
{
return 0;
}
HRESULT hr = S_OK;
IXMLDOMElement *pNode = NULL;
CHK_HR(CreateElement(pDom, L"File", &pNode));
CHK_HR(CreateAndAddAttributeNode(pDom, L"path", fileName.toStdWString().c_str(), pNode));
CHK_HR(CreateAndAddAttributeNode(pDom, L"instance_number", QString::number(instanceNumber).toStdWString().c_str(), pNode));
IXMLDOMNode * pSibling = NULL;
CHK_HR(pParent->get_firstChild(&pSibling));
int sibInstanceNumber = -1;
VARIANT varInstanceNumber;
DOMNodeType nodeType;
while (pSibling && instanceNumber >= sibInstanceNumber)
{
CHK_HR(pSibling->get_nodeType(&nodeType));
if(nodeType == NODE_ELEMENT)
{
CHK_HR(GetAttributeFromNode(pSibling, L"instance_number", &varInstanceNumber));
sibInstanceNumber = QString::fromWCharArray(_bstr_t(varInstanceNumber)).toInt();
if (instanceNumber < sibInstanceNumber)
{
break;
}
}
IXMLDOMNode * tmpNode = NULL;
CHK_HR(pSibling->get_nextSibling(&tmpNode));
SAFE_RELEASE(pSibling);
pSibling = tmpNode;
}
if (pSibling)
{
IXMLDOMNode * tmpNode = NULL;
CHK_HR(pSibling->get_previousSibling(&tmpNode));
SAFE_RELEASE(pSibling);
pSibling = tmpNode;
}
CHK_HR(CreateAndAddTextNodeBefore(pDom, L"\n", pParent, pSibling));
CHK_HR(InsertChildToParent(pNode, pSibling, pParent));
CleanUp:
SAFE_RELEASE(pNode);
return 1;
}
示例4: SetMultiLine
bool SettingsXML::SetMultiLine(IXMLDOMNode* apNode, const wchar_t* asValue, long nAllLen)
{
bool bRc = false;
HRESULT hr;
VARIANT_BOOL bHasChild = VARIANT_FALSE;
DOMNodeType nodeType = NODE_INVALID;
BSTR bsNodeType = ::SysAllocString(L"line");
VARIANT vtType; vtType.vt = VT_I4; vtType.lVal = NODE_ELEMENT;
IXMLDOMNode* pNode = NULL;
IXMLDOMNode* pNodeRmv = NULL;
long nLen = 0;
const wchar_t* psz = asValue;
bool bNewNodeCreate = false;
int iAddIndent = 1;
bool bAddFirstNewLine = false;
hr = apNode->get_firstChild(&pNode);
if (pNode == NULL)
{
bAddFirstNewLine = true;
iAddIndent = mi_Level + 1;
}
// Обновляем существующие
while ((psz && *psz && nAllLen > 0) && (SUCCEEDED(hr) && pNode))
{
hr = pNode->get_nodeType(&nodeType);
if (SUCCEEDED(hr) && (nodeType == NODE_ELEMENT))
{
if (!SetAttr(pNode, L"data", psz))
goto wrap;
nLen = _tcslen(psz)+1;
psz += nLen;
nAllLen -= nLen;
}
hr = pNode->get_nextSibling(&pNode);
}
// Добавляем что осталось
while (psz && *psz && nAllLen > 0)
{
hr = mp_File->createNode(vtType, bsNodeType, L"", &pNode);
if (FAILED(hr) || !pNode)
goto wrap;
if (!SetAttr(pNode, L"data", psz))
goto wrap;
if (bAddFirstNewLine)
{
AppendNewLine(apNode);
bAddFirstNewLine = false;
}
AppendIndent(apNode, iAddIndent);
hr = apNode->appendChild(pNode, &pNodeRmv);
AppendNewLine(apNode);
bNewNodeCreate = true;
iAddIndent = mi_Level + 1;
SafeRelease(pNode);
SafeRelease(pNodeRmv);
if (FAILED(hr))
goto wrap;
nLen = _tcslen(psz)+1;
psz += nLen;
nAllLen -= nLen;
}
// Очистить хвост (если элементов стало меньше)
if (pNode)
{
ClearChildrenTail(apNode, pNode);
AppendNewLine(apNode);
bNewNodeCreate = true;
}
if (bNewNodeCreate)
{
AppendIndent(apNode, mi_Level);
}
bRc = true;
wrap:
_ASSERTE(nAllLen <= 1);
::SysFreeString(bsNodeType);
return bRc;
}
示例5: if
static HRESULT
ParseToolsList(IXMLDOMDocument* pXMLDom, BOOL bIsStandard)
{
static const _bstr_t XMLFileTag(L"MSCONFIGTOOLFILE");
static const _bstr_t XMLToolsTag(L"MSCONFIGTOOLS");
HRESULT hr = S_OK;
IXMLDOMNode *pIterator = NULL, *pTmp = NULL;
IXMLDOMElement* pEl = NULL;
DOMNodeType type;
_bstr_t tagName;
if (!pXMLDom)
return E_POINTER; // E_INVALIDARG
pXMLDom->get_documentElement(&pEl);
pEl->get_tagName(&tagName.GetBSTR());
_wcsupr(tagName);
if (tagName == XMLFileTag)
{
pEl->get_firstChild(&pIterator); SAFE_RELEASE(pEl);
while (pIterator)
{
pIterator->get_nodeType(&type);
if (type == NODE_ELEMENT)
{
pIterator->QueryInterface(IID_PPV_ARG(IXMLDOMElement, &pEl) /* IID_PPV_ARGS(&pEl) */);
pEl->get_tagName(&tagName.GetBSTR());
_wcsupr(tagName);
if (tagName == XMLToolsTag)
{
pEl->get_firstChild(&pIterator); SAFE_RELEASE(pEl);
while (pIterator)
{
pIterator->QueryInterface(IID_PPV_ARG(IXMLDOMElement, &pEl) /* IID_PPV_ARGS(&pEl) */);
AddTool(pEl, bIsStandard);
SAFE_RELEASE(pEl);
pIterator->get_nextSibling(&pTmp);
SAFE_RELEASE(pIterator); pIterator = pTmp;
}
// SAFE_RELEASE(pIterator);
break;
}
SAFE_RELEASE(pEl);
}
pIterator->get_nextSibling(&pTmp);
SAFE_RELEASE(pIterator); pIterator = pTmp;
}
// SAFE_RELEASE(pIterator);
}
else if (tagName == XMLToolsTag)
{
pEl->get_firstChild(&pIterator); SAFE_RELEASE(pEl);
while (pIterator)
{
pIterator->QueryInterface(IID_PPV_ARG(IXMLDOMElement, &pEl) /* IID_PPV_ARGS(&pEl) */);
AddTool(pEl, bIsStandard);
SAFE_RELEASE(pEl);
pIterator->get_nextSibling(&pTmp);
SAFE_RELEASE(pIterator); pIterator = pTmp;
}
// SAFE_RELEASE(pIterator);
}
SAFE_RELEASE(pEl);
return hr;
}