コード例 #1
0
bool StylePersistence::scanDataSingleStyle(VStyle* style, QDomNode &rootNode)
{
    bool isOk = true ;
    mapTokens.clear();
    int nodi = rootNode.childNodes().count();
    //D(printf("sono in assegna con %d nodi\n", nodi));
    for(int i = 0 ; i < nodi ; i ++) {
        QDomNode childNode = rootNode.childNodes().item(i) ;

        if(childNode.isElement()) {
            QDomElement element = childNode.toElement();
            //QString name = element.attribute("name", "");
            //QString description = element.attribute("description", "");
            QString nameSpace = element.attribute("namespace", "");
            if(!nameSpace.isEmpty()) {
                style->setNamespace(nameSpace);
            }
            if(STYLE_ROOT_ELEMENT == element.tagName()) {
                if(!scanStyleData(style, element)) {
                    isOk = false;
                }
            }
            if(isOk) {
                completeStyle(style);
            }
        }
    }//for
    return isOk ;
}//scanData()
コード例 #2
0
bool StylePersistence::scanStyleData(VStyle *style, QDomNode &rootNode)
{
    bool isOk = true ;
    int nodi = rootNode.childNodes().count();
    for(int i = 0 ; i < nodi ; i ++) {
        QDomNode childNode = rootNode.childNodes().item(i) ;
        if(childNode.isElement()) {
            QDomElement element = childNode.toElement();
            QDomNodeList childs = element.childNodes();
            if(STYLESETENTRY_TAGNAME == element.tagName()) {
                if(!collectStyles(style, childs)) {
                    isOk = false;
                }
            } else if(KEYWORDSETENTRY_TAGNAME == element.tagName()) {
                if(!collectKeywords(style, childs)) {
                    isOk = false;
                }
            } else if(IDS_TAGNAME == element.tagName()) {
                if(!collectIds(style, childs)) {
                    isOk = false;
                }
            }
        }//if
    }//for
    return isOk ;
}//scanStyleData()
コード例 #3
0
ファイル: ApiInterface.cpp プロジェクト: kammoh/kactus2
//-----------------------------------------------------------------------------
// Function: ApiInterface::ApiInterface()
//-----------------------------------------------------------------------------
ApiInterface::ApiInterface(QDomNode& node)
    : nameGroup_(node),
      apiType_(),
      dependencyDir_(DEPENDENCY_PROVIDER),
      defaultPos_()
{
    for (int i = 0; i < node.childNodes().count(); ++i)
    {
        QDomNode childNode = node.childNodes().at(i);

        if (childNode.isComment())
        {
            continue;
        }

        if (childNode.nodeName() == "kactus2:apiType")
        {
            apiType_ = VLNV::createVLNV(childNode, VLNV::APIDEFINITION);
        }
        else if (childNode.nodeName() == "kactus2:dependencyDirection")
        {
            dependencyDir_ = str2DependencyDirection(childNode.childNodes().at(0).nodeValue(), DEPENDENCY_PROVIDER);
        }
        else if (childNode.nodeName() == "kactus2:position")
        {
            defaultPos_.setX(childNode.attributes().namedItem("x").nodeValue().toInt());
            defaultPos_.setY(childNode.attributes().namedItem("y").nodeValue().toInt());
        }
    }
}
コード例 #4
0
ファイル: componentgenerator.cpp プロジェクト: kammoh/kactus2
// the constructor
ComponentGenerator::ComponentGenerator(QDomNode &generatorNode):
    Generator(generatorNode),
    scope_(ComponentGenerator::INSTANCE),
    groups_() {

    QDomNamedNodeMap attributeMap = generatorNode.attributes();

    // get the spirit scope attribute
    QString scope = attributeMap.namedItem(QString("spirit:scope")).nodeValue();
    if (scope == QString("entity")) {
        scope_ = ComponentGenerator::ENTITY;
    }
    else {
        scope_ = ComponentGenerator::INSTANCE;
    }

    // go through all the child nodes of the component generator
    for (int i = 0; i < generatorNode.childNodes().count(); ++i) {
        QDomNode tempNode = generatorNode.childNodes().at(i);

        if (tempNode.nodeName() == QString("spirit:group")) {
            QString groupName = tempNode.childNodes().at(0).nodeValue();
            groupName = XmlUtils::removeWhiteSpace(groupName);
            groups_.append(groupName);
        }
    }
}
コード例 #5
0
ファイル: mainwindow.cpp プロジェクト: lomsansnom/IHM_OFELI
void MainWindow::heightXML(QDomNode doc, int *height)
{
    if(!doc.isNull())
    {
        int heightCurrentNode = 0;
        QDomNode docParent = doc;
        while(!docParent.parentNode().isNull())
        {
            docParent = docParent.parentNode();
            heightCurrentNode++;
        }
        if(heightCurrentNode > *height)
        {
            *height = heightCurrentNode;
        }
        if(!doc.childNodes().isEmpty() && (doc.firstChild().toElement().tagName() != "" || doc.firstChild().isComment()))
        {
            QDomNodeList nodeList = doc.childNodes();

            for(int i = 0; i < nodeList.length(); i++)
            {
                heightXML(nodeList.at(i), height);
            }
        }
    }
}
コード例 #6
0
void QQMlDom::removeDefaultNode(QDomElement nDocument, QString element)
{
    QDomNodeList removeList = nDocument.elementsByTagName(element);
    QDomNode rUrl = removeList.at(0);
    qDebug() << "is there a child node ?"  << rUrl.hasChildNodes() <<"  " << rUrl.childNodes().at(0).nodeName() ;
    rUrl.removeChild(rUrl.childNodes().at(0));
}
コード例 #7
0
void GoogleCalendar::dataDownloadComplete(QNetworkReply *rep)
{
    if ((rep->error() != 0) && (rep->error() != QNetworkReply::UnknownContentError))
    {
        fprintf(stderr, QString("HTTP error %1\n").arg(rep->error()).toStdString().c_str());
        return;
    }
    QString content = rep->readAll();
    QDomDocument *xml = new QDomDocument("feed");
    if (!xml->setContent(content))
    {
        fprintf(stderr, ("Unable to open gcal XML from:\n"+webpath.toString()+"\n").toStdString().c_str());
        qDebug() << content;
        return;
    }
    events.clear();
    qDebug() << QString("Loading %1 entries").arg(xml->documentElement().elementsByTagName("entry").count());
    for (int i = 0; i < xml->documentElement().elementsByTagName("entry").count(); ++i) {
        QDomNode event = xml->documentElement().elementsByTagName("entry").at(i);
        QString title = event.firstChildElement("title").text();
        QString content = event.firstChildElement("content").text();
        for (int x = 0; x < event.childNodes().count(); ++x) {
            if (event.childNodes().at(x).nodeName() == "gd:when") {
                QDateTime start = RFC3339::fromString(event.childNodes().at(x).attributes().namedItem("startTime").nodeValue());
                QDateTime end = RFC3339::fromString(event.childNodes().at(x).attributes().namedItem("endTime").nodeValue());
                events.append(new CalendarEvent(title, start, end, content));
            }
        }
    }
    qSort(events.begin(), events.end(), CalendarEventComparator());
    purgePast();
    emit refreshComplete();
    delete xml;
}
コード例 #8
0
bool Lvk::Clue::ScriptParser::parseHeader(QDomElement &header, Clue::Script &script)
{
    bool hasCharacter = false;

    for (int i = 0; i < header.childNodes().size(); ++i) {
        QDomNode node = header.childNodes().item(i);

        if (node.childNodes().isEmpty()) {
            continue;
        }

        QString name = node.nodeName().toLower();
        QString value = node.childNodes().at(0).nodeValue().trimmed();

        if (name == "character") {
            script.character = value;
            hasCharacter = true;
        } else if (name == "scriptnumber") {
            script.number = value.toInt();
        } else {
            m_errMsg = QObject::tr("Unknown tag '%1'").arg(name);
            return false;
        }
    }

    return hasCharacter;
}
コード例 #9
0
ファイル: mainwindow.cpp プロジェクト: lomsansnom/IHM_OFELI
void MainWindow::getTagAttributes(QList<QStandardItem*> *list, QDomNode doc)
{
    //add the tag's name in the list
    QStandardItem *newItem = new QStandardItem(doc.toElement().tagName());
    newItem->setFlags(newItem->flags() & ~Qt::ItemIsEditable);
    list->append(newItem);

    //if the node doesn't have any children, it means there is a value inside the node, we add this value in the list here
    if((!doc.childNodes().item(0).isElement() && doc.hasChildNodes()) && !doc.childNodes().item(0).isComment())
    {
        newItem = new QStandardItem(doc.toElement().text());
        newItem->setFlags(newItem->flags() & ~Qt::ItemIsEditable);
        list->append(newItem);
    }
    //if the node have at least one child, there is no value inside the node so we just had an empty string to the list
    else
    {
        newItem = new QStandardItem("");
        newItem->setFlags(newItem->flags() & ~Qt::ItemIsEditable);
        list->append(newItem);
    }
    //add all the attributes to the list
    for(int i = 0; i < doc.attributes().length(); i++)
    {
        newItem = new QStandardItem(doc.attributes().item(i).toAttr().name() + " : " + doc.attributes().item(i).toAttr().value());
        newItem->setFlags(newItem->flags() & ~Qt::ItemIsEditable);
        list->append(newItem);
    }
}
コード例 #10
0
ファイル: TestBaseLine.cpp プロジェクト: venkatarajasekhar/Qt
bool TestBaseLine::isDeepEqual(const QDomNode &n1, const QDomNode &n2)
{
    if(n1.nodeType() != n2.nodeType())
        return false;

    switch(n1.nodeType())
    {
        case QDomNode::CommentNode:
        /* Fallthrough. */
        case QDomNode::TextNode:
        {
            return static_cast<const QDomCharacterData &>(n1).data() ==
                   static_cast<const QDomCharacterData &>(n2).data();
        }
        case QDomNode::ProcessingInstructionNode:
        {
            return n1.nodeName() == n2.nodeName() &&
                   n1.nodeValue() == n2.nodeValue();
        }
        case QDomNode::DocumentNode:
            return isChildrenDeepEqual(n1.childNodes(), n2.childNodes());
        case QDomNode::ElementNode:
        {
            return n1.localName() == n2.localName()                     &&
                   n1.namespaceURI() == n2.namespaceURI()               &&
                   n1.nodeName() == n2.nodeName()                       && /* Yes, this one is needed in addition to localName(). */
                   isAttributesEqual(n1.attributes(), n2.attributes())  &&
                   isChildrenDeepEqual(n1.childNodes(), n2.childNodes());
        }
        /* Fallthrough all these. */
        case QDomNode::EntityReferenceNode:
        case QDomNode::CDATASectionNode:
        case QDomNode::EntityNode:
        case QDomNode::DocumentTypeNode:
        case QDomNode::DocumentFragmentNode:
        case QDomNode::NotationNode:
        case QDomNode::BaseNode:
        case QDomNode::CharacterDataNode:
        {
            Q_ASSERT_X(false, Q_FUNC_INFO,
                       "An unsupported node type was encountered.");
            return false;
        }
        case QDomNode::AttributeNode:
        {
            Q_ASSERT_X(false, Q_FUNC_INFO,
                       "This should never happen. QDom doesn't allow us to compare DOM attributes "
                       "properly.");
            return false;
        }
        default:
        {
            Q_ASSERT_X(false, Q_FUNC_INFO, "Unhandled QDom::NodeType value.");
            return false;
        }
    }
}
コード例 #11
0
ファイル: xmlutils.cpp プロジェクト: Krenair/huggle3-qt-lx
static void RecursiveFetch(QDomNode node, QList<QDomElement> *list)
{
    list->append(node.toElement());
    int index = 0;
    while (index < node.childNodes().count())
    {
        QDomNode nx = node.childNodes().at(index++);
        RecursiveFetch(nx, list);
    }
}
コード例 #12
0
/**
 * @brief XmlEditWidgetPrivate::findDomNodeScan find the nearest match to a position
 * @param node
 * @param nodeTarget
 * @param lineSearched
 * @param columnSearched
 * @param lastKnownNode: last known "good" position
 * @return
 */
