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


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

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


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

示例1: processNodeAttributes

void Platform::processNodeAttributes(const QDomElement &element)
{
    QDomNamedNodeMap namedNodeMap = element.attributes();

    if (namedNodeMap.size() == 1) {
        QDomNode domNode = namedNodeMap.item(0);

        if (domNode.nodeType() == QDomNode::AttributeNode) {
            QDomAttr domElement = domNode.toAttr();

            if (domElement.name() == QString("Name")) {
                m_name = domElement.value();
//                vc_dbg << "AttributeNode: name: " << domElement.name() << " value: " << domElement.value();
            }
        }
    }
}
开发者ID:pivonroll,项目名称:VcProjectTree,代码行数:17,代码来源:platform.cpp

示例2: isKnown

/**
 * Check that the node map doesn't contain any unknown elements
 * @param attrs node map to check
 * @param names list of known names
 * @return false if node map contains unknown elements
 */
bool isKnown(const QDomNamedNodeMap& attrs, const char **names) {
	bool ok=true;
	for(int i=0;i<attrs.length();++i) {
		QDomNode n = attrs.item(i);
		const char **name = names;
		bool found=false;
		while(!found && *name!=0) {
			found = n.nodeName() == *name;
			++name;
		}
		if(!found) {
			qWarning() << "Unknown attribute" << n.nodeName();
			ok=false;
		}
	}
	return ok;
}
开发者ID:hexaditidom,项目名称:Drawpile,代码行数:23,代码来源:orareader.cpp

示例3: loadXML

void Definitions::loadXML( ParserContext *context, const QDomElement &element )
{
  setTargetNamespace( element.attribute( "targetNamespace" ) );
  mName = element.attribute( "name" );

  QDomNamedNodeMap attributes = element.attributes();
  for ( int i = 0; i < attributes.count(); ++i ) {
    QDomAttr attribute = attributes.item( i ).toAttr();
    if ( attribute.name().startsWith( "xmlns:" ) ) {
      QString prefix = attribute.name().mid( 6 );
      context->namespaceManager()->setPrefix( prefix, attribute.value() );
    }
  }

  QDomElement child = element.firstChildElement();
  while ( !child.isNull() ) {
    QName tagName = child.tagName();
    if ( tagName.localName() == "import" ) {
      Import import( mTargetNamespace );
      import.loadXML( context, child );
      mImports.append( import );
    } else if ( tagName.localName() == "types" ) {
      mType.loadXML( context, child );
    } else if ( tagName.localName() == "message" ) {
      Message message( mTargetNamespace );
      message.loadXML( context, child );
      mMessages.append( message );
    } else if ( tagName.localName() == "portType" ) {
      PortType portType( mTargetNamespace );
      portType.loadXML( context, child );
      mPortTypes.append( portType );
    } else if ( tagName.localName() == "binding" ) {
      Binding binding( mTargetNamespace );
      binding.loadXML( context, child );
      mBindings.append( binding );
    } else if ( tagName.localName() == "service" ) {
      mService.loadXML( context, &mBindings, child );
    } else if ( tagName.localName() == "documentation" ) {
      // ignore documentation for now
    } else {
      context->messageHandler()->warning( QString( "Definitions: unknown tag %1" ).arg( child.tagName() ) );
    }

    child = child.nextSiblingElement();
  }
}
开发者ID:cornelius,项目名称:kode,代码行数:46,代码来源:definitions.cpp

示例4: itemClicked

void NodeBrowser::itemClicked( QTreeWidgetItem *itm )
{
	d->browser.properties->clear();
	
	if( itm == 0) return;
	
	d->domPath = d->node->path("",itm);
	d->browser.path->setText(d->domPath);
	
	QDomNode node = SxDomUtils::getElement( d->doc.toElement(), d->domPath ); 
	if( !node.isNull() )
	{
		QDomNamedNodeMap map = node.attributes();
		int count = map.count();
		for( int idx = 0; idx < count; ++idx)
		d->browser.properties->addItem( map.item(idx).nodeName() );
	}
}
开发者ID:AlanLZY,项目名称:textroom,代码行数:18,代码来源:browser.cpp

示例5: addCorrectNS

static QDomElement addCorrectNS(const QDomElement &e)
{
	uint x;

	// grab child nodes
	/*QDomDocumentFragment frag = e.ownerDocument().createDocumentFragment();
	QDomNodeList nl = e.childNodes();
	for(x = 0; x < nl.count(); ++x)
		frag.appendChild(nl.item(x).cloneNode());*/

	// find closest xmlns
	QDomNode n = e;
	while(!n.isNull() && !n.toElement().hasAttribute("xmlns"))
		n = n.parentNode();
	QString ns;
	if(n.isNull() || !n.toElement().hasAttribute("xmlns"))
		ns = "jabber:client";
	else
		ns = n.toElement().attribute("xmlns");

	// make a new node
	QDomElement i = e.ownerDocument().createElementNS(ns, e.tagName());

	// copy attributes
	QDomNamedNodeMap al = e.attributes();
	for(x = 0; x < al.count(); ++x) {
		QDomAttr a = al.item(x).toAttr();
		if(a.name() != "xmlns")
			i.setAttributeNodeNS(a.cloneNode().toAttr());
	}

	// copy children
	QDomNodeList nl = e.childNodes();
	for(x = 0; x < nl.count(); ++x) {
		QDomNode n = nl.item(x);
		if(n.isElement())
			i.appendChild(addCorrectNS(n.toElement()));
		else
			i.appendChild(n.cloneNode());
	}

	//i.appendChild(frag);
	return i;
}
开发者ID:serghei,项目名称:kde3-kdenetwork,代码行数:44,代码来源:client.cpp

示例6: RestoreOn

void FopLeader::RestoreOn( QDomElement appender )
{
	QDomDocument doc;
	
	if (ELoriginal.size() > 8 && doc.setContent(ELoriginal,false) ) {
		    QDomElement root_extern = doc.documentElement(); 
				QDomNamedNodeMap alist = root_extern.attributes();
		
			          QDomElement leader = appender.ownerDocument().createElement("fo:leader");
								for (int i=0; i<alist.count(); i++){
									QDomNode nod = alist.item(i);
									leader.setAttribute(nod.nodeName().toLower(),nod.nodeValue());
								}
								
								QDomNode child = root_extern.firstChild();
										while ( !child.isNull() ) {
											
											if ( child.isElement() ) {
											leader.appendChild(appender.ownerDocument().importNode(child,true).toElement());
											}
											
										child = child.nextSibling();            
										}
				appender.appendChild(leader);
										
	} else {
		
		/* rebuild it but not editable! now  */
		/*
		<fo:leader leader-pattern="rule"
                   rule-thickness="10cm"
                   leader-length="6cm"
                   space-before.optimum="12pt"
                   space-after.optimum="12pt"
                   start-indent="1.5cm"
                   end-indent="2cm"
                   background-color="blue"
                   color="yellow"/>
		*/
	}
	
	
}
开发者ID:SorinS,项目名称:fop-miniscribus,代码行数:43,代码来源:Fop_Leader_Element.cpp

示例7: parse

void QtSimpleXml::parse(QDomNode node)
{
 //   puts("parse");
    if (node.isNull())
        return;

    valid = true;
    n = node.nodeName();
    QDomElement element = node.toElement();

    QDomNamedNodeMap attrs = element.attributes();
    for (int i = 0; i < (int) attrs.count(); ++i) {
        QDomAttr attribute = attrs.item(i).toAttr();
        attr.insert(attribute.name(), attribute.value());
    }

    if (element.firstChild().isText()) {
  //      printf("Got text %s\n", element.text().stripWhiteSpace().latin1());
        s = element.text().trimmed();
        return;
    }

    if (node.hasChildNodes()) {

        // Skip to first element child
        QDomNode child = node.firstChild();
        while (!child.isNull() && !child.isElement())
            child = child.nextSibling();

        while (!child.isNull()) {
            QtSimpleXml *xmlNode = new QtSimpleXml;
            xmlNode->parse(child);
            children.insert(xmlNode->name(), xmlNode);

            node = node.nextSibling();

            do {
                child = child.nextSibling();
            } while (!child.isNull() && !child.isElement());
        }
    }
}
开发者ID:wpbest,项目名称:copperspice,代码行数:42,代码来源:qtsimplexml.cpp

示例8: setXMLData

void ComplexBaseInputField::setXMLData( const QDomElement &element )
{
  if ( mName != element.tagName() ) {
    qDebug( "ComplexBaseInputField: Wrong dom element passed: expected %s, got %s", qPrintable( mName ), qPrintable( element.tagName() ) );
    return;
  }

  // elements
  if ( mType->isArray() ) {
    InputField *field = childField( "item" );
    field->setXMLData( element );
  } else {
    QDomNode node = element.firstChild();
    while ( !node.isNull() ) {
      QDomElement child = node.toElement();
      if ( !child.isNull() ) {
        InputField *field = childField( child.tagName() );
        if ( !field ) {
          qDebug( "ComplexBaseInputField: Child field %s does not exists", qPrintable( child.tagName() ) );
        } else {
          field->setXMLData( child );
        }
      }

      node = node.nextSibling();
    }
  }

  // attributes
  QDomNamedNodeMap nodes = element.attributes();
  for ( int i = 0; i < nodes.count(); ++i ) {
    QDomNode node = nodes.item( i );
    QDomAttr attr = node.toAttr();

    InputField *field = childField( attr.name() );
    if ( !field ) {
      qDebug( "ComplexBaseInputField: Child field %s does not exists", qPrintable( attr.name() ) );
    } else {
      field->setData( attr.value() );
    }
  }
}
开发者ID:cornelius,项目名称:kode,代码行数:42,代码来源:complexbaseinputfield.cpp

示例9: SaveElement

QByteArray FopLeader::SaveElement( const QDomElement e )
{
    QDomDocument em;
    QDomElement import = em.createElement(e.tagName().toLower());
    em.appendChild( import );
    QDomNamedNodeMap attlist = e.attributes();
    for (int i=0; i<attlist.count(); i++){
    QDomNode nod = attlist.item(i);
    import.setAttribute (nod.nodeName().toLower(),nod.nodeValue()); 
    }
                            QDomNode child = e.firstChild();
                               while ( !child.isNull() ) {
                                   if ( child.isElement() ) {
                                    import.appendChild(em.importNode(child,true).toElement());
                                   }
                                 child = child.nextSibling();            
                               }
															 
    return em.toByteArray(0);
}
开发者ID:SorinS,项目名称:fop-miniscribus,代码行数:20,代码来源:Fop_Leader_Element.cpp

示例10: htmlToString

void Xml::htmlToString(QDomElement e, int level, QString* s)
      {
      *s += QString("<%1").arg(e.tagName());
      QDomNamedNodeMap map = e.attributes();
      int n = map.size();
      for (int i = 0; i < n; ++i) {
            QDomAttr a = map.item(i).toAttr();
            *s += QString(" %1=\"%2\"").arg(a.name()).arg(a.value());
            }
      *s += ">";
      ++level;
      for (QDomNode ee = e.firstChild(); !ee.isNull(); ee = ee.nextSibling()) {
            if (ee.nodeType() == QDomNode::ElementNode)
                  htmlToString(ee.toElement(), level, s);
            else if (ee.nodeType() == QDomNode::TextNode)
                  *s += Qt::escape(ee.toText().data());
            }
      *s += QString("</%1>").arg(e.tagName());
      --level;
      }
开发者ID:gthomas,项目名称:MuseScore,代码行数:20,代码来源:xml.cpp

示例11:

QVector<Value> AVRStudioXMLParser::GetValues(QDomNodeList nodelist)
{
    QVector<Value> values;

    for(int i = 0; i < nodelist.size(); i++)
    {
        QDomNamedNodeMap attributes =  nodelist.at(i).attributes();
        Value value;

        for(int i = 0; i < attributes.size(); i++)
        {
            QDomNode attribute = attributes.item(i);
            if(value.GetMappingMap()[attribute.nodeName()])
                *value.GetMappingMap()[attribute.nodeName()] = attribute.nodeValue();
        }

        values.append(value);
    }

    return values;
}
开发者ID:ttomek32,项目名称:tmfavrcalculator,代码行数:21,代码来源:AVRStudioXMLParser.cpp

示例12: setAttributes

void PdfElement::setAttributes(const QDomNamedNodeMap attr, const QString cdata) {
	_attributes.clear();
	if (cdata != NULL && !cdata.isEmpty()) {
		extractExpressions(const_cast<QString*>(&cdata));
		_attributes.insert("cdata", cdata);
	}
	QString val;
	for (uint i = 0; i < attr.length(); i++) {
		QDomAttr a = attr.item(i).toAttr();
		if (!a.isNull()) {
			if (a.name().toLower() == "nth") {
				_onlyOnLast = a.value().toLower() == "last";
				_onlyOnFirst = a.value().toLower() == "first";
				_onlyOnNth = _onlyOnLast || _onlyOnFirst ? 1 : a.value().toInt();
			}
			val = a.value();
			extractExpressions(const_cast<QString*>(&val));
			_attributes.insert(a.name().toLower(), val);
		}
	}
}
开发者ID:LukyLuke,项目名称:PiTres,代码行数:21,代码来源:PdfElement.cpp

示例13: loadPluginPropertiesForElement

/**
 * This method is used to load element properties that are stored in plugins
 * @param element The Element being loaded
 * @param elProperties the xml properties of the element
 */
void CMapFileFilterXML::loadPluginPropertiesForElement(CMapElement *element,QDomElement *elProperties)
{
	QDomElement pluginsNode = readChildElement(elProperties,"plugins");
	if (!pluginsNode.isNull())
	{
		QDomNode n = pluginsNode.firstChild();
		while (!n.isNull() )
		{

			QDomElement e = n.toElement();

			if (!e.isNull() )
			{
				for (CMapPluginBase *plugin = m_mapManager->getPluginList()->first(); plugin!=0; plugin = m_mapManager->getPluginList()->next())
				{
					if (plugin->name()==e.tagName())
					{
						KMemConfig pluginProperties;

						QDomNamedNodeMap attribs = e.attributes();

						for (int i=0; i<attribs.length();i++)
						{
							QDomNode n2 = attribs.item(i);

							kDebug() << "Attrib " << n2.nodeName() << " = " << n2.nodeValue();
							pluginProperties.group("Properties").writeEntry(n2.nodeName(),n2.nodeValue());
							
						}
						
						plugin->loadElementProperties(element,&pluginProperties);
						break;	
					}
                }
			}

			n = n.nextSibling();
		}
	}
}
开发者ID:FractalBobz,项目名称:kmuddy,代码行数:45,代码来源:cmapfilefilterxml.cpp

示例14: interfaces

QVector<ProgrammingInterface> AVRStudioXMLParser::GetInterfaces(QDomNode node)
{
    QVector<ProgrammingInterface> interfaces(0);

    while(!node.isNull())
    {
        QDomNamedNodeMap attributes = node.attributes();
        ProgrammingInterface interface;

        for(int i = 0; i < attributes.size(); i++)
        {
            QDomNode attribute = attributes.item(i);
            if(interface.GetMappingMap()[attribute.nodeName()])
                *interface.GetMappingMap()[attribute.nodeName()] = attribute.nodeValue();
        }

        interfaces.append(interface);
        node = node.nextSibling();
    }

    return interfaces;
}
开发者ID:ttomek32,项目名称:tmfavrcalculator,代码行数:22,代码来源:AVRStudioXMLParser.cpp

示例15: processNodeAttributes

void Project::processNodeAttributes(const QDomElement &nodeElement)
{
    // process attributes
    QDomNamedNodeMap namedNodeMap = nodeElement.attributes();

    for (int i = 0; i < namedNodeMap.size(); ++i) {
        QDomNode domNode = namedNodeMap.item(i);

        if (domNode.nodeType() == QDomNode::AttributeNode) {
            QDomAttr domElement = domNode.toAttr();

            if (domElement.name() == QLatin1String("DefaultTargets"))
                m_defaultTargets = domElement.value().split(QLatin1Char(';'));
            else if (domElement.name() == QLatin1String("InitialTargets"))
                m_initialTargets = domElement.value().split(QLatin1Char(';'));
            else if (domElement.name() == QLatin1String("ToolsVersion"))
                m_toolsVersion = domElement.value();
            else if (domElement.name() == QLatin1String("xmlns"))
                m_xmlns = domElement.value();
        }
    }
}
开发者ID:pivonroll,项目名称:VCProjectX,代码行数:22,代码来源:project.cpp


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