예제 #1
0
void WeatherData::processFact()
{
    if (!xmlReader.isStartElement() || xmlReader.name() != "fact")
        return;

    while (xmlReader.readNextStartElement()) {
        if (xmlReader.name() == "pressure")
            pressure = readNextText();
        else if (xmlReader.name() == "wind_speed")
        {
            wind_speed = readNextText();
        }

#ifndef USE_READ_ELEMENT_TEXT
        xmlReader.skipCurrentElement();
#endif
    }
}
예제 #2
0
void WeatherData::processHour()
{
    if (!xmlReader.isStartElement() || xmlReader.name() != "hour")
        return;

    while (xmlReader.readNextStartElement()) {
        if(xmlReader.name() == "temperature")
            temperature = readNextText();
    }

}
예제 #3
0
void XmlRateReader::processRate() {
    if (!xml.isStartElement() || xml.name() != "rate")
        return;

    QString from;
    QString to;
    QString conversion;
    while (xml.readNextStartElement()) {
        if (xml.name() == "from")
            from = readNextText();
        else if (xml.name() == "to")
            to = readNextText();
        else if (xml.name() == "conversion")
            conversion = readNextText();
#ifndef USE_READ_ELEMENT_TEXT
        xml.skipCurrentElement();
#endif
    }

    if (!(from.isEmpty() || to.isEmpty() || conversion.isEmpty()))
        Currency::addRate(from, to, conversion);
}