Anonymous user
XML/Input: Difference between revisions
→{{header|C++}}
No edit summary |
|||
Line 214:
=={{header|C++}}==
<lang c++
/*
Using the Qt library's XML parser.
*/
#include <iostream>
#include <QDomDocument>
int main( ) {▼
#include <QObject>
const std::string input( "<Students>\n"▼
"<Student Name=\"April\" Gender=\"F\" DateOfBirth=\"1989-01-02\" />\n"▼
"<Student Name=\"Bob\" Gender=\"M\" DateOfBirth=\"1990-03-04\" />\n"▼
"<Student Name=\"Chad\" Gender=\"M\" DateOfBirth=\"1991-05-06\" />\n"▼
"<Student Name=\"Dave\" Gender=\"M\" DateOfBirth=\"1992-07-08\">\n"▼
"<Pet Type=\"dog\" Name=\"Rover\" />\n"▼
"</Student>\n"▼
"<Student DateOfBirth=\"1993-09-10\" Gender=\"F\" Name=\"Émily\" />\n"▼
"</Students>") ;▼
'\n' ;▼
}▼
}</lang>▼
QDomDocument doc;
doc.setContent(
QObject::tr(
QDomElement n = doc.documentElement().firstChildElement("Student");
while(!n.isNull()) {
std::cout << qPrintable(n.attribute("Name")) << std::endl;
n = n.nextSiblingElement();
▲ }
}
=={{header|Common Lisp}}==
|