C++ (Qt) QDomNode node = root.firstChild(); while (!node.isNull()) { QDomElement element = node.toElement(); if (node.toElement().tagName() == "currentTime") { qDebug() <<"currentTime: " << element.text(); } else if (node.toElement().tagName() == "cachedUntil") { qDebug() << element.tagName() << " " << element.text(); } else if (node.toElement().tagName() == "result") { qDebug() << element.tagName(); QDomNode firstChildNode = node.firstChild(); while (!firstChildNode.isNull()) { QDomElement secondElement = firstChildNode.toElement(); if (firstChildNode.toElement().tagName() == "rowset") { qDebug() << secondElement.tagName() << " " << secondElement.attribute("name"); QDomNode secondChildNode = firstChildNode.firstChild(); while (!secondChildNode.isNull()) { QDomElement thirdElement = secondChildNode.toElement(); if (secondChildNode.toElement().tagName() == "row") { qDebug() << thirdElement.tagName(); qDebug () <<thirdElement.attribute ("name") << " " << thirdElement.attribute("characterID") << " " << thirdElement.attribute("corporationName") << " " << thirdElement.attribute ("corporationID"); secondChildNode = secondChildNode.nextSibling(); } } } firstChildNode = firstChildNode.nextSibling(); } } node= node.nextSibling(); }
XML<?xml version='1.0' encoding='UTF-8'?><eveapi version="2"> <currentTime>2012-07-13 14:07:53</currentTime> <result> <rowset name="characters" key="characterID" columns="name,characterID,corporationName,corporationID"> <row name="sotona" characterID="9999999999" corporationName="paravoz" corporationID="88888888" /> </rowset> </result> <cachedUntil>2012-07-13 15:04:53</cachedUntil></eveapi>