bool XmlEditWidgetPrivate::findDomNodeScan(QDomNode node, QDomNode nodeTarget, const int lineSearched, const int columnSearched, FindNodeWithLocationInfo &info)
{
    int row = node.lineNumber();
    int col = node.columnNumber();
    if(!node.isDocument()) {
        if((lineSearched == row) && (columnSearched == col)) {
            info.matchedNode = nodeTarget ;
            return true ;
        }

        if((lineSearched == row) && (columnSearched == col)) {
            info.matchedNode = nodeTarget ;
            return true ;
        }
        if((lineSearched == row) && (columnSearched < col)) {
            info.matchedNode = nodeTarget ;
            return true ;
        }
        if((lineSearched < row)) {
            info.matchedNode = nodeTarget ;
            return true ;
        }
        if((lineSearched <= row)) {
            info.lastKnownNode = nodeTarget ;
        }

        if(node.nodeType() == QDomNode::ElementNode) {
            QDomElement element = node.toElement();
            QDomNamedNodeMap attributes = element.attributes();
            int numAttrs = attributes.length();
            for(int i = 0 ; i < numAttrs ; i++) {
                QDomNode node = attributes.item(i);
                QDomAttr attr = node.toAttr();
                if(findDomNodeScan(attr, nodeTarget, lineSearched, columnSearched, info)) {
                    return true;
                }
            } // for
        }
    }

    int nodes = node.childNodes().count();
    for(int i = 0 ; i < nodes ; i ++) {
        QDomNode childNode = node.childNodes().item(i) ;
        if(childNode.isText() || childNode.isCDATASection()) {
            if(findDomNodeScan(childNode, nodeTarget, lineSearched, columnSearched, info)) {
                return true;
            }
        } else {
            if(findDomNodeScan(childNode, childNode, lineSearched, columnSearched, info)) {
                return true ;
            }
        }
    }
    return false ;
}
コード例 #13
0
void treubug::print_dom(QDomNode in, int ind){
	QString a="";
	for(int i=0; i<ind; i++)
		a+="--------";
	qDebug("%s%s(%s)", a.ascii(), in.toElement().tagName().ascii(), in.toElement().text().ascii());
	if(in.childNodes().length()==1)
		return;
	for(unsigned int i=0 ; i<in.childNodes().length(); i++){
		print_dom(in.childNodes().item(i), ind+1);
	}
}
コード例 #14
0
ファイル: btfactory.cpp プロジェクト: KDE/gluon
void btFactory::initNodeType(QDomNode xmlNode)
{
    QDomNamedNodeMap nodeTypeAttributes = xmlNode.attributes();
    btNode* nodeType = btFactory::instance()->getRegisteredNodeType(nodeTypeAttributes.namedItem("className").nodeValue());
    
    if(!nodeType)
    {
        nodeType = new btNode();
        nodeType->setType(btNode::UnusableNodeType);
        btFactory::instance()->registerNodeType(nodeType, nodeTypeAttributes.namedItem("className").nodeValue());
    }
    else
    {
        QString typeCategory = nodeTypeAttributes.namedItem("category").nodeValue();
    
        if(typeCategory == "action")
        {
            nodeType->setType(btNode::ActionNodeType);
        }
        else if(typeCategory == "condition")
        {
            nodeType->setType(btNode::ConditionNodeType);
        }
        else if(typeCategory == "composite")
        {
            nodeType->setType(btNode::CompositeNodeType);
        }
        else if(typeCategory == "decorator")
        {
            nodeType->setType(btNode::DecoratorNodeType);
        }
        else if(typeCategory == "reference")
        {
            nodeType->setType(btNode::ReferenceNodeType);
        }
        else
        {
            nodeType->setType(btNode::UnusableNodeType);
        }
    }
    
    nodeType->setName(nodeTypeAttributes.namedItem("name").nodeValue());
    nodeType->setDescription(nodeTypeAttributes.namedItem("description").nodeValue());
    nodeType->setClassName(nodeTypeAttributes.namedItem("className").nodeValue());
    
    for(int j = 0; j < xmlNode.childNodes().count(); j++)
    {
        QDomNode currentProperty = xmlNode.childNodes().at(j);
        QDomNamedNodeMap propertyAttributes = currentProperty.attributes();
        nodeType->setProperty(propertyAttributes.namedItem("name").nodeValue().toUtf8(), propertyAttributes.namedItem("datatype").nodeValue());
    }    
    
}
コード例 #15
0
DomItem *DomItem::child(int i)
{
    if (childItems.contains(i))
        return childItems[i];

    if (i >= 0 && i < domNode.childNodes().count()) {
        QDomNode childNode = domNode.childNodes().item(i);
        DomItem *childItem = new DomItem(childNode, i, this);
        childItems[i] = childItem;
        return childItem;
    }
    return 0;
}
コード例 #16
0
bool TestCase::loadXmlInformation()
{
    QDomNodeList nodeList = xmlNode.childNodes();
    for(int i = 0; i < nodeList.count(); i++){
        QDomNode nd = nodeList.at(i);
        if(nd.childNodes().count() > 0){
            if(nd.nodeName() == "Name")
                testName = nd.firstChild().nodeValue();
            else if(nd.nodeName() == "InterfaceHeader")
                iheader = getTestFileFolder() + "/" + nd.firstChild().nodeValue();
            else if(nd.nodeName() == "CompareHeader")
                header = getTestFileFolder() + "/" + nd.firstChild().nodeValue();
            else if(nd.nodeName() == "ExpectedResult"){
                QDomNodeList chnodeList = nd.childNodes();
                for(int b = 0; b < chnodeList.count(); b++){
                    QDomNode chnd = chnodeList.at(b);
                    if(chnd.childNodes().size() > 0)
                        expectedResult << chnd.firstChild().nodeValue();
                }
            }
        }
    }
    
    // check if we have all informations
    QTextStream out(&errorMsg);
    if(testName.size() <= 0)
        out << "No test name defined. Error in Test.xml file!" << endl;
    if(iheader.size() <= 0)
        out << "No interface header defined. Error in Test.xml file!" << endl;
    if(header.size() <= 0)
        out << "No compare header defined. Error in Test.xml file!" << endl;
    if(errorMsg.size() > 0)
        return false;

    //check if the headers are available
    QFile ichfile(iheader);
    if (!ichfile.exists()){
        out << iheader << " file not found on drive." << endl;
    }
    QFile chfile(header);
    if (!chfile.exists()){
        out << header << " file not found on drive." << endl;
    }
    if(errorMsg.size() > 0)
        return false;

    return true;
}
コード例 #17
0
ファイル: classepub.cpp プロジェクト: kovax3/elkirtasse
void classepub::getChild(QDomNode node,QTreeWidgetItem *item)
{
    int count=    node.childNodes().count();
     if(count<1)return;

      QDomElement itemElement=node.toElement();
     int i=itemElement.childNodes().count();
    QTreeWidgetItem *itemChild=new QTreeWidgetItem(item);
        QString titleE;
        QString idE;
        for(int r=0;r< i;r++){

            QDomNode item=itemElement.childNodes().item(r);

            if( item.toElement().nodeName()=="navLabel"){

                     titleE=(item.toElement().text());

            }
            if( item.toElement().nodeName()=="content"){

                      idE=item.toElement().attribute("src").section("#",0,0);
            }
            if( item.toElement().nodeName()=="navPoint"){
           QDomNode itemCild=item.toElement();
                getChild(  itemCild,itemChild);
            }
        }
          //  m_listEpub.append(titleE+"|"+idE+"|"+QString::number(lvl));
   QFileInfo fi(m_tocPath);
        itemChild->setText(0,titleE);
        itemChild->setData(0,1,fi.path()+"/"+idE);
}
コード例 #18
0
/**
 * Constructs stream-error object from a DOM element.
 *
 * @param element   \<stream:error/\> DOM element.
 */
