当前位置: 首页>>代码示例>>C++>>正文


C++ Node::nodeType方法代码示例

本文整理汇总了C++中poco::xml::Node::nodeType方法的典型用法代码示例。如果您正苦于以下问题:C++ Node::nodeType方法的具体用法?C++ Node::nodeType怎么用?C++ Node::nodeType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在poco::xml::Node的用法示例。


在下文中一共展示了Node::nodeType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setRaw

void XMLConfiguration::setRaw(const std::string& key, const std::string& value)
{
	std::string::const_iterator it = key.begin();
	Poco::XML::Node* pNode = findNode(it, key.end(), _pRoot, true);
	if (pNode)
	{
        unsigned short nodeType = pNode->nodeType();
        if (Poco::XML::Node::ATTRIBUTE_NODE == nodeType)
        {
            pNode->setNodeValue(value);
        }
        else if (Poco::XML::Node::ELEMENT_NODE == nodeType)
        {
            Poco::XML::Node* pChildNode = pNode->firstChild();
            if (pChildNode)
            {
                if (Poco::XML::Node::TEXT_NODE == pChildNode->nodeType())
                {
                    pChildNode->setNodeValue(value);
                }
            }
            else
            {
				Poco::AutoPtr<Poco::XML::Node> pText = _pDocument->createTextNode(value);
				pNode->appendChild(pText);
            }
        }
	}
    else throw NotFoundException("Node not found in XMLConfiguration", key);
}
开发者ID:babafall,项目名称:Sogeti-MasterThesis-CrossPlatformMobileDevelopment,代码行数:30,代码来源:XMLConfiguration.cpp

示例2: removeRaw

void XMLConfiguration::removeRaw(const std::string& key)
{
	Poco::XML::Node* pNode = findNode(key);

	if (pNode)
	{
		if (pNode->nodeType() == Poco::XML::Node::ELEMENT_NODE)
		{
			Poco::XML::Node* pParent = pNode->parentNode();
			if (pParent)
			{
				pParent->removeChild(pNode);
			}
		}
		else if (pNode->nodeType() == Poco::XML::Node::ATTRIBUTE_NODE)
		{
			Poco::XML::Attr* pAttr = dynamic_cast<Poco::XML::Attr*>(pNode);
			Poco::XML::Element* pOwner = pAttr->ownerElement();
			if (pOwner)
			{
				pOwner->removeAttributeNode(pAttr);
			}
		}
	}
}
开发者ID:babafall,项目名称:Sogeti-MasterThesis-CrossPlatformMobileDevelopment,代码行数:25,代码来源:XMLConfiguration.cpp

示例3:

Poco::XML::Node* XMLConfiguration::findElement(const std::string& name, Poco::XML::Node* pNode, bool create)
{
	Poco::XML::Node* pChild = pNode->firstChild();
	while (pChild)
	{
		if (pChild->nodeType() == Poco::XML::Node::ELEMENT_NODE && pChild->nodeName() == name)
			return pChild;
		pChild = pChild->nextSibling();
	}
	if (create)
	{
		Poco::AutoPtr<Poco::XML::Element> pElem = pNode->ownerDocument()->createElement(name);
		pNode->appendChild(pElem);
		return pElem;
	}
	else return 0;
}
开发者ID:babafall,项目名称:Sogeti-MasterThesis-CrossPlatformMobileDevelopment,代码行数:17,代码来源:XMLConfiguration.cpp

示例4: result

Expression::Pointer
StandardElementHandler::Create(ExpressionConverter* converter, Poco::XML::Element* element)
{
    std::string name= element->nodeName();
    if (ExpressionTagNames::INSTANCEOF == name) {
        Expression::Pointer result(new InstanceofExpression(element));
        return result;
    } else if (ExpressionTagNames::TEST == name) {
        Expression::Pointer result(new TestExpression(element));
        return result;
    } else if (ExpressionTagNames::OR == name) {
        CompositeExpression::Pointer result(new OrExpression());
        this->ProcessChildren(converter, element, result);
        return result;
    } else if (ExpressionTagNames::AND == name) {
        CompositeExpression::Pointer result(new AndExpression());
        this->ProcessChildren(converter, element, result);
        return result;
    } else if (ExpressionTagNames::NOT == name) {
        Poco::XML::Node* child = element->firstChild();
        while (child != 0) {
            if (child->nodeType() == Poco::XML::Node::ELEMENT_NODE) {
                Expression::Pointer result(new NotExpression(converter->Perform(static_cast<Poco::XML::Element*>(child))));
                return result;
            }
            child = child->nextSibling();
        }
    } else if (ExpressionTagNames::WITH == name) {
        CompositeExpression::Pointer result(new WithExpression(element));
        this->ProcessChildren(converter, element, result);
        return result;
    } else if (ExpressionTagNames::ADAPT == name) {
        CompositeExpression::Pointer result(new AdaptExpression(element));
        this->ProcessChildren(converter, element, result);
        return result;
    } else if (ExpressionTagNames::ITERATE == name) {
        CompositeExpression::Pointer result(new IterateExpression(element));
        this->ProcessChildren(converter, element, result);
        return result;
    } else if (ExpressionTagNames::COUNT == name) {
        Expression::Pointer result(new CountExpression(element));
        return result;
    } else if (ExpressionTagNames::SYSTEM_TEST == name) {
        Expression::Pointer result(new SystemTestExpression(element));
        return result;
    } else if (ExpressionTagNames::RESOLVE == name) {
        CompositeExpression::Pointer result(new ResolveExpression(element));
        this->ProcessChildren(converter, element, result);
        return result;
    } else if (ExpressionTagNames::ENABLEMENT == name) {
        CompositeExpression::Pointer result(new EnablementExpression(element));
        this->ProcessChildren(converter, element, result);
        return result;
    } else if (ExpressionTagNames::EQUALS == name) {
        Expression::Pointer result(new EqualsExpression(element));
        return result;
    } else if (ExpressionTagNames::REFERENCE == name) {
        Expression::Pointer result(new ReferenceExpression(element));
        return result;
    }
    return Expression::Pointer();
}
开发者ID:robotdm,项目名称:MITK,代码行数:62,代码来源:berryStandardElementHandler.cpp


注:本文中的poco::xml::Node::nodeType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。