Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
27
Task/XML-Input/Objeck/xml-input.objeck
Normal file
27
Task/XML-Input/Objeck/xml-input.objeck
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
use XML;
|
||||
|
||||
bundle Default {
|
||||
class Test {
|
||||
function : Main(args : String[]) ~ Nil {
|
||||
in := String->New();
|
||||
in->Append("<Students>");
|
||||
in->Append("<Student Name=\"April\" Gender=\"F\" DateOfBirth=\"1989-01-02\" />");
|
||||
in->Append("<Student Name=\"Bob\" Gender=\"M\" DateOfBirth=\"1990-03-04\" />");
|
||||
in->Append("<Student Name=\"Chad\" Gender=\"M\" DateOfBirth=\"1991-05-06\" />");
|
||||
in->Append("<Student Name=\"Dave\" Gender=\"M\" DateOfBirth=\"1992-07-08\">");
|
||||
in->Append("<Pet Type=\"dog\" Name=\"Rover\" />");
|
||||
in->Append("</Student>");
|
||||
in->Append("<Student DateOfBirth=\"1993-09-10\" Gender=\"F\" Name=\"Émily\" /></Students>");
|
||||
|
||||
parser := XmlParser->New(in);
|
||||
if(parser->Parse()) {
|
||||
root := parser->GetRoot();
|
||||
children := root->GetChildren("Student");
|
||||
each(i : children) {
|
||||
child : XMLElement := children->Get(i)->As(XMLElement);
|
||||
XMLElement->DecodeString(child->GetAttribute("Name"))->PrintLine();
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue