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


C++ DOMNamedNodeMap::item方法代码示例

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


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

示例1:

void *PointSet::read(DOMNode *node) {
	unsigned int i; 				// variable to counter
	DOMNodeList *children;			// variable to hold the node children
	
	DOMNamedNodeMap *attributes;	// variable to hold the node attributes

	attributes = node->getAttributes();
	for (i = 0; i < attributes->getLength(); i++) {
		if (!strcmp(XMLString::transcode(attributes->item(i)->getNodeName()) , "DEF")) {
			setLink(XMLString::transcode(attributes->item(i)->getNodeValue()),this);
		}// else
		//if (!strcmp(XMLString::transcode(attributes->item(i)->getNodeName()) , "USE")) {
		//	return(getLink(XMLString::transcode(attributes->item(i)->getNodeValue())));
		//} 
	}

	children = node->getChildNodes();
	if (children != NULL) {
		for (i = 0; i < children->getLength (); i++) {			
			if (!strcmp (XMLString::transcode(children->item(i)->getNodeName()),"Coordinate")) {
				coordinate = Coordinate::get(children->item(i));
				coordinateNumber = coordinate->getNumberOfElements();
			} else
			if (!strcmp (XMLString::transcode(children->item(i)->getNodeName()),"Color")) {
				color = Color::get(children->item(i));
				colorNumber = color->getNumberOfElements();
			} 
		}
	}
	
	#ifdef DEBUG
		float sizes[2];
		float step;
		glGetFloatv(GL_POINT_SIZE_RANGE,sizes);
		glGetFloatv(GL_POINT_SIZE_GRANULARITY,&step);
		cout << "Max and Min point size " << sizes[0] << " , " << sizes[1] << " Granularity " << step << endl;
	#endif
	
	if(colorNumber) {
		if(colorNumber==3) {
			cout << "Three colors selected" << endl;
		} else
		if(colorNumber!=coordinateNumber) {
			cerr << "Color and coordinate not matching" << endl;
		}
	}

		
	#ifdef DEBUG
		cout << "Coordinate Number " << coordinateNumber << endl;
		cout << "Color Number " << colorNumber << endl;
	#endif

	return(NULL);
	
}
开发者ID:lpsoares,项目名称:jinx,代码行数:56,代码来源:x3dRendering.cpp

示例2: Inline

Inline *Inline::get(DOMNode *node) {
unsigned int i; 				// variable to counter
	DOMNamedNodeMap *attributes;	// variable to hold the node attributes
	
	char DEF2[256];					// temporary variable to hold the DEF name
	strcpy(DEF2,"");					// reseting the variable
	
	Inline *inline2 = NULL;					// temporary variable
	
	attributes = node->getAttributes();
	for (i = 0; i < attributes->getLength(); i++) {
		if (!strcmp(XMLString::transcode(attributes->item(i)->getNodeName()) , "DEF")) {
			strcpy(DEF2,XMLString::transcode (attributes->item(i)->getNodeValue()));
			break;
		} else 
		if (!strcmp(XMLString::transcode(attributes->item(i)->getNodeName()) , "USE")) {
			
			inline2 = (Inline *)getLink(XMLString::transcode(attributes->item(i)->getNodeValue()));
			
			if( inline2->ami("Inline") ) {
				cout << "USE of a different DEF type" << endl;
			}
			
			return(inline2);
			
		} 
	}
		
	
	// verificar se o USE ta retornando NULL
	
	inline2 = new Inline();
	if(inline2==NULL) { 
		cerr << "Error on getting Group" << endl;
	}
	
	if(strcmp(DEF2,"")) {
		#ifdef DEBUG3
			cout << "DEF : " << DEF2 << endl;
		#endif
		strcpy(inline2->DEF,DEF2);
		setLink(inline2->DEF,inline2);			
	}
	
	inline2->read(node);
	
	return inline2;

}
开发者ID:lpsoares,项目名称:jinx,代码行数:49,代码来源:x3dNetworking.cpp

示例3: convertToNode

//=============================================================================
// METHOD: SPELLxmlConfigReaderXC::convertToNode
//=============================================================================
SPELLxmlNode* SPELLxmlConfigReaderXC::convertToNode( DOMElement* element )
{
    // Create an abstract node with this name
    SPELLxmlNode* node = new SPELLxmlNode( XMLString::transcode(element->getNodeName()) );

    // Get any possible attributes
    DOMNamedNodeMap* attrs = element->getAttributes();
    XMLSize_t numAttrs = attrs->getLength();
    for( XMLSize_t idx = 0; idx < numAttrs; idx++)
    {
        // Get the attribute node
        DOMNode* attrNode = attrs->item(idx);
        // Get name and value
        const XMLCh* aname  = attrNode->getNodeName();
        const XMLCh* avalue = attrNode->getNodeValue();
        // Convert name and value to strings
        std::string name = "<?>";
        if (aname != NULL)
        {
            name = XMLString::transcode(aname);
        }
        std::string value = "<?>";
        if (avalue != NULL)
        {
            value = XMLString::transcode(avalue);
        }
        node->addAttribute( name, value );
    }

    // Get any possible children
    DOMNodeList* children = element->getChildNodes();
    XMLSize_t numChildren = children->getLength();
    for( XMLSize_t idx = 0; idx < numChildren; idx++)
    {
        // Get the children node
        DOMNode* childNode = children->item(idx);
        // Process only ELEMENTs and TEXTs
        if (childNode->getNodeType() && // true is not NULL
                childNode->getNodeType() == DOMNode::ELEMENT_NODE) // is element
        {
            // For elements, recursively add children
            SPELLxmlNode* child = convertToNode( dynamic_cast<xercesc::DOMElement*>(childNode) );
            node->addChild(child);
        }
        else if (childNode->getNodeType() == DOMNode::TEXT_NODE)
        {
            // For text values, add the value. This code will just ignore
            // carriage-return values
            const XMLCh* nvalue = childNode->getNodeValue();
            if (nvalue != NULL)
            {
                std::string thevalue = XMLString::transcode(nvalue);
                SPELLutils::trim(thevalue, " \n\r\t");
                node->setValue( thevalue );
            }
        }
    }

    return node;
}
开发者ID:unnch,项目名称:spell-sat,代码行数:63,代码来源:SPELLxmlConfigReaderXC.C

示例4: setTypes

void XercesUpdateFactory::setTypes(DOMNode *node, const DOMNode *from)
{
  if(node->getNodeType() == DOMNode::ELEMENT_NODE) {
    const XMLCh *turi, *tname;
    XercesNodeImpl::typeUriAndName(from, turi, tname);
    XercesSequenceBuilder::setElementTypeInfo((DOMElement *)node, turi, tname);

    DOMNamedNodeMap *attrs = node->getAttributes();
    DOMNamedNodeMap *attrsfrom = from->getAttributes();
    for(unsigned int i = 0; i < attrs->getLength(); ++i) {
      DOMNode *a = attrs->item(i);
      DOMNode *afrom = attrsfrom->getNamedItemNS(a->getNamespaceURI(), Axis::getLocalName(a));
      if(afrom) setTypes(a, afrom);
    }

    DOMNode *child = node->getFirstChild();
    DOMNode *cfrom = from->getFirstChild();
    while(child) {
      if(child->getNodeType() == DOMNode::ELEMENT_NODE)
        setTypes(child, cfrom);
      child = child->getNextSibling();
      cfrom = cfrom->getNextSibling();
    }
  }
  else if(node->getNodeType() == DOMNode::ATTRIBUTE_NODE) {
    const XMLCh *turi, *tname;
    XercesNodeImpl::typeUriAndName(from, turi, tname);
    XercesSequenceBuilder::setAttributeTypeInfo((DOMAttr *)node, turi, tname);
  }
}
开发者ID:xubingyue,项目名称:xqilla,代码行数:30,代码来源:XercesUpdateFactory.cpp

示例5: getAttributeByName

std::string getAttributeByName (DOMNode* node, std::string attrName) {
	cdebug << "getAttr " << attrName << std::endl;
	assert (node->getNodeType () == DOMNode::ELEMENT_NODE);
	
	std::string value = "";
	
	if (node->hasAttributes()) {
		DOMNamedNodeMap *pAttributes = node->getAttributes ();
		
		for (unsigned int i = 0; i < pAttributes->getLength (); i++) {
			DOMAttr* pAttributeNode = (DOMAttr*) pAttributes->item(i);
			char* name = XMLString::transcode(pAttributeNode->getName());
			if (name == attrName) {
				char* tmpValue = XMLString::transcode(pAttributeNode->getValue());
				value = tmpValue;
				XMLString::release(&tmpValue);
			}
			XMLString::release(&name);
		}
	} else {
		cdebug << "Error in file to parse" << std::endl;
		throw ("Error in file to parse attributes");
	}
	cdebug << value << std::endl;
	return value;
} /* std::string getAttributeByName (DOMNode* node, std::string attrName) */
开发者ID:BackupTheBerlios,项目名称:moneybook-svn,代码行数:26,代码来源:libmoneybook.cpp

示例6: 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

示例7: getAttributes

// ----------------------------------------------------------------------------
//	Base Attributes Builder
// ----------------------------------------------------------------------------
void AttributesBuilder::getAttributes()
{
	if ( node_->hasAttributes() ) {
		DOMNamedNodeMap* theAttributes = node_->getAttributes();
		int numAttributes = theAttributes->getLength();
	
		for (int n=0; n < numAttributes; ++n) {
			DOMNode* attrib = theAttributes->item(n);

			const XMLCh* xmlch_Name = attrib->getNodeName();
			char* attrName = XMLString::transcode(xmlch_Name);

			const XMLCh* xmlch_Value = attrib->getNodeValue();
			char* attrValue = XMLString::transcode(xmlch_Value);
		
			try {
				//attrib_->update(pname.get(), pval.get());
				attrib_->update(attrName, attrValue);
			} catch (std::runtime_error &ex) {
				std::cerr << ex.what() << std::endl
						<< builderType_ << __FUNCTION__ << "(): "
						<< "In space \"" << attrib_->getValAsStr("name")
						<< "\", unrecognized attribute \"" << attrName << "=" << attrValue
						<< "\". Ignoring it." << std::endl;
			};

			XMLString::release( &attrName );
			XMLString::release( &attrValue );
		}
		
	}
}
开发者ID:yamokosk,项目名称:sceneml,代码行数:35,代码来源:xml_attributes.cpp

示例8: if

bool
XMLExtServiceHelper::parseExtServicesReq( DOMNode* cur, DOMNode* out,
                                          DOMDocument* reply, 
                                          bool indent,
                                          const HttpHeader& inHeaders )
{
   // Attributes
   DOMNamedNodeMap* attributes = cur->getAttributes();

   // Language of the request.
   LangTypes::language_t lang = LangTypes::english;
   // Semi-optional crc
   MC2String crc;
   
   for( int i = 0, n = attributes->getLength(); i < n; ++i ) {
      DOMNode* attrib = attributes->item( i );
      if ( XMLString::equals( attrib->getNodeName(), "language" ) ) {
         lang = m_xmlParserThread->getStringAsLanguage( 
            XMLUtility::getChildTextStr( *attrib ).c_str() );
      } else if ( XMLString::equals( attrib->getNodeName(), "crc" ) ) {
         crc = XMLUtility::getChildTextStr( *attrib );
      }
   }

   // Make the answer.
   appendExternalSearchDesc( out,
                             reply,
                             cur,
                             crc,
                             lang,
                             1,
                             indent );

   return true;
}
开发者ID:FlavioFalcao,项目名称:Wayfinder-Server,代码行数:35,代码来源:XMLExtServiceHelper.cpp

示例9: if

EppCommandInfoLaunchRegistration* EppCommandInfoLaunchRegistration::fromXML( const DOMNode& root )
{
	EppCommandInfoLaunchRegistration* cmd  = new EppCommandInfoLaunchRegistration();
	if( cmd == null )
	{
		return null;
	}
	DOMNodeList* list      = root.getChildNodes();
	DOMNamedNodeMap* attrs = root.getAttributes();

	for( unsigned 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.length() > 7) && name.substringData(0, 7).equals("launch:") )
		{
			name = name.substringData(7, name.length() - 7);
		}
		if( name.equals("phase") )
		{
			EppLaunchPhase *_pptr = EppLaunchPhase::fromXML(*node);
			if( null != _pptr )
			{
				cmd->_phase = *_pptr;
				delete _pptr;
			}
			_pptr = null;
		}
		else if ( name.equals("applicationID") )
		{
			cmd->_appId = EppUtil::getText(*node);
		}
	}
	for( unsigned int i = 0;i<attrs->getLength();i++ )
	{
		DOMNode* attr = attrs->item(i);
		if( XS(attr->getNodeName()).equals("includeMark") )
		{
			DOMString _v = attr->getNodeValue();
			if( _v.length() > 0 )
			{
				if( _v.equals("true") )
				{
					cmd->includeMark(true);
				}
			}
			break;
		}
	}
	return cmd;
}
开发者ID:neustar,项目名称:registrar_toolkit,代码行数:59,代码来源:EppCommandInfoLaunchRegistration.cpp

示例10: Anchor

Anchor *Anchor::get(DOMNode *node) {
	
	unsigned int i; 				// variable to counter
	DOMNamedNodeMap *attributes;	// variable to hold the node attributes
	
	Anchor *anchor;
	
	attributes = node->getAttributes();
	for (i = 0; i < attributes->getLength(); i++) {
		if (!strcmp(XMLString::transcode(attributes->item(i)->getNodeName()) , "USE")) {
			return((Anchor *)getLink(XMLString::transcode(attributes->item(i)->getNodeValue())));
		} 
	}
	
	anchor = new Anchor();
	anchor->read(node);
	
	return anchor;
}
开发者ID:lpsoares,项目名称:jinx,代码行数:19,代码来源:x3dNetworking.cpp

示例11: domCheckSum

//
// domCheckSum  -  Compute the check sum for a DOM node.
//                 Works recursively - initially called with a document node.
//
void ThreadParser::domCheckSum(const DOMNode *node)
{
    const XMLCh        *s;
    DOMNode          *child;
    DOMNamedNodeMap  *attributes;

    switch (node->getNodeType() )
    {
    case DOMNode::ELEMENT_NODE:
        {
            s = node->getNodeName();   // the element name

            attributes = node->getAttributes();  // Element's attributes
            int numAttributes = attributes->getLength();
            int i;
            for (i=0; i<numAttributes; i++)
                domCheckSum(attributes->item(i));

            addToCheckSum(s);          // Content and Children
            for (child=node->getFirstChild(); child!=0; child=child->getNextSibling())
                domCheckSum(child);

            break;
        }

    case DOMNode::ATTRIBUTE_NODE:
        {
            s = node->getNodeName();  // The attribute name
            addToCheckSum(s);
            s = node->getNodeValue();  // The attribute value
            if (s != 0)
                addToCheckSum(s);
            break;
        }

    case DOMNode::TEXT_NODE:
    case DOMNode::CDATA_SECTION_NODE:
        {
            s = node->getNodeValue();
            addToCheckSum(s);
            break;
        }

    case DOMNode::ENTITY_REFERENCE_NODE:
    case DOMNode::DOCUMENT_NODE:
        {
            // For entity references and the document, nothing is dirctly
            //  added to the checksum, but we do want to process the chidren nodes.
            //
            for (child=node->getFirstChild(); child!=0; child=child->getNextSibling())
                domCheckSum(child);
            break;
        }
    }
}
开发者ID:xin3liang,项目名称:platform_external_xerces-cpp,代码行数:59,代码来源:ThreadTest.cpp

示例12: nodesMatch

bool XmlParser::nodesMatch(DOMElement *mergeEl, DOMElement *patchEl) {

   DualString mergeTagName(mergeEl->getTagName());
   DualString patchTagName(patchEl->getTagName());
   if (verbose) {
      cerr << "Comparing Tag \'" << mergeTagName.asCString() << "\' to \'" << patchTagName.asCString();
   }
   if (!XMLString::equals(mergeTagName.asXMLString(), patchTagName.asXMLString())) {
      if (verbose) {
         cerr << "\' - false\n";
      }
      return false;
   }
   if (verbose) {
      cerr << "\' - equal\n";
   }
   DOMNamedNodeMap *patchAttributes = patchEl->getAttributes();

   unsigned attributeCount = patchAttributes->getLength();
   for (unsigned attrIndex = 0; attrIndex < attributeCount; attrIndex++) {
      DOMNode *attribute = patchAttributes->item(attrIndex);
      DualString attributeName(attribute->getNodeName());
      if (XMLString::equals(attributeName.asXMLString(), attr_merge_actions.asXMLString())) {
         if (verbose) {
            cerr << "Skipping attribute \'" << attributeName.asCString() << "\'\n";
         }
         continue;
      }
      if (verbose) {
         cerr << "Checking for attribute \'" << attributeName.asCString();
      }
      if (!mergeEl->hasAttribute(attributeName.asXMLString())) {
         if (verbose) {
            cerr << "\' - Not present\n";
         }
         return false;
      }
      if (verbose) {
         cerr << "\' - Present";
      }
      DualString patchAttributeValue(attribute->getNodeValue());
      DualString mergeAttributeValue(mergeEl->getAttribute(attributeName.asXMLString()));
      if (!XMLString::equals(patchAttributeValue.asXMLString(), mergeAttributeValue.asXMLString())) {
         if (verbose) {
            cerr << "\' - Not equal\n";
         }
         return false;
      }
      if (verbose) {
         cerr << "\' - Equal (" << patchAttributeValue.asCString() << ")\n";
      }
   }
   return true;
}
开发者ID:CoffeeHacker,项目名称:usbdm-eclipse-makefiles-build,代码行数:54,代码来源:xmlParser.cpp

示例13: parserDataSource

bool DataSource::parserDataSource(XSchema* pschema,xercesc::DOMElement* element)
{
	this->parentschema=pschema;

	if(element)
	{
		    DOMNamedNodeMap *attributes;
			DOMNodeList *children =element->getChildNodes();
			DOMNode *tmpnode;
			std::string tmpstr=XMLString::transcode(element->getNodeName());
			if(tmpstr!="DataSource")
			{
				return false;
			}

			attributes=element->getAttributes();

			if(attributes)
			{
				for(int j=0;j<attributes->getLength();j++)
				{
					tmpnode=attributes->item(j);
					tmpstr=XMLString::transcode(tmpnode->getNodeName());
					if(tmpstr == "type")
					{
						this->type_ = (DataSource::CUBETYPE) atoi(XMLString::transcode(tmpnode->getNodeValue()));
						
					}
					else if(tmpstr=="url")
					{
						this->_URL=XMLString::transcode(tmpnode->getNodeValue());
					}
					else if(tmpstr=="passWord")
					{
						this->_psword=XMLString::transcode(tmpnode->getNodeValue());
					}
					else if(tmpstr=="userName")
					{
						this->_UserName =XMLString::transcode(tmpnode->getNodeValue());
					}
				}			
			}
			else
			{
				return false;
			}			 
	}
	else
	{
		
		return false;
	}
	return true;
}
开发者ID:mydw,项目名称:mydw,代码行数:54,代码来源:DataSource.cpp

示例14: PointSet

PointSet *PointSet::get(DOMNode *node) {
	
	unsigned int i; 				// variable to counter
	DOMNamedNodeMap *attributes;	// variable to hold the node attributes
	
	PointSet *pointSet;
	
	attributes = node->getAttributes();
	for (i = 0; i < attributes->getLength(); i++) {
		if (!strcmp(XMLString::transcode(attributes->item(i)->getNodeName()) , "USE")) {
			return((PointSet *)getLink(XMLString::transcode(attributes->item(i)->getNodeValue())));
		} 
	}
	
	pointSet = new PointSet();
	pointSet->read(node);
		
	return pointSet;
	
}
开发者ID:lpsoares,项目名称:jinx,代码行数:20,代码来源:x3dRendering.cpp

示例15: NurbsCurve

NurbsCurve *NurbsCurve::get(DOMNode *node) {
	
	NurbsCurve *nurbsCurve;
	
	unsigned int i; 				// variable to counter
	DOMNamedNodeMap *attributes;	// variable to hold the node attributes
	
	attributes = node->getAttributes();
	for (i = 0; i < attributes->getLength(); i++) {
		if (!strcmp(XMLString::transcode(attributes->item(i)->getNodeName()) , "USE")) {
			return((NurbsCurve *)getLink(XMLString::transcode(attributes->item(i)->getNodeValue())));
		} 
	}
	
	nurbsCurve = new NurbsCurve();
	nurbsCurve->read(node);
	
	
	return nurbsCurve;
	
}
开发者ID:lpsoares,项目名称:jinx,代码行数:21,代码来源:x3dNurbs.cpp


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