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


C++ DOM_Node::getNodeName方法代码示例

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


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

示例1: getNode

DOM_Node XMLDocument::getNode(DOM_Node currNode, char* path, DataTypeAttribute** dtAttributes)
{
	if (path == NULL)
		return NULL_DOM_Node;

	char* currName = currNode.getNodeName().transcode();

  if (strcmp(currName, path) == 0 && (dtAttributes == NULL || doAttributesMatch(currNode, dtAttributes))) {
    delete[] currName;
		return currNode;
  }
  delete[] currName;

	char* cp = strchr(path, '.');
	char pathName[256];
	if (cp == NULL)
		strcpy(pathName, path);
	else
	{
		strncpy(pathName, path, cp - path);
		pathName[cp - path] = '\0';
	}

	DOM_Node child = currNode.getFirstChild();
	while (child != NULL)
	{
		char* childName = child.getNodeName().transcode();
		if (child.getNodeType() != DOM_Node::ELEMENT_NODE)
		{
			child = child.getNextSibling();
      delete[] childName;
			continue;
		}

		if (strcmp(pathName, childName) == 0)
		{
      if (cp != NULL) {
        delete[] childName;
				return getNode(child, cp+1, dtAttributes);
      }

			if (dtAttributes != NULL)
			{
				if (!doAttributesMatch(child, dtAttributes))
				{
					child = child.getNextSibling();
          delete[] childName;
					continue;
				}
			}

      delete[] childName;
			return child;
		}

    delete[] childName;
		child = child.getNextSibling();
	}
 	return NULL_DOM_Node;
}
开发者ID:gres147679,项目名称:openipmp,代码行数:60,代码来源:XMLDocument.cpp

示例2: setValue

//======================================================================
//======================================================================
bool XMLDocument::setValue(DOM_Node currNode, char* path, DataTypeAttribute** dtAttributes, char* value)
{
	if (mDoc == NULL)
		return false;

	if (path == NULL)
		return false;

	DOM_Node child = getNode(currNode, path, dtAttributes);
	if (child == NULL)
		return false;
	DOM_Node parent = child.getParentNode();
	if (parent == NULL)
		return false;

	DOM_Node grandChild = child.getFirstChild();
	short nType = DOM_Node::TEXT_NODE;
	if (grandChild != NULL)
	{
		nType = grandChild.getNodeType();
		if (nType != DOM_Node::TEXT_NODE && nType != DOM_Node::CDATA_SECTION_NODE)
			return false;
	}

	char* childName = child.getNodeName().transcode();
	DOM_NamedNodeMap nnodeMap = child.getAttributes();

	parent.removeChild(child);
	DOM_Element childElement = mDoc.createElement(childName);
  delete[] childName;
	for (unsigned int i = 0; i < nnodeMap.getLength(); i++)
	{
		DOM_Node attNode = nnodeMap.item(i);
		childElement.setAttribute(attNode.getNodeName(), attNode.getNodeValue());
	}

	if (nType == DOM_Node::TEXT_NODE)
	{
		DOM_Text childText = mDoc.createTextNode((value == NULL)?"":value);
		childElement.appendChild(childText);
	}
	else
	{
		DOM_CDATASection childCData = mDoc.createCDATASection((value == NULL)?"":value);
		childElement.appendChild(childCData);
	}
	parent.appendChild(childElement);

	return true;
}
开发者ID:gres147679,项目名称:openipmp,代码行数:52,代码来源:XMLDocument.cpp

示例3: if

EppResponseDataTransferContact * EppResponseDataTransferContact::fromXML( const DOM_Node& root )
{
	EppResponseDataTransferContact * res = null;
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
//		if( name.equals("id") )
		if( name.equals("id") || name.equals("contact:id") )
		{
			if( res == null )
			{
				DOMString id = EppUtil::getText(node);
				res = new EppResponseDataTransferContact(id);
			}
		}
		else if( res != null )
		{
			res->fromXMLCommon(node, name);
		}
	}

	return res;
}
开发者ID:davin-bao,项目名称:registrar_epp04toolkit,代码行数:33,代码来源:EppResponseDataTransferContact.cpp

示例4: doAttributesMatch

//======================================================================
//======================================================================
bool XMLDocument::doAttributesMatch(DOM_Node currNode, DataTypeAttribute** dtAttributes)
{
	DOM_NamedNodeMap nnodeMap = currNode.getAttributes();
	int len = nnodeMap.getLength();
	int a = 0;
	DataTypeAttribute* dtAttribute;
	while ((dtAttribute = (DataTypeAttribute*)dtAttributes[a++]) != (DataTypeAttribute*)NULL)
	{
		bool isFound = false;
		for (int i = 0; i < len && !isFound; i++)
		{
			DOM_Node attNode = nnodeMap.item(i);
      char* tmp = attNode.getNodeName().transcode();
      char* tmp1 = attNode.getNodeValue().transcode();
			if (strcmp(dtAttribute->getName(), tmp) == 0 &&
				strcmp(dtAttribute->getValue(), tmp1) == 0)
			{
				isFound = true;
			}
      delete[] tmp;
      delete[] tmp1;
		}
		if (!isFound)
			return false;
	}

	return true;
}
开发者ID:gres147679,项目名称:openipmp,代码行数:30,代码来源:XMLDocument.cpp

示例5: EppCommandCheckContact

EppCommandCheckContact * EppCommandCheckContact::fromXML( const DOM_Node& root )
{
	EppCommandCheckContact * cmd = new EppCommandCheckContact();
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
		if( name.equals("id") || name.equals("contact:id") )
		{
			DOMString id = EppUtil::getText(node);
			cmd->addId(id);
		}
	}

	return cmd;
}
开发者ID:davin-bao,项目名称:registrar_epp04toolkit,代码行数:25,代码来源:EppCommandCheckContact.cpp

示例6: EppCommandLogin

EppCommandLogin * EppCommandLogin::fromXML( const DOM_Node& root )
{
	EppCommandLogin * cmd = null;
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
		if( name.equals("svcs") )
		{
			EppServiceMenu * menu = EppServiceMenu::fromXML(node);
			if( menu != null )
			{
				cmd = new EppCommandLogin(*menu);
				delete menu;
				return cmd;
			}
		}
	}

	return null;
}
开发者ID:davin-bao,项目名称:registrar_epp04toolkit,代码行数:30,代码来源:EppCommandLogin.cpp

示例7: setAttributeList

//======================================================================
// CJM 4/17/03 ..Needed to update an attribute list... for ContentGuard
//======================================================================
bool XMLDocument::setAttributeList(char* path, DataTypeAttribute** dtAttributes)
{
	if (mDoc == NULL)
		return false;

	if (path == NULL)
		return false;

	DOM_Node child = getNode(mRootNode, path, NULL);
	char* value = getString(path);

	if (child == NULL)
		return false;

	short nType = child.getNodeType();

	DOM_Node parent = child.getParentNode();
	if (parent == NULL)
		return false;

	char* childName = child.getNodeName().transcode();
	DOM_NamedNodeMap nnodeMap = child.getAttributes();

	parent.removeChild(child);
	DOM_Element childElement = mDoc.createElement(childName);
  delete[] childName;

	int a = 0;
	DataTypeAttribute* dtAttribute;
	while ((dtAttribute = (DataTypeAttribute*)dtAttributes[a++]) != (DataTypeAttribute*)NULL)
	{

		childElement.setAttribute(dtAttribute->getName(), dtAttribute->getValue());
	}

	if (nType == DOM_Node::TEXT_NODE)
	{
		DOM_Text childText = mDoc.createTextNode((value == NULL)?"":value);
		childElement.appendChild(childText);
	}
	else
	{
		if (nType == DOM_Node::CDATA_SECTION_NODE)
		{
			DOM_CDATASection childCData = mDoc.createCDATASection((value == NULL)?"":value);
			childElement.appendChild(childCData);
		}
	}

	parent.appendChild(childElement);

	return true;

}
开发者ID:gres147679,项目名称:openipmp,代码行数:57,代码来源:XMLDocument.cpp

示例8: if

EppCommandInfoSvcsub * EppCommandInfoSvcsub::fromXML( const DOM_Node& root )
{
	EppCommandInfoSvcsub * cmd = null;
	EppAuthInfo * authInfo = null;
	DOMString userid = null;
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
//		if( name.equals("id") )
		if( name.equals("id") || name.equals("svcsub:id") )
		{
			DOMString id = EppUtil::getText(node);
			if( cmd == null )
			{
				cmd = new EppCommandInfoSvcsub(id);
			}
		}
//		if( name.equals("userid") )
		if( name.equals("userid") || name.equals("svcsub:userid") )
		{
			userid = EppUtil::getText(node);
		}
//		else if( name.equals("authInfo") )
		else if( name.equals("authInfo") || name.equals("svcsub:authInfo") )
		{
			if( authInfo == null )
			{
				authInfo = EppAuthInfo::fromXML(node);
			}
		}
	}
	if( cmd != null )
	{
		cmd->authInfo = authInfo;
		cmd->userid = userid;
	}
	else if( authInfo != null )
	{
		delete authInfo;
	}

	return cmd;
}
开发者ID:davin-bao,项目名称:registrar_epp04toolkit,代码行数:53,代码来源:EppCommandInfoSvcsub.cpp

示例9: if

EppContact * EppContact::fromXML( const DOM_Node& root )
{
	EppContact * contact = new EppContact();
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
		if( name.substringData(0, 8).equals("contact:") )
		{
			name = name.substringData(8, name.length() - 8);
		}
		if( name.equals("id") )
		{
			contact->id = EppUtil::getText(node);
		}
		else if( name.equals("ascii") )
		{
			contact->ascii = EppContactData::fromXML(node);
		}
		else if( name.equals("i15d") )
		{
			contact->i15d = EppContactData::fromXML(node);
		}
		else if( name.equals("voice") )
		{
			contact->voice = EppE164::fromXML(node);
		}
		else if( name.equals("fax") )
		{
			contact->fax = EppE164::fromXML(node);
		}
		else if( name.equals("email") )
		{
			contact->email = EppUtil::getText(node);
		}
		else
		{
			contact->fromXMLCommon(node, name);
		}
	}

	return contact;
}
开发者ID:davin-bao,项目名称:registrar_epp04toolkit,代码行数:52,代码来源:EppContact.cpp

示例10: clone

DOM_Node XMLDocument::clone(DOM_Node currNode)
{
	switch (currNode.getNodeType())
	{
		case DOM_Node::ELEMENT_NODE:
		{
			DOM_Element elem = mDoc.createElement(currNode.getNodeName());
			DOM_NamedNodeMap nnodeMap = currNode.getAttributes();
			for (unsigned int i = 0; i < nnodeMap.getLength(); i++)
			{
				DOM_Node attNode = nnodeMap.item(i);
				elem.setAttribute(attNode.getNodeName(), attNode.getNodeValue());
			}
			DOM_Node child = currNode.getFirstChild();
			while (child != NULL)
			{
				DOM_Node cNode = clone(child);
				if (cNode != NULL)
					elem.appendChild(cNode);
				child = child.getNextSibling();
			}
			return (DOM_Node)elem;
		}
		case DOM_Node::TEXT_NODE:
		{
			DOM_Text childText = mDoc.createTextNode(currNode.getNodeValue());
			return (DOM_Node)childText;
		}
		case DOM_Node::CDATA_SECTION_NODE:
		{
			DOM_CDATASection childCData = mDoc.createCDATASection(currNode.getNodeValue());
			return (DOM_Node)childCData;
		}
		default:
		{
			return NULL_DOM_Node;
		}
	}
}
开发者ID:gres147679,项目名称:openipmp,代码行数:39,代码来源:XMLDocument.cpp

示例11: if

EppCommandRenew * EppCommandRenew::fromXML( const DOM_Node& root )
{
	DOMString command = root.getLocalName();
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString prefix = node.getPrefix();
		DOMString name = node.getLocalName();
/*
		if( (prefix == null) || (name == null) )
		{
			continue;
		}
		if( name.equals(command) )
		{
			if( prefix.equals("domain") )
			{
				return EppCommandRenewDomain.fromXML(node);
			}
			else if( prefix.equals("svcsub") )
			{
				return EppCommandRenewSvcsub.fromXML(node);
			}
		}
*/
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name.equals("domain:renew") )
		{
			return EppCommandRenewDomain::fromXML(node);
		}
		else if( name.equals("svcsub:renew") )
		{
			return EppCommandRenewSvcsub::fromXML(node);
		}
	}

	return null;
}
开发者ID:davin-bao,项目名称:registrar_epp04toolkit,代码行数:42,代码来源:EppCommandRenew.cpp

示例12: if

EppHost * EppHost::fromXML( const DOM_Node& root )
{
	EppHost * host = new EppHost();
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
		if( name.substringData(0, 5).equals("host:") )
		{
			name = name.substringData(5, name.length() - 5);
		}
		if( name.equals("name") )
		{
			host->setName(EppUtil::getText(node));
		}
		else if( name.equals("addr") )
		{
			EppIpAddress * ip = EppIpAddress::fromXML(node);
			if ( ip != null )
			{
				host->addAddress(*ip);
				delete ip;
			}
		}
		else
		{
			host->fromXMLCommon(node, name);
		}
	}

   	return host;
}
开发者ID:davin-bao,项目名称:registrar_epp04toolkit,代码行数:41,代码来源:EppHost.cpp

示例13: if

EppResponseDataCreateDomain * EppResponseDataCreateDomain::fromXML( const DOM_Node& root )
{
	DOMString roid = null;
	DOMString domain = null;
	time_t exDate = 0;
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
//		if( name.equals("roid") )
		if( name.equals("roid") || name.equals("domain:roid") )
		{
			roid = EppUtil::getText(node);
		}
//		else if( name.equals("name") )
		else if( name.equals("name") || name.equals("domain:name") )
		{
			domain = EppUtil::getText(node);
		}
//		else if( name.equals("exDate") )
		else if( name.equals("exDate") || name.equals("domain:exDate") )
		{
			exDate = EppUtil::getDate(node);
		}
	}

	return new EppResponseDataCreateDomain(domain, roid, exDate);
}
开发者ID:davin-bao,项目名称:registrar_epp04toolkit,代码行数:37,代码来源:EppResponseDataCreateDomain.cpp

示例14: switch

// ---------------------------------------------------------------------------
//  ostream << DOM_Node
//
//  Stream out a DOM node, and, recursively, all of its children. This
//  function is the heart of writing a DOM tree out as XML source. Give it
//  a document node and it will do the whole thing.
// ---------------------------------------------------------------------------
ostream& operator<<(ostream& target, DOM_Node& toWrite)
{
    // Get the name and value out for convenience
    DOMString   nodeName = toWrite.getNodeName();
    DOMString   nodeValue = toWrite.getNodeValue();
    unsigned long lent = nodeValue.length();

    switch (toWrite.getNodeType())
    {
        case DOM_Node::TEXT_NODE:
        {
            gFormatter->formatBuf(nodeValue.rawBuffer(),
                                  lent, XMLFormatter::CharEscapes);
            break;
        }


        case DOM_Node::PROCESSING_INSTRUCTION_NODE :
        {
            *gFormatter << XMLFormatter::NoEscapes << gStartPI  << nodeName;
            if (lent > 0)
            {
                *gFormatter << chSpace << nodeValue;
            }
            *gFormatter << XMLFormatter::NoEscapes << gEndPI;
            break;
        }


        case DOM_Node::DOCUMENT_NODE :
        {

            DOM_Node child = toWrite.getFirstChild();
            while( child != 0)
            {
                target << child;
                // add linefeed in requested output encoding
                *gFormatter << chLF;
                target << flush;
                child = child.getNextSibling();
            }
            break;
        }


        case DOM_Node::ELEMENT_NODE :
        {
            // The name has to be representable without any escapes
            *gFormatter  << XMLFormatter::NoEscapes
                         << chOpenAngle << nodeName;

            // Output the element start tag.

            // Output any attributes on this element
            DOM_NamedNodeMap attributes = toWrite.getAttributes();
            int attrCount = attributes.getLength();
            for (int i = 0; i < attrCount; i++)
            {
                DOM_Node  attribute = attributes.item(i);

                //
                //  Again the name has to be completely representable. But the
                //  attribute can have refs and requires the attribute style
                //  escaping.
                //
                *gFormatter  << XMLFormatter::NoEscapes
                             << chSpace << attribute.getNodeName()
                             << chEqual << chDoubleQuote
                             << XMLFormatter::AttrEscapes
                             << attribute.getNodeValue()
                             << XMLFormatter::NoEscapes
                             << chDoubleQuote;
            }

            //
            //  Test for the presence of children, which includes both
            //  text content and nested elements.
            //
            DOM_Node child = toWrite.getFirstChild();
            if (child != 0)
            {
                // There are children. Close start-tag, and output children.
                // No escapes are legal here
                *gFormatter << XMLFormatter::NoEscapes << chCloseAngle;

                while( child != 0)
                {
                    target << child;
                    child = child.getNextSibling();
                }

                //
                // Done with children.  Output the end tag.
//.........这里部分代码省略.........
开发者ID:mvancompernolle,项目名称:ai_project,代码行数:101,代码来源:IOStreamOutputter.cpp

示例15: if

EppCommand * EppCommand::fromXML( const DOM_Node& root )
{
	unsigned int i;
	EppCommand * cmd = null;
	DOM_Node command;
	bool found = false;

	DOM_NodeList list = root.getChildNodes();
	for( i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
		if( name.equals("command") )
		{
			command = node;
			found = true;
			break;
		}
	}

	if( found == false )
	{
		return null;
	}

	list = command.getChildNodes();
	for( i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
		if( name.equals("login") )
		{
			cmd = EppCommandLogin::fromXML(node);
		}
		else if( name.equals("logout") )
		{
			cmd = EppCommandLogout::fromXML(node);
		}
		else if( name.equals("poll") )
		{
			cmd = EppCommandPoll::fromXML(node);
		}
		else if( name.equals("create") )
		{
			cmd = EppCommandCreate::fromXML(node);
		}
		else if( name.equals("delete") )
		{
			cmd = EppCommandDelete::fromXML(node);
		}
		else if( name.equals("info") )
		{
			cmd = EppCommandInfo::fromXML(node);
		}
		else if( name.equals("check") )
		{
			cmd = EppCommandCheck::fromXML(node);
		}
		else if( name.equals("renew") )
		{
			cmd = EppCommandRenew::fromXML(node);
		}
		else if( name.equals("transfer") )
		{
			cmd = EppCommandTransfer::fromXML(node);
		}
		else if( name.equals("update") )
		{
			cmd = EppCommandUpdate::fromXML(node);
		}
		/*
		 * other commands
		 */
		if( cmd != null )
		{
			break;
		}
	}
	if( cmd == null )
	{
		return null;
	}
	for( i = 0; i < list.getLength(); i++ )
	{
//.........这里部分代码省略.........
开发者ID:davin-bao,项目名称:registrar_epp04toolkit,代码行数:101,代码来源:EppCommand.cpp


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