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


C++ DOMNode::getNodeType方法代码示例

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


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

示例1: selectConfigElement

void Triggerconf::createConfigAttribute	(string module, string submodule, string configname, string attributename)
{
	//
	// attributes are always created, no matter if they exists or not
	// dublication is prevented by xercesc
	//

	DOMNode* currentConfigElement = selectConfigElement (module, submodule, configname);
	if (currentConfigElement == NULL) return;
	
	assert (currentConfigElement->getNodeType () == DOMNode::ELEMENT_NODE);
	DOMElement* elem = (DOMElement*) currentConfigElement;

	XMLCh* xattrname	= XMLString::transcode (attributename.c_str ());
	XMLCh* xempty		= XMLString::transcode ("");
	elem->setAttribute	(xattrname, xempty);
	XMLString::release	(&xattrname);
	XMLString::release	(&xempty);

	resetError ();
}
开发者ID:freshbob,项目名称:worms-attack,代码行数:21,代码来源:triggerconf.cpp

示例2: findElement

 void findElement(unsigned index) {
    currentElement = NULL;
    while ((elementList != NULL) && (index < elementList->getLength())) {
       DOMNode *node = elementList->item(index);
       if (node == NULL) {
          // Should be impossible
          throw new runtime_error("DOMChildIterator::setIndex() - elementList->item(i) failed");
       }
       if (node->getNodeType() == DOMNode::ELEMENT_NODE) {
          DOMElement *el = dynamic_cast< xercesc::DOMElement* >( node );
          if (el == NULL) {
             // Should be impossible
             throw new runtime_error("DOMChildIterator::setIndex() - casting failed");
          }
          currentElement = el;
          this->index = index;
          break;
       }
       index++;
    }
 }
开发者ID:CoffeeHacker,项目名称:usbdm-eclipse-makefiles-build,代码行数:21,代码来源:xmlParser.cpp

示例3: getAnimalName

// Returns the value of the "name" child of an "animal" element.
const XMLCh* getAnimalName(const DOMElement* animal)
{
    static XercesString name = fromNative("name");

    // Iterate though animal's children
    DOMNodeList* children = animal->getChildNodes( );
    for ( size_t i = 0,
                 len = children->getLength( ); 
          i < len; 
          ++i ) 
    {
        DOMNode* child = children->item(i);
        if ( child->getNodeType( ) == DOMNode::ELEMENT_NODE &&
             static_cast<DOMElement*>(child)->getTagName( ) == name )
        {
            // We've found the "name" element.
            return child->getTextContent( );
        }
    }
    return 0;
}
开发者ID:arraytools,项目名称:C,代码行数:22,代码来源:14-10.cpp

示例4: getPreviousLogicalSibling

DOMElement * DOMElementImpl::getPreviousElementSibling() const
{
    DOMNode* n = getPreviousLogicalSibling(this);
    while (n != NULL) {
        switch (n->getNodeType()) {
            case DOMNode::ELEMENT_NODE:
                return (DOMElement*) n;
            case DOMNode::ENTITY_REFERENCE_NODE:
                {
                    DOMElement* e = getLastElementChild(n);
                    if (e != NULL)
                        return e;
                }
                break;
            default:
                break;
        }
        n = getPreviousLogicalSibling(n);
    }
    return NULL;
}
开发者ID:AmesianX,项目名称:Sigil,代码行数:21,代码来源:DOMElementImpl.cpp

示例5: lookupPrefix

