RosettaCodeData/Task/XML-Output/NetRexx/xml-output-3.netrexx

49 lines
1022 B
Plaintext

/* NetRexx */
options replace format comments java crossref savelog symbols nobinary
import java.io.StringWriter
import javax.xml.stream.XMLOutputFactory
import javax.xml.stream.XMLStreamWriter
names = [String -
"April", "Tam O'Shanter", "Emily" -
]
remarks = [ String -
"Bubbly: I'm > Tam and <= Emily" -
, 'Burns: "When chapman billies leave the street ..."' -
, 'Short & shrift' -
]
do
buffer = StringWriter()
out = XMLOutputFactory.newInstance().createXMLStreamWriter(buffer)
out.writeStartDocument("UTF-8", "1.0")
out.writeCharacters('\n')
out.writeStartElement("CharacterRemarks")
out.writeCharacters('\n')
loop i_ = 0 to names.length - 1
out.writeStartElement("Character")
out.writeAttribute("name", names[i_])
out.writeCharacters(remarks[i_])
out.writeEndElement()
out.writeCharacters('\n')
end i_
out.writeEndElement()
out.writeEndDocument()
out.writeCharacters('\n')
say buffer.toString
catch ex = Exception
ex.printStackTrace
end
return