本文整理汇总了C++中QDomDocument::attributes方法的典型用法代码示例。如果您正苦于以下问题:C++ QDomDocument::attributes方法的具体用法?C++ QDomDocument::attributes怎么用?C++ QDomDocument::attributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDomDocument
的用法示例。
在下文中一共展示了QDomDocument::attributes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: attributes
QDomNamedNodeMap QDomDocumentProto::attributes() const
{
QDomDocument *item = qscriptvalue_cast<QDomDocument*>(thisObject());
if (item)
return item->attributes();
return QDomNamedNodeMap();
}
示例2: if
bool MoDeL1Parser::parse(DesignerModelComponent* model, QDomDocument& doc)
{
QList<parseTask> taskList;
taskList.push_back(parseTask(QDomElement(), model->getEngine()->globalObject(), 0));
size_t curTask = 0;
while(curTask<(size_t)taskList.size())
{
switch(taskList[curTask].taskHint)
{
case 0: //
{
//defaultAction
//standardObject
QDomDocument curElem = doc;
//create object.
QScriptValue newItemValue = model->getEngine()->newObject();
newItemValue.setProperty("*tag*", curElem.nodeName());
//[write properties]
for(int attrIndex = 0 ; attrIndex < curElem.attributes().count(); attrIndex++)
{
{
newItemValue.setProperty( curElem.attributes().item(attrIndex).nodeName(), curElem.attributes().item(attrIndex).nodeValue());
}
}
//[write children objects]
for(QDomElement childElem = curElem.firstChildElement();
!childElem.isNull(); childElem = childElem.nextSiblingElement())
{
if(childElem.nodeName()=="MoDeL")
{
taskList.push_back(parseTask(childElem, newItemValue, 1));
}
else
{
taskList.push_back(parseTask(childElem, newItemValue, (size_t)-1));
}
}
}
break;
case 1: //#object$standardObject~/model
{
//standardObject
QDomElement curElem = taskList[curTask].taskElem;
//create object.
QScriptValue newItemValue = model->getEngine()->newObject();
newItemValue.setProperty("*tag*", curElem.nodeName());
//[write properties]
for(int attrIndex = 0 ; attrIndex < curElem.attributes().count(); attrIndex++)
{
{
newItemValue.setProperty( curElem.attributes().item(attrIndex).nodeName(), curElem.attributes().item(attrIndex).nodeValue());
}
}
//[write children objects]
for(QDomElement childElem = curElem.firstChildElement();
!childElem.isNull(); childElem = childElem.nextSiblingElement())
{
if(childElem.nodeName()=="dbInterface")
{
taskList.push_back(parseTask(childElem, newItemValue, 2));
}
else
{
taskList.push_back(parseTask(childElem, newItemValue, (size_t)-1));
}
}
QScriptValue curTargetItem = model->getEngine()->globalObject();
writeValueToModel(newItemValue, curTargetItem, "/model");
}
break;
case 2: //#object$ignoreThis
{
//skipThis
QScriptValue newItemValue = taskList[curTask].taskParent;
QDomElement curElem = taskList[curTask].taskElem;
//[write children objects]
for(QDomElement childElem = curElem.firstChildElement();
!childElem.isNull(); childElem = childElem.nextSiblingElement())
{
if(childElem.nodeName()=="input")
{
taskList.push_back(parseTask(childElem, newItemValue, 3));
}
else
{
taskList.push_back(parseTask(childElem, newItemValue, (size_t)-1));
}
}
}
break;
case 3: //#object$ignoreThis
{
//skipThis
QScriptValue newItemValue = taskList[curTask].taskParent;
QDomElement curElem = taskList[curTask].taskElem;
//[write children objects]
for(QDomElement childElem = curElem.firstChildElement();
!childElem.isNull(); childElem = childElem.nextSiblingElement())
//.........这里部分代码省略.........