RosettaCodeData/Task/XML-Output/Objeck/xml-output.objeck
Ingy döt Net 68f8f3e56b all tasks
2013-04-11 01:07:29 -07:00

31 lines
1,018 B
Text

use XML;
use Structure;
bundle Default {
class Test {
function : Main(args : String[]) ~ Nil {
# list of name
names := Vector->New();
names->AddBack("April"->As(Base));
names->AddBack("Tam O'Shanter"->As(Base));
names->AddBack("Emily"->As(Base));
# list of comments
comments := Vector->New();
comments->AddBack("Bubbly: I'm > Tam and <= Emily"->As(Base));
comments->AddBack("Burns: \"When chapman billies leave the street ...\""->As(Base));
comments->AddBack("Short & shrift"->As(Base));
# build XML document
builder := XMLBuilder->New("CharacterRemarks");
root := builder->GetRoot();
if(names->Size() = comments->Size()) {
each(i : names) {
element := XMLElement->New(XMLElementType->ELEMENT,
names->Get(i)->As(String),
comments->Get(i)->As(String));
root->AddChild(element);
};
};
XMLElement->DecodeString(builder->ToString())->PrintLine();
}
}
}