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


C++ QDomAttr::name方法代码示例

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


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

示例1: ProcessAttributes

bool OsisData::ProcessAttributes(QDomElement& xmlElement)
{
   // Parse and save attributes
   QDomNamedNodeMap attr = xmlElement.attributes();
   int size = attr.size();
   if (!size)
   {
      return false; // Error
   }

   for (int i = 0; i < size; i++)
   {
      QDomAttr at = attr.item(i).toAttr();
      QString value(at.value());
      int key = getEnumKey("OsisElementAttributes", at.name().toLocal8Bit().constData());

      if (key != -1)
      {
         if (Attribute.contains(key))
         {
            Attribute.remove(key);
         }
         Attribute[key] = value;
      }
      else
      {
         qCritical() << "<" << ElementName << ">:  Unknown attribute: " << at.name() << "=" << value << endl;
      }
   }

   return true;
}
开发者ID:omishukov,项目名称:dsu_osis,代码行数:32,代码来源:osisdata.cpp

示例2: processNodeAttributes

void OnError::processNodeAttributes(const QDomElement &nodeElement)
{
    // process attributes
    QDomNamedNodeMap namedNodeMap = nodeElement.attributes();
    QDomNode domNode = namedNodeMap.item(0);

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

        if (domElement.name() == QLatin1String("Condition"))
            m_condition = domElement.value();
        else if (domElement.name() == QLatin1String("ExecuteTargets"))
            m_executeTargets = domElement.value().split(QLatin1Char(';'));
    }
}
开发者ID:pivonroll,项目名称:VCProjectX,代码行数:15,代码来源:onerror.cpp

示例3: QString

QString QDomAttrProto:: name()         const
{
  QDomAttr *item = qscriptvalue_cast<QDomAttr*>(thisObject());
  if (item)
    return item->name();
  return QString();
}
开发者ID:Wushaowei001,项目名称:xtuple-1,代码行数:7,代码来源:qdomattrproto.cpp

示例4: helperToXmlAddDomElement

static void helperToXmlAddDomElement(QXmlStreamWriter* stream, const QDomElement& element, const QStringList &omitNamespaces)
{
    stream->writeStartElement(element.tagName());

    /* attributes */
    QString xmlns = element.namespaceURI();
    if (!xmlns.isEmpty() && !omitNamespaces.contains(xmlns))
        stream->writeAttribute("xmlns", xmlns);
    QDomNamedNodeMap attrs = element.attributes();
    for (int i = 0; i < attrs.size(); i++)
    {
        QDomAttr attr = attrs.item(i).toAttr();
        stream->writeAttribute(attr.name(), attr.value());
    }

    /* children */
    QDomNode childNode = element.firstChild();
    while (!childNode.isNull())
    {
        if (childNode.isElement())
        {
            helperToXmlAddDomElement(stream, childNode.toElement(), QStringList() << xmlns);
        } else if (childNode.isText()) {
            stream->writeCharacters(childNode.toText().data());
        }
        childNode = childNode.nextSibling();
    }
    stream->writeEndElement();
}
开发者ID:unisontech,项目名称:qxmpp,代码行数:29,代码来源:QXmppServer.cpp

示例5: getDrawerByName

BorderDrawerInterface * BorderDrawersLoader::getDrawerFromSvg(QDomElement & drawerElement)
{
    QMap<QString,QString> properties;
    QDomNamedNodeMap attributes = drawerElement.attributes();
    for (int j = attributes.count()-1; j >= 0; --j)
    {
        QDomAttr attr = attributes.item(j).toAttr();
        if (attr.isNull())
            continue;
        properties.insert(attr.name(), attr.value());
    }
    QString drawerName = properties.take("name");
    if (!instance()->registeredDrawers().contains(drawerName))
        return 0;
    BorderDrawerInterface * drawer = getDrawerByName(drawerName);
    const QMetaObject * meta = drawer->metaObject();
    int count = meta->propertyCount();
    for (int i = 0; i < count; ++i)
    {
        QMetaProperty p = meta->property(i);
        QString value = properties.take(p.name());
        if (value.isEmpty())
            continue;
        p.write(drawer, QVariant(QByteArray::fromBase64(value.toAscii())));
    }
    return drawer;
}
开发者ID:coder89,项目名称:PhotoLayoutsEditor,代码行数:27,代码来源:BorderDrawersLoader.cpp

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

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

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

示例9: readXmlAttributesByTagName

MStriantMap MusicAbstractXml::readXmlAttributesByTagName(const QString &tagName) const
{
    QDomNodeList nodelist = m_ddom->elementsByTagName(tagName);
    QDomNamedNodeMap nodes = nodelist.at(0).toElement().attributes();
    MStriantMap maps;
    for(int i=0; i<nodes.count(); ++i)
    {
        QDomAttr attr = nodes.item(i).toAttr();
        maps[attr.name()] = attr.value();
    }
    return maps;
}
开发者ID:DchunWang,项目名称:TTKMusicplayer,代码行数:12,代码来源:musicabstractxml.cpp

示例10: processNodeAttributes

void ItemDefinitionGroup::processNodeAttributes(const QDomElement &nodeElement)
{
    // process attributes
    QDomNamedNodeMap namedNodeMap = nodeElement.attributes();
    QDomNode domNode = namedNodeMap.item(0);

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

        if (domElement.name() == QLatin1String("Condition"))
            m_condition = domElement.value();
    }
}
开发者ID:pivonroll,项目名称:VCProjectX,代码行数:13,代码来源:itemdefinitiongroup.cpp

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

示例12: processNodeAttributes

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

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

        if (domNode.nodeType() == QDomNode::AttributeNode) {
            QDomAttr domElement = domNode.toAttr();
            m_anyAttribute.insert(domElement.name(), domElement.value());
//            vc_dbg << "Any AttributeNode: name: " << domElement.name() << " value: " << domElement.value();
        }
    }
}
开发者ID:pivonroll,项目名称:VcProjectTree,代码行数:14,代码来源:debuggertool.cpp

示例13: processAttributes

void Item::processAttributes(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("Condition"))
                m_condition = domElement.value();
            else if (domElement.name() == QLatin1String("Include"))
                m_include = domElement.value();
            else if (domElement.name() == QLatin1String("Exclude"))
                m_exclude = domElement.value();
            else if (domElement.name() == QLatin1String("Remove"))
                m_remove = domElement.value();
        }
    }

    m_name = nodeElement.nodeName();
}
开发者ID:pivonroll,项目名称:VCProjectX,代码行数:24,代码来源:item.cpp

示例14: getModAdrFromTag

/**
  * Returns the address attribute of a module.
  */
int ConfigParser::getModAdrFromTag(QDomNamedNodeMap map)
	{
	for(uint j = 1; j <= map.length();j++)
		{
		if(map.item(j-1).isAttr())
			{
			QDomAttr attr = map.item(j-1).toAttr();
			if(attr.name() == MODULE_ATTR_MOD_ADR)
				{
				return attr.value().toInt();
				}
			}
		}
	return -1;
	}
开发者ID:ZSchneidi,项目名称:Projekt-42,代码行数:18,代码来源:configparser.cpp

示例15: addCorrectNS

QDomElement addCorrectNS(const QDomElement &e)
{
	int 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.toElement().namespaceURI() == "" )
		n = n.parentNode();
	QString ns;
	if(n.isNull() || !n.toElement().hasAttribute("xmlns")){
		if (n.toElement().namespaceURI () == ""){
			ns = "jabber:client";
		} else {
			ns = n.toElement().namespaceURI();
		}
	} 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:diger,项目名称:psi-plus-snapshots,代码行数:48,代码来源:xmpp_xmlcommon.cpp


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