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


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

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


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

示例1: extractServerConfig

static ServerConfig extractServerConfig(DOMDocument * domDocument, DOMTreeWalker * domTreeWalker) {
    ServerConfig serverConfig;

    DOMNode * node = domTreeWalker->getCurrentNode();
    while (node) {
        if (XMLString::compareString(XMLString::transcode(node->getNodeName()), "ServerStartupConfig") == 0) {
            XMLNodeFilter * nodeFilter = new XMLNodeFilter();
            DOMTreeWalker * d = domDocument->createTreeWalker(node, DOMNodeFilter::SHOW_ALL, nodeFilter, true);
            serverConfig.setServerStartupConfig(extractServerStartupConfig(domDocument, d));
            d->release();
            delete nodeFilter;
        } else if (XMLString::compareString(XMLString::transcode(node->getNodeName()), "DeviceTypeSequence") == 0) {
            XMLNodeFilter * nodeFilter = new XMLNodeFilter();
            DOMTreeWalker * d = domDocument->createTreeWalker(node, DOMNodeFilter::SHOW_ALL, nodeFilter, true);
            serverConfig.setDeviceTypeMap(extractDeviceTypeMap(domDocument, d));
            d->release();
            delete nodeFilter;
        } else if (XMLString::compareString(XMLString::transcode(node->getNodeName()), "DeviceInstanceSequence") == 0) {
            XMLNodeFilter * nodeFilter = new XMLNodeFilter();
            DOMTreeWalker * d = domDocument->createTreeWalker(node, DOMNodeFilter::SHOW_ALL, nodeFilter, true);
            serverConfig.setDeviceInstanceMap(extractDeviceInstanceMap(domDocument, d));
            d->release();
            delete nodeFilter;
        } else if (XMLString::compareString(XMLString::transcode(node->getNodeName()), "TUIObjectTypeSequence") == 0) {
            XMLNodeFilter * nodeFilter = new XMLNodeFilter();
            DOMTreeWalker * d = domDocument->createTreeWalker(node, DOMNodeFilter::SHOW_ALL, nodeFilter, true);
            serverConfig.setTUIObjectTypeMap(extractTUIObjectTypeMap(domDocument, d));
            d->release();
            delete nodeFilter;
        } else if (XMLString::compareString(XMLString::transcode(node->getNodeName()), "TUIObjectInstanceSequence") == 0) {
            XMLNodeFilter * nodeFilter = new XMLNodeFilter();
            DOMTreeWalker * d = domDocument->createTreeWalker(node, DOMNodeFilter::SHOW_ALL, nodeFilter, true);
            serverConfig.setTUIObjectInstanceMap(extractTUIObjectInstanceMap(domDocument, d));
            d->release();
            delete nodeFilter;        
        } else if (XMLString::compareString(XMLString::transcode(node->getNodeName()), "ConnectorSequence") == 0) {
              XMLNodeFilter * nodeFilter = new XMLNodeFilter();
              DOMTreeWalker * d = domDocument->createTreeWalker(node, DOMNodeFilter::SHOW_ALL, nodeFilter, true);
              serverConfig.setConnectorVector(extractConnectorVector(domDocument, d));
              d->release();
              delete nodeFilter;
        } else if (XMLString::compareString(XMLString::transcode(node->getNodeName()), "MSPTypeSequence") == 0) {
            XMLNodeFilter * nodeFilter = new XMLNodeFilter();
            DOMTreeWalker * d = domDocument->createTreeWalker(node, DOMNodeFilter::SHOW_ALL, nodeFilter, true);
            //serverConfig.setMSPTypeMap(extractMSPTypeMap(domDocument, d));
            d->release();
            delete nodeFilter;
        } else if (XMLString::compareString(XMLString::transcode(node->getNodeName()), "MSPInstanceSequence") == 0) {
              XMLNodeFilter * nodeFilter = new XMLNodeFilter();
              DOMTreeWalker * d = domDocument->createTreeWalker(node, DOMNodeFilter::SHOW_ALL, nodeFilter, true);
              serverConfig.setMSPInstanceMap(extractMSPInstanceMap(domDocument, d));
              d->release();
              delete nodeFilter;
        }

        node = domTreeWalker->nextNode();
    }

    return serverConfig;
}
开发者ID:Lammmark,项目名称:tuiframework,代码行数:60,代码来源:ServerConfigXMLReader.cpp

示例2: extractParameterGroup