StreamError::StreamError(const QDomElement& element)
    : d(new Private)
{
    QDomNode root = d->doc.importNode(element, true);
    d->doc.appendChild(root);

    QDomNodeList childs = root.childNodes();
    for (int i = 0; i < childs.count(); ++i) {
        QDomElement element = childs.item(i).toElement();
        if (element.namespaceURI() == NS_STREAMS) {
            int condition = Private::stringToCondition(element.tagName() );
            if ( condition != -1 ) {
                d->errorCondition = element;
                break;
            }
        }
    }

    QDomElement eText = root.firstChildElement("text");
    if (eText.namespaceURI() == NS_STREAMS) {
        d->text = eText;
    }

    for (int i = 0; i < childs.count(); ++i) {
        QDomElement element = childs.item(i).toElement();
        /* first element outside NS_STREAMS ns will be an app-specific error condition */
        if (element.namespaceURI() != NS_STREAMS) {
            d->appSpec = element;
        }
    }
}
コード例 #19
0
void AView::read(QDomNode &element)
{
  QDomNodeList nodeList = element.childNodes();

  for(int i = 0; i < nodeList.count(); ++i) {
    QDomNode node = nodeList.item(i);
    if(!node.isElement())
      continue;
    QDomElement element = node.toElement();

    QString name = node.nodeName();
    AView* newView = createView(name, this);
    if(!newView)
      continue;
    childs.append(newView);
    newView->read(element);
  }

    QDomElement e = element.toElement();
    id = e.attribute("android:id");
    id = explodeName(id);
    id = captializeName(id);

    width = QString::number(atof(qPrintable(e.attribute("android:layout_width"))));
    height = QString::number(atof(qPrintable(e.attribute("android:layout_height"))));
}
コード例 #20
0
ファイル: classepub.cpp プロジェクト: kovax3/elkirtasse
void classepub::epubGetChild( QDomNode item,int lvl)
{

int count=    item.childNodes().count();
 if(count<1)return;
 lvl++;
  QDomElement itemElement=item.toElement();
 int i=itemElement.childNodes().count();

    QString titleE;
    QString idE;
    for(int r=0;r< i;r++){

        QDomNode item=itemElement.childNodes().item(r);

        if( item.toElement().nodeName()=="navLabel"){

                 titleE=(item.toElement().text());

        }
        if( item.toElement().nodeName()=="content"){

                  idE=item.toElement().attribute("src").section("#",0,0);
        }
        if( item.toElement().nodeName()=="navPoint"){
       QDomNode itemCild=item.toElement();
            epubGetChild(  itemCild,lvl);
        }
    }
        m_listEpub.append(titleE+"|"+idE+"|"+QString::number(lvl));
}
コード例 #21
0
ファイル: returninstruction.cpp プロジェクト: ktos/nsbuilder
bool ReturnInstruction::setAsXMLNode(QDomNode& node)
{
    if (node.hasChildNodes()) {
        QDomNodeList nodeList = node.childNodes();

        for (unsigned i = 0; i < nodeList.length(); i++) {
            QDomElement e = nodeList.item(i).toElement();

            if (!e.isNull()) {
                if (e.tagName() == "text") {
                    QDomNode t = e.firstChild();
                    setContents(t.nodeValue());
                } else if (e.tagName() == "comment") {
                    QDomNode t = e.firstChild();
                    setComment(t.nodeValue());
                }
            }
        }
    } else {
        // tekst, komentarz i pixmapa puste
    }

    validateContents();

    return true;
}
コード例 #22
0
ファイル: osdparser.cpp プロジェクト: ShermanHuang/kdesdk
QStringList OsdParser::parseStructureNames()
{
    QStringList ret;
    QDomNode rootElem = mDocument.firstChildElement(QLatin1String("data"));
    QDomNodeList nodes = rootElem.childNodes();
    for (uint i = 0; i < nodes.length(); ++i)
    {
        QDomElement elem = nodes.at(i).toElement(); // try to convert the node to an element.
        if (!elem.isNull())
        {
            //      kDebug() << "element tag: " << elem.tagName();
            //e is element
            QString tag = elem.tagName();
            if (tag == QLatin1String("struct")
                || tag == QLatin1String("array")
                || tag == QLatin1String("bitfield")
                || tag == QLatin1String("primitive")
                || tag == QLatin1String("union")
                || tag == QLatin1String("enum")
                || tag == QLatin1String("flags")
                || tag == QLatin1String("string"))
                ret.append(elem.attribute(QLatin1String("name"), QLatin1String("<invalid name>")));
        }
    }
    return ret;
}
コード例 #23
0
ファイル: xaman.cpp プロジェクト: alejandrogamezg/Xaman
void Xaman::listToPlaylist(int index)
{
    //Enviar toda la lista predefinida a la reproduccion actual
    QDomDocument playlist;
    QFile file (QDir::currentPath() + "/PlayList/ListasdeReproduccion.xml");
    if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
        //return -1;
    }else{
        if(!playlist.setContent(&file)){
          //return -1;
        }
        file.close();
    }
    QDomElement root = playlist.firstChildElement();
    QDomNodeList items= root.elementsByTagName("List");
    QDomNode itm = items.at(index);
    QDomNodeList child = itm.childNodes();

    //SE obtienen los item de la lista y se recorren de manera individual
    for (int i = 0; i<child.count(); i++){
        QDomNode node = child.at(i);
        if(node.isElement()){
            QDomElement element = node.toElement();

            //Se inserta el item en la lista actual de reproduccion
            ui->widget->player->playlist()->addMedia(QUrl::fromLocalFile(element.attribute("href")));
            if(ui->widget->player->playlist()->isEmpty()){
                ui->widget->player->play();
                ui->widget->player->pause();
            }
        }
    }
}
コード例 #24
0
ファイル: SvtSoap.cpp プロジェクト: SiteView/genieautorun
void parseNode(QDomNode &node,QMap<QString, QString> *retmap)
{
    if (node.isNull() || !node.isElement())
    {
      return;
    }
    QDomElement elem = node.toElement();
    if(node.firstChild().isElement())
    {
        QDomNodeList children=node.childNodes();
        int c=children.count();
        for(int i=0;i<c;i++)
        {
            QDomNode cn=children.item(i);
            parseNode(cn,retmap);

        }
        return;
    }
    QString tagname=node.toElement().tagName();
    int pos=tagname.indexOf(":");
    if(pos >=0)
    {
        tagname=tagname.right(tagname.length() - pos - 1);
    }
    retmap->insert(tagname,node.toElement().text());

}
コード例 #25
0
QDomNodeList QDomNodeProto:: childNodes() const
{
  QDomNode *item = qscriptvalue_cast<QDomNode*>(thisObject());
  if (item)
    return item->childNodes();
  return QDomNodeList();
}
コード例 #26
0
ファイル: KReportItemCheck.cpp プロジェクト: KDE/kreport
KReportItemCheckBox::KReportItemCheckBox(const QDomNode &element)
{
    createProperties();
    QDomNodeList nl = element.childNodes();
    QString n;
    QDomNode node;

    nameProperty()->setValue(element.toElement().attribute(QLatin1String("report:name")));
    m_controlSource->setValue(element.toElement().attribute(QLatin1String("report:item-data-source")));
    setZ(element.toElement().attribute(QLatin1String("report:z-index")).toDouble());
    m_foregroundColor->setValue(QColor(element.toElement().attribute(QLatin1String("fo:foreground-color"))));
    m_checkStyle->setValue(element.toElement().attribute(QLatin1String("report:check-style")));
    m_staticValue->setValue(QVariant(element.toElement().attribute(QLatin1String("report:value"))).toBool());

    parseReportRect(element.toElement());

    for (int i = 0; i < nl.count(); i++) {
        node = nl.item(i);
        n = node.nodeName();

        if (n == QLatin1String("report:line-style")) {
            KReportLineStyle ls;
            if (parseReportLineStyleData(node.toElement(), &ls)) {
                m_lineWeight->setValue(ls.width());
                m_lineColor->setValue(ls.color());
                m_lineStyle->setValue(QPen(ls.penStyle()));
            }
        } else {
            kreportpluginWarning() << "while parsing check element encountered unknow element: " << n;
        }
    }

}
コード例 #27
0
ファイル: vielement.cpp プロジェクト: EQ4/Visore
void ViElement::fromDom(QDomNode &dom)
{
	setName(dom.toElement().tagName());
	QDomNamedNodeMap attributes = dom.attributes();
	for(int i = 0; i < attributes.size(); ++i)
	{
		addAttribute(ViAttribute(attributes.item(i).nodeName(), attributes.item(i).nodeValue()));
	}
	QDomNodeList children = dom.childNodes();
	if(children.size() > 0)
	{
		for(int i = 0; i < children.size(); ++i)
		{
			if(children.item(i).isText())
			{
				setValue(children.item(i).nodeValue());
			}
			else
			{
				ViElement child;
				QDomNode node = children.item(i);
				child.fromDom(node);
				addChild(child);
			}
		}
	}
	else
	{
		setValue(dom.nodeValue());
	}
}
コード例 #28
0
ファイル: reportsection.cpp プロジェクト: Wushaowei001/xtuple
void ReportSection::initFromXML(QDomNode & section) {
    QDomNodeList nl = section.childNodes();
    QDomNode node;
    QString n;
    for(unsigned int i = 0; i < nl.count(); i++) {
        node = nl.item(i);
        n = node.nodeName();
        if(n == "height") {
            double h = node.firstChild().nodeValue().toDouble() / 100.0;
            h *= dpiY;
            canvas->resize(canvas->width(),(int)h);
        } else if(n == "label") {
            (new ReportEntityLabel(node, canvasview->document(), canvas))->setVisible(TRUE);
        } else if(n == "field") {
            (new ReportEntityField(node, canvasview->document(), canvas))->setVisible(TRUE);
        } else if(n == "text") {
            (new ReportEntityText(node, canvasview->document(), canvas))->setVisible(TRUE);
        } else if(n == "line") {
            (new ReportEntityLine(node, canvasview->document(), canvas))->setVisible(TRUE);
        } else if(n == "barcode") {
            (new ReportEntityBarcode(node, canvasview->document(), canvas))->setVisible(TRUE);
        } else if(n == "image") {
            (new ReportEntityImage(node, canvasview->document(), canvas))->setVisible(TRUE);
        } else if(n == "graph") {
            (new ReportEntityGraph(node, canvasview->document(), canvas))->setVisible(TRUE);
        } else if(n == "key" || n == "firstpage" || n == "lastpage"
                    || n == "odd" || n == "even") {
            // these are all handled elsewhere but we don't want to show errors
            // because they are expected sometimes
        } else {
            qDebug("Encountered unknown node while parsing section: %s", n.latin1());
        }
    }
}
コード例 #29
0
QString TextFormatter::getFormattedSection(QDomNode sectionNode)
{
    QDomNodeList itemChildNodes = sectionNode.childNodes();
    QString formattedSection = "";

    for(int i = 0; i < itemChildNodes.length(); i++)
    {
        QDomNode currentNode = itemChildNodes.at(i);
        QString nodeName = currentNode.nodeName();

        if(nodeName.compare("header") == 0)
        {
            formattedSection += getFormattedHeader(currentNode);
        }
        else if(nodeName.compare("description") == 0)
        {
            formattedSection += getFormattedDescription(currentNode);
        }
        else if(nodeName.compare("list") == 0)
        {
            formattedSection += getFormattedList(currentNode);
        }
    }

    formattedSection.append("<br/>");

    return formattedSection;
}
コード例 #30
0
KoReportItemMaps::KoReportItemMaps(QDomNode & element)
{
    myDebug() << "======" << this;
    createProperties();
    QDomNodeList nl = element.childNodes();
    QString n;
    QDomNode node;

    m_name->setValue(element.toElement().attribute("report:name"));
    m_controlSource->setValue(element.toElement().attribute("report:item-data-source"));
    //m_resizeMode->setValue(element.toElement().attribute("report:resize-mode", "stretch"));
    Z = element.toElement().attribute("report:z-index").toDouble();

    parseReportRect(element.toElement(), &m_pos, &m_size);
    myDebug() << "====== childgren:";
    for (int i = 0; i < nl.count(); i++) {
        node = nl.item(i);
        n = node.nodeName();

//         if (n == "report:Maps-data") {
// 
//             setInlineImageData(node.firstChild().nodeValue().toLatin1());
//         } else {
            kDebug() << "====== while parsing image element encountered unknow element: " << n;
//         }
    }
    m_mapImage = new QImage(m_size.toScene().toSize(), QImage::Format_ARGB32);
    m_mapImage->fill(QColor(200, 150, 5).rgb());
}