const XMLCh* DOMNodeImpl::lookupPrefix(const XMLCh* namespaceURI) const {
    // REVISIT: When Namespaces 1.1 comes out this may not be true
    // Prefix can't be bound to null namespace
    if (namespaceURI == 0) {
        return 0;
    }

    DOMNode *thisNode = castToNode(this);

    short type = thisNode->getNodeType();

    switch (type) {
    case DOMNode::ELEMENT_NODE: {
        return lookupPrefix(namespaceURI, (DOMElement*)thisNode);
    }
    case DOMNode::DOCUMENT_NODE:{
        return ((DOMDocument*)thisNode)->getDocumentElement()->lookupPrefix(namespaceURI);
    }

    case DOMNode::ENTITY_NODE :
    case DOMNode::NOTATION_NODE:
    case DOMNode::DOCUMENT_FRAGMENT_NODE:
    case DOMNode::DOCUMENT_TYPE_NODE:
        // type is unknown
        return 0;
    case DOMNode::ATTRIBUTE_NODE:{
        if (fOwnerNode->getNodeType() == DOMNode::ELEMENT_NODE) {
            return fOwnerNode->lookupPrefix(namespaceURI);
        }
        return 0;
    }
    default:{
        DOMNode *ancestor = getElementAncestor(thisNode);
        if (ancestor != 0) {
            return ancestor->lookupPrefix(namespaceURI);
        }
        return 0;
    }
    }
}
开发者ID:JohnWilliam1988,项目名称:TCIDE,代码行数:40,代码来源:DOMNodeImpl.cpp

示例6: parseGameObjectFile

void XmlPropertyReader::parseGameObjectFile(Ogre::DataStreamPtr &stream, const Ogre::String &groupName)
{
    initializeXml();

    XERCES_CPP_NAMESPACE::DOMDocument* doc = loadDocument(stream);

    DOMNodeList* godefsXml = doc->getDocumentElement()->getElementsByTagName(AutoXMLCh("gameobjectclass").data());
    for (unsigned int idx = 0; idx < godefsXml->getLength(); idx++)
    {
		PropertyRecordPtr ps(new PropertyRecord());
		DOMElement* curNode = static_cast<DOMElement*>(godefsXml->item(idx));
		
		const DOMNamedNodeMap* godefAttrs = curNode->getAttributes();
		for (XMLSize_t attrIdx = 0; attrIdx < godefAttrs->getLength(); attrIdx++)
		{
			PropertyEntry entry = processProperty(static_cast<DOMAttr*>(godefAttrs->item(attrIdx)));
            if (entry.first != "")
            {
                ps->setProperty(entry.first, entry.second);
            }
		}

        DOMNodeList* godefChildren = curNode->getChildNodes();
        for (XMLSize_t childIdx = 0; childIdx < godefChildren->getLength(); childIdx++)
        {
            DOMNode* curChild = godefChildren->item(childIdx);
            if (curChild->getNodeType() == DOMNode::ELEMENT_NODE)
            {
                PropertyEntry entry = processProperty(static_cast<DOMElement*>(curChild));
                if (entry.first != "")
                {
                    ps->setProperty(entry.first, entry.second);
                }
            }
        }
        mPropertyRecords.push_back(ps);
    }
	
    shutdownXml();
}
开发者ID:BackupTheBerlios,项目名称:dsa-hl-svn,代码行数:40,代码来源:XmlPropertyReader.cpp

示例7: load

void DSIGKeyInfoName::load(void) {

	// Assuming we have a valid DOM_Node to start with, load the signing key so that it can
	// be used later on

	if (mp_keyInfoDOMNode == NULL) {

		// Attempt to load an empty signature element
		throw XSECException(XSECException::LoadEmptyInfoName);

	}

	if (!strEquals(getDSIGLocalName(mp_keyInfoDOMNode), "KeyName")) {

		throw XSECException(XSECException::LoadNonInfoName);

	}

	// Now find the text node containing the name

	DOMNode *tmpElt = mp_keyInfoDOMNode->getFirstChild();

	while (tmpElt != 0 && tmpElt->getNodeType() != DOMNode::TEXT_NODE)
		tmpElt = tmpElt->getNextSibling();

	if (tmpElt != 0) {

		mp_keyNameTextNode = tmpElt;
		mp_name = tmpElt->getNodeValue();

	}

	else {

		throw XSECException(XSECException::ExpectedDSIGChildNotFound,
			MAKE_UNICODE_STRING("Expected TEXT node as child to <KeyName> element"));

	}

}
开发者ID:okean,项目名称:cpputils,代码行数:40,代码来源:DSIGKeyInfoName.cpp

示例8: attNodeCount