static ParameterGroup extractParameterGroup(DOMDocument * domDocument, DOMTreeWalker * domTreeWalker) {

    map<string, string> parameterMap;
    map<string, ParameterGroup> parameterGroupMap;

    DOMNode * node = domTreeWalker->nextNode();
    while (node) {
        if (XMLString::compareString(XMLString::transcode(node->getNodeName()), "Parameter") == 0) {
            DOMNamedNodeMap * nodeMap = node->getAttributes();

            string name;
            DOMNode * nameAttribute = nodeMap->getNamedItem(XMLString::transcode("name"));
            if (nameAttribute) {
                name = XMLString::transcode(nameAttribute->getNodeValue());
            }
            string value;
            DOMNode * valueAttribute = nodeMap->getNamedItem(XMLString::transcode("value"));
            if (valueAttribute) {
                value = XMLString::transcode(valueAttribute->getNodeValue());
            }
            parameterMap[name] = value;

            //TFINFO("Parameter: " << name << " -> " << value);
        } else if (XMLString::compareString(XMLString::transcode(node->getNodeName()), "ParameterGroup") == 0) {

            DOMNamedNodeMap * nodeMap = node->getAttributes();
            string name;
            DOMNode * nameAttribute = nodeMap->getNamedItem(XMLString::transcode("name"));
            if (nameAttribute) {
                name = XMLString::transcode(nameAttribute->getNodeValue());
            }

            XMLNodeFilter * nodeFilter = new XMLNodeFilter();
            DOMTreeWalker * d = domDocument->createTreeWalker(node, DOMNodeFilter::SHOW_ALL, nodeFilter, true);
            ParameterGroup pg = extractParameterGroup(domDocument, d);
            pg.setName(name);
            parameterGroupMap[name] = pg;
            d->release();
            delete nodeFilter;
        }
        node = domTreeWalker->nextNode();
    }

    ParameterGroup parameterGroup;
    parameterGroup.setParameterMap(parameterMap);
    parameterGroup.setParameterGroupMap(parameterGroupMap);

    return parameterGroup;
}
开发者ID:Lammmark,项目名称:tuiframework,代码行数:49,代码来源:ServerConfigXMLReader.cpp

示例3: ParseHIDDeviceCommands

bool CConfigParser::ParseHIDDeviceCommands(DOMNodeList* commandNodeList, CWin32SpaceNavigatorHIDCapture* device)
{
	if(commandNodeList == NULL)
		return true;

	for(unsigned long idx = 0; idx < commandNodeList->getLength(); idx++)
	{
		DOMNode* currentCommand = commandNodeList->item(idx);
		wstring commandNodeName = currentCommand->getNodeName();
		if(commandNodeName.compare(L"command") != 0)
			continue;
		wstring commandName = currentCommand->getAttributes()->getNamedItem(L"name")->getNodeValue();
		wstring commandReport = currentCommand->getAttributes()->getNamedItem(L"report")->getNodeValue();
		wstring commandValue = currentCommand->getAttributes()->getNamedItem(L"value")->getNodeValue();

		unsigned int report = NULL;
		unsigned int value = NULL;
		
		swscanf(commandReport.c_str(), L"0x%04X", &report);
		swscanf(commandValue.c_str(), L"0x%04X", &value);

		device->AddCommand(commandName, report, value);
	}
	return true;
}
开发者ID:rgeyer,项目名称:SpaceNavigatorHIDCapture,代码行数:25,代码来源:CConfigParser.cpp

示例4: ReadNode

void JointsElement::ReadNode(const DOMNode* node)
{
	_ASSERTE(node != NULL);

	ReadAttributes( node );

	DOMNode* currentNode = node->getFirstChild();
	while( currentNode != NULL )
	{
#if _DEBUG	// デバッグ時に名前をチェックする為に
		const XMLCh* name = currentNode->getNodeName();
#endif

		if( IsElementNode( currentNode ) )
		{
			if( Is_input_NodeName( currentNode ) )
			{
				InputElement* elemInput = new InputElement();

				elemInput->ReadNode( currentNode );
				vecElemInput.push_back( elemInput );
			}
		}

		currentNode = currentNode->getNextSibling();	// 次の要素を処理する
	}
}
开发者ID:syoutetu,项目名称:ColladaViewer_VC8,代码行数:27,代码来源:JointsElement.cpp

示例5: link

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

			//
			// link
			//
			if (element_name == "link")
			{
				return link((DOMElement*)child).file;
			}

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

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

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

