File: xml2bdb.cpp

package info (click to toggle)
libqxt 0.6.1-6
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 19,004 kB
  • sloc: cpp: 57,512; xml: 296; sh: 251; makefile: 56; php: 14
file content (51 lines) | stat: -rw-r--r-- 963 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "xml2bdb.h"
#include <QApplication>

Xml2Bdb::Xml2Bdb() : QXmlStreamReader()
{
}

void Xml2Bdb::read(QxtBdbTreeIterator<XmlNode> root)
{
    while (!atEnd())
    {
        readNext();
        if (isStartElement())
        {
            readElement(root);
        }
    }
}

void Xml2Bdb::readElement(QxtBdbTreeIterator<XmlNode> i)
{

    XmlNode x;
    x.name=name().toString();
    x.value=text().toString();
    x.type=tokenType();
    i=i.append(x);

    while (!atEnd()) 
    {
        QApplication::processEvents ();
        readNext();
        if (isEndElement())
            break;
        else if (isStartElement())
        {
            readElement(i);
        }
        else
        {
            if(text().toString().simplified().isEmpty())
                continue;
            XmlNode x;
            x.name=name().toString();
            x.value=text().toString();
            x.type=tokenType();
            i.append(x);
        }
    }
}