int attNodeCount(DOMElement * d) {

	int ret;

	ret = d->getAttributes()->getLength();

	DOMNode *c;

	c = d->getFirstChild();

	while (c != NULL) {

		if (c->getNodeType() == DOMNode::ELEMENT_NODE)
			ret += attNodeCount((DOMElement *) c);

		c = c->getNextSibling();

	}

	return ret;

}
开发者ID:mvancompernolle,项目名称:ai_project,代码行数:22,代码来源:XSECNameSpaceExpander.cpp

示例9:

DOMNode *WrapXerces::getNextLogicalSibling (
	const DOMNode* n )
{
	// Copied from Xerces-C
	DOMNode* next = n->getNextSibling();
	// If "n" has no following sibling and its parent is an entity reference node we
	// need to continue the search through the following siblings of the entity
	// reference as these are logically siblings of the given node.
	if ( !next ) {
		DOMNode* parent = n->getParentNode();
		while ( parent
				&& parent->getNodeType() == DOMNode::ENTITY_REFERENCE_NODE )
		{
			next = parent->getNextSibling();
			if ( next )
				break;

			parent = parent->getParentNode();
		}
	}
	return next;
}
开发者ID:aurex-linux,项目名称:xmlcopyeditor,代码行数:22,代码来源:wrapxerces.cpp

示例10: if

Implementation
CSDReader4qxml::implementation (DOMElement* element)
throw(CSDReadException)
{
	Implementation impl;
	impl.id = Qedo::transcode(element->getAttribute(X("id")));

	std::string element_name;
    DOMNode* child = element->getFirstChild();
    while (child != 0)
    {
		if (child->getNodeType() == DOMNode::ELEMENT_NODE)
		{
			element_name = Qedo::transcode(child->getNodeName());

			//
			// os
			//
			if (element_name == "os")
			{
				impl.os_name=os((DOMElement*)child);
			}

			//
			// fileinarchive
			//
			else if (element_name == "descriptor")
			{
				impl.descriptor=descriptor((DOMElement*)child);
			}
		}

        // get next child
	    child = child->getNextSibling();
	}

	//throw CSDReadException();
	return impl;
}
开发者ID:BackupTheBerlios,项目名称:qedo-svn,代码行数:39,代码来源:CSDReader4qxml.cpp

示例11: isEqualNode

bool DOMNodeImpl::isEqualNode(const DOMNode* arg) const
{
    if (!arg)
        return false;

    if (isSameNode(arg)) {
        return true;
    }

    DOMNode* thisNode = castToNode(this);

    if (arg->getNodeType() != thisNode->getNodeType()) {
        return false;
    }

    // the compareString will check null string as well
    if (!XMLString::equals(thisNode->getNodeName(), arg->getNodeName())) {
        return false;
    }

    if (!XMLString::equals(thisNode->getLocalName(),arg->getLocalName())) {
        return false;
    }

    if (!XMLString::equals(thisNode->getNamespaceURI(), arg->getNamespaceURI())) {
        return false;
    }

    if (!XMLString::equals(thisNode->getPrefix(), arg->getPrefix())) {
        return false;
    }

    if (!XMLString::equals(thisNode->getNodeValue(), arg->getNodeValue())) {
        return false;
    }

    return true;
}
开发者ID:JohnWilliam1988,项目名称:TCIDE,代码行数:38,代码来源:DOMNodeImpl.cpp

示例12: createRegion

	void *NclLayoutParser::parseRegion(
		    DOMElement *parentElement, void *objGrandParent) {

		wclog << "parseRegion" << endl;
		void *parentObject;
		DOMNodeList *elementNodeList;
		DOMElement *element;
		DOMNode *node;
		string elementTagName;
		void *elementObject;

		parentObject = createRegion(parentElement, objGrandParent);
		if (parentObject == NULL) {
			return NULL;
		}

		elementNodeList = parentElement->getChildNodes();
		for (int i = 0; i < (int)elementNodeList->getLength(); i++) {
			node = elementNodeList->item(i);
			if (node->getNodeType()==DOMNode::ELEMENT_NODE) {
				element = (DOMElement*)node;
				elementTagName = XMLString::transcode(element->getTagName());
				wclog << ">>" << elementTagName.c_str() << ": ";
				wclog << XMLString::transcode(element->getAttribute(XMLString::transcode("id")));

				if (XMLString::compareIString(
					    elementTagName.c_str(), "region") == 0) {

					elementObject = parseRegion(element, parentObject);
					if (elementObject != NULL) {
						addRegionToRegion(parentObject, elementObject);
					}
				}
			}
		}

		return parentObject;
	}
开发者ID:lince,项目名称:ginga-srpp,代码行数:38,代码来源:NclLayoutParser.cpp

示例13: createImportedDocumentBase

	void *NclImportParser::parseImportedDocumentBase(
		    DOMElement *parentElement, void *objGrandParent) {

		void *parentObject;
		DOMNodeList *elementNodeList;
		DOMElement *element;
		DOMNode *node;
		string elementTagName;
		void *elementObject;

		//pre-compile attributes
		parentObject = createImportedDocumentBase(
			    parentElement, objGrandParent);

		if (parentObject == NULL) {
			return NULL;
		}

		elementNodeList = parentElement->getChildNodes();
		for (int i = 0; i < (int)elementNodeList->getLength(); i++) {
			node = elementNodeList->item(i);
			if(node->getNodeType()==DOMNode::ELEMENT_NODE){
				element = (DOMElement*)node;
				elementTagName = XMLString::transcode( element->getTagName() );
				if (XMLString::compareIString(
					     elementTagName.c_str(), "importNCL") == 0) {

					elementObject = parseImportNCL(element, parentObject);
					if (elementObject != NULL) {
						addImportNCLToImportedDocumentBase(
							    parentObject, elementObject);
					}
				}
			}
		}

		return parentObject;
	}
开发者ID:lince,项目名称:ginga-srpp,代码行数:38,代码来源:NclImportParser.cpp

示例14: clsSettingsReaderException

list<string> ClsSettingsReader::getListLastFiles() {
#ifdef DEBUG_CLSSETTINGSREADER
    cout << "ClsSettingsReader::getListLastFiles()" << endl;
#endif
    list<string> lstLFO;

    if(iSysSettingReaderState !=  PARSER_BUFFER_PARSED){
	ClsSettingsReaderException clsSettingsReaderException(ClsSettingsReaderException::BUFFER_NOT_PARSED);
	throw clsSettingsReaderException;
    }


    DOMNodeList* dnlstTemp = ddocIqrSetting->getElementsByTagName(XMLString::transcode(ClsTagLibrary::lastFilesOpen()));
    DOMNode* dnTemp=NULL;

    if ( dnlstTemp->getLength() == 1){
	dnTemp = dnlstTemp->item(0);
    } else if ( dnlstTemp->getLength() < 1)	{
	ClsSettingsReaderException clsSettingsReaderException(ClsSettingsReaderException::ENTITY_NOT_FOUND);
	throw clsSettingsReaderException;
    }

    DOMNodeList* dnlstFiles = dnTemp->getChildNodes();
    unsigned int ii = 0;
    while( ii< dnlstFiles->getLength()){
	DOMNode* dnTempTemp = dnlstFiles->item(ii);
	if(dnTempTemp->getNodeType() == 1){
	    DOMNode* dnValue = dnTempTemp->getFirstChild();
	    if(dnValue!=NULL){
		string strValue = XMLString::transcode(dnValue->getNodeValue());
		lstLFO.push_back(strValue);
	    }
	}
	ii++;
    }

    return lstLFO;
};
开发者ID:jeez,项目名称:iqr,代码行数:38,代码来源:ClsSettingsReader.cpp

示例15: getChildOfType

DOMNode* Triggerconf::getChildOfType (DOMNode* root, short type, unsigned int index)
{
	if (root == NULL) return NULL;
	if (! root->hasChildNodes ()) return NULL;

	DOMNodeList* childs = root->getChildNodes ();
	if (childs == NULL) return NULL;

	unsigned int idx = 0;

	for (unsigned int i=0; i<childs->getLength (); i++) {
		DOMNode* child = childs->item (i);

		if (child->getNodeType () == type) {
			if (idx == index)
				return child;
			else
				idx++;
		}
	} // for (unsigned int i=0; i<childs->getLength (); i++)

	return NULL;
}
开发者ID:freshbob,项目名称:worms-attack,代码行数:23,代码来源:triggerconf.cpp


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