示例6: buildFromXml

void Materia::buildFromXml (DOMNode *node) {
	XMLCh* tag_codigo = XMLString::transcode("codigo");
	XMLCh* tag_nome = XMLString::transcode("nome");
	XMLCh* tag_creditos = XMLString::transcode("creditos");
	XMLCh* tag_conceito = XMLString::transcode("conceito");
	XMLCh* tag_situacao = XMLString::transcode("situacao");
	
	DOMNodeList *l_children = node->getChildNodes();
	for (XMLSize_t i = 0; i < l_children->getLength(); ++i) {
		DOMNode *n = l_children->item(i);
		const XMLCh *tag = n->getNodeName();
		if (XMLString::equals(tag, tag_codigo)) {
			this->codigo = XMLString::transcode(n->getTextContent());
		} else if (XMLString::equals(tag, tag_nome)) {
			this->nome = XMLString::transcode(n->getTextContent());
		} else if (XMLString::equals(tag, tag_creditos)) {
			this->creditos = stoi(XMLString::transcode(n->getTextContent()));
		} else if (XMLString::equals(tag, tag_conceito)) {
			this->conceito = stod(XMLString::transcode(n->getTextContent()));
		} else if (XMLString::equals(tag, tag_situacao)) {
			this->situacao = XMLString::transcode(n->getTextContent());
		}
	}
	
	XMLString::release(&tag_codigo);
	XMLString::release(&tag_nome);
	XMLString::release(&tag_creditos);
	XMLString::release(&tag_conceito);
	XMLString::release(&tag_situacao);
}
开发者ID:rockerbacon,项目名称:xml-database-server,代码行数:30,代码来源:Materia.cpp

示例7: browseTree

void browseTree(DOMNode* root)
{
	static int indent = 1;
	indent++;

	DOMNodeList* list = root->getChildNodes();
	for( int i = 0; i < list->getLength(); i++ )
	{
		DOMNode* node = list->item(i);
		DOMString name = node->getLocalName();
		if( name.isNull() )
		{
			name = node->getNodeName();
		}
		if( name.isNull() )
		{
			continue;
		}
		if ( name.equals("#text") )
			continue;
		printDash(indent);
		cout<<name<<endl;
		browseTree(node);
	}
	indent--;
}
开发者ID:neustar,项目名称:registrar_toolkit,代码行数:26,代码来源:EppNamespaceParser.cpp

示例8: DTMReadException

void
DTMReader::readDatatype(std::string descriptor)
	throw(DTMReadException)
{
	DOMXMLParser parser;
	
    if ( parser.parse( ((char*)descriptor.c_str()) ) != 0 )
	{
		std::cerr << "Error during XML parsing" << std::endl;
        throw DTMReadException();
	}

	dtm_document_ = parser.getDocument();

	DOMNode* child = dtm_document_->getDocumentElement()->getFirstChild();
	while (child != 0)
	{
		if (child->getNodeType() == DOMNode::ELEMENT_NODE)
			// handle type_mapping
			if ( !XMLString::compareString(child->getNodeName(), X("type-mapping")) )
				type_mapping((DOMElement*)child);

        // get next child
		child = child->getNextSibling();
    }
}
开发者ID:BackupTheBerlios,项目名称:qedo-svn,代码行数:26,代码来源:DTMReader.cpp

示例9: extractTUIObjectInstance

static TUIObjectInstance extractTUIObjectInstance(DOMDocument * domDocument, DOMTreeWalker * domTreeWalker) {

    TUIObjectInstance tuiObjectInstance;
    DOMNode * node = domTreeWalker->getCurrentNode();
    DOMNamedNodeMap * nodeMap = node->getAttributes();

    DOMNode * nameAttribute = nodeMap->getNamedItem(XMLString::transcode("name"));
    if (nameAttribute) {
        tuiObjectInstance.setName(XMLString::transcode(nameAttribute->getNodeValue()));
    }

    DOMNode * tuiTypeNameAttribute = nodeMap->getNamedItem(XMLString::transcode("typename"));
    if (tuiTypeNameAttribute) {
        tuiObjectInstance.setTypeName(XMLString::transcode(tuiTypeNameAttribute->getNodeValue()));
    }

    while (node) {
        if (XMLString::compareString(XMLString::transcode(node->getNodeName()), "Description") == 0) {
            XMLCh * textContent = XMLString::replicate(node->getTextContent());
            XMLString::trim(textContent);
            tuiObjectInstance.setDescription(XMLString::transcode(textContent));
            XMLString::release(&textContent);
        }
        node = domTreeWalker->nextNode();
    }

    return tuiObjectInstance;
}
开发者ID:Lammmark,项目名称:tuiframework,代码行数:28,代码来源:ServerConfigXMLReader.cpp

示例10: DOMtoXMLElement

void DOMtoXMLElement(DOMNode* dom, XMLElement& xml)
{
  xml.setName(StrX(dom->getNodeName()));
  unsigned int i;
  string text;
  DOMNodeList* children = dom->getChildNodes();
  for (i=0;children && i<children->getLength();i++) {
    DOMNode* child = children->item(i);
    switch (child->getNodeType()) {
    case DOMNode::TEXT_NODE:
      text+=StrX(child->getNodeValue());
      break;
    case DOMNode::ELEMENT_NODE:
      {
	XMLElement childElement;
	DOMtoXMLElement(child, childElement);
	xml.addChild(childElement);
      }
      break;
    default:
      continue;
    }
  }
  xml.setText(text);
  DOMNamedNodeMap* attrs = dom->getAttributes();
  if (attrs == 0)
    return;
  for (i=0;i<attrs->getLength();i++) {
    DOMNode* attr = attrs->item(i);
    xml.setAttribute(StrX(attr->getNodeName()), StrX(attr->getNodeValue()));
  }
}
开发者ID:arjunroy,项目名称:modelnet-core,代码行数:32,代码来源:xml.cpp

示例11: buildFromXml

void Aluno::buildFromXml (DOMNode *node) {
	DOMElement *element = dynamic_cast<DOMElement*>(node);
	//recuperar dados do xml
	XMLCh* tag_cpf = XMLString::transcode("cpf");	//strings do xml usam o tipo XMLCh
	XMLCh* tag_nome = XMLString::transcode("nome");
	XMLCh* tag_universidade = XMLString::transcode("universidade");
	XMLCh* tag_curso = XMLString::transcode("curso");
	
	//armazenar dados no objeto
	DOMNodeList *l_children = node->getChildNodes();
	for (XMLSize_t i = 0; i < l_children->getLength(); ++i) {
		DOMNode *n = l_children->item(i);
		const XMLCh *tag = n->getNodeName();
		if (XMLString::equals(tag, tag_cpf)) {
			this->cpf = XMLString::transcode(n->getTextContent());
		} else if (XMLString::equals(tag, tag_nome)) {
			this->nome = XMLString::transcode(n->getTextContent());
		} else if (XMLString::equals(tag, tag_universidade)) {
			this->universidade = XMLString::transcode(n->getTextContent());
		} else if (XMLString::equals(tag, tag_curso)) {
			this->curso = XMLString::transcode(n->getTextContent());
		}
	}
	
	//strings xml precisam passar por um release apos uso
	XMLString::release(&tag_cpf);
	XMLString::release(&tag_nome);
	XMLString::release(&tag_universidade);
	XMLString::release(&tag_curso);
}
开发者ID:rockerbacon,项目名称:xml-database-server,代码行数:30,代码来源:Aluno.cpp

示例12: getChildNamed

DOMElement* XmlHelper::getChildNamed(DOMElement* parent, const char* const name)
{
	if( parent == NULL )
		Throw( NullPointerException, "parent darf nicht NULL sein" );

	DOMNodeList* nodes = parent->getChildNodes();
	XMLCh* nameXml = XMLString::transcode(name);

	DOMElement* rval = 0;
	
	for (unsigned int idx = 0; idx < nodes->getLength(); idx++)
	{
		DOMNode* item = nodes->item(idx);
		if (item->getNodeType() == DOMNode::ELEMENT_NODE &&
			XMLString::compareString(item->getNodeName(), nameXml)==0 )
		{
			rval = reinterpret_cast<DOMElement*>(item);
			break;
		}
	}

	XMLString::release(&nameXml);

	return rval;
}
开发者ID:BackupTheBerlios,项目名称:dsa-hl-svn,代码行数:25,代码来源:XmlHelper.cpp

示例13: ParseGesture

bool CConfigParser::ParseGesture(DOMNode* node, TActionByNameMap actions, CDeviceContext* device)
{
	TGestureList gestures;
	wstring actionName = node->getAttributes()->getNamedItem(L"action")->getNodeValue();
	unsigned long length = node->getChildNodes()->getLength();
	for(unsigned long i = 0; i < length; i++)
	{
		DOMNode* gestNode = node->getChildNodes()->item(i);
		wstring nodeType = gestNode->getNodeName();
		if(nodeType.compare(L"#text") == 0)
			continue;
		if(nodeType.compare(L"motion") == 0)
		{
			wstring position = gestNode->getAttributes()->getNamedItem(L"position")->getNodeValue();
			wstring axe = gestNode->getAttributes()->getNamedItem(L"axe")->getNodeValue();
			EGesturePosition pos;
			if(position.compare(L"positive") == 0)
				pos = EGesturePosition::POSITIVE;
			if(position.compare(L"negative") == 0)
				pos = EGesturePosition::NEGATIVE;
			if(position.compare(L"center") == 0)
				pos = EGesturePosition::CENTER;
			gestures.push_back(new CMotion(pos, _wtoi(axe.c_str())));
		}
		if(nodeType.compare(L"wait") == 0)
			gestures.push_back(new CTimeFrame(_wtoi(gestNode->getAttributes()->getNamedItem(L"length")->getNodeValue())));
	}
	device->_gestureProcessor.addMacro(gestures, actions[actionName]);
	return true;
}
开发者ID:rgeyer,项目名称:SpaceNavigatorHIDCapture,代码行数:30,代码来源:CConfigParser.cpp

示例14: fromXml

bool PointSetImp::fromXml(DOMNode* pDocument, unsigned int version)
{
   if (pDocument == NULL || !PlotObjectImp::fromXml(pDocument, version))
   {
      return false;
   }

   DOMElement* pElem = static_cast<DOMElement*>(pDocument);
   mSymbols = StringUtilities::fromXmlString<bool>(A(pElem->getAttribute(X("symbols"))));
   mLine = StringUtilities::fromXmlString<bool>(A(pElem->getAttribute(X("line"))));
   ColorType color = StringUtilities::fromXmlString<ColorType>(A(pElem->getAttribute(X("lineColor"))));
   mLineColor = COLORTYPE_TO_QCOLOR(color);
   mLineWidth = StringUtilities::fromXmlString<int>(A(pElem->getAttribute(X("lineWidth"))));
   mLineStyle = StringUtilities::fromXmlString<LineStyle>(A(pElem->getAttribute(X("lineStyle"))));

   for (DOMNode* pChld = pElem->getFirstChild(); pChld != NULL; pChld = pChld->getNextSibling())
   {
      if (XMLString::equals(pChld->getNodeName(), X("Point")))
      {
         PointImp* pPoint = dynamic_cast<PointImp*>(addPoint());
         if (pPoint == NULL || !pPoint->fromXml(pChld, version))
         {
            return false;
         }
      }
   }

   return true;
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:29,代码来源:PointSetImp.cpp

示例15: getAttributeValue

/**
 * extract's the value of an attribute and returns it:
 *
 * <parentNode>
 *	<elementNode attribute="returnstring" />
 * </parentNode>
 *
 * the first parentNode found in the document is used. thus, it is expected to be unique.
 *
 * @param parentNode 
 * @param elementNode 
 * @param attribute 
 * @return 
 */
string InputHandler::getAttributeValue(const XMLCh* parentNode, const XMLCh* elementNode, const XMLCh* attribute)
{
crusde_debug("%s, line: %d, InputHandler::getAttributeValue(%s) ", __FILE__, __LINE__, XMLString::transcode(elementNode));

	DOMElement *root = doc->getDocumentElement();
	DOMNodeList *node_list = root->getElementsByTagName(parentNode);
	
	/*if element does not exist, return emptry string*/
	if(node_list->getLength() == 0)
		return string();
		
	DOMNode *child = node_list->item(0)->getFirstChild();

	DOMNamedNodeMap *attributes = NULL;
		
	while (child)
	{
		if( child->getNodeType() == DOMNode::ELEMENT_NODE)
	       	{
			attributes = child->getAttributes();

			if( XMLString::compareIString(child->getNodeName(), elementNode) == 0 )
			{
				char *val = XMLString::transcode(attributes->getNamedItem(attribute)->getNodeValue());
				string value(val);
				XMLString::release(&val);
				return value;
			}
			
		}
		child = child->getNextSibling();
	}
	return string();
}
开发者ID:cageo,项目名称:Grapenthin-2013,代码行数:48,代码来源:InputHandler.cpp


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