Import std.data.xml
XmlWriter
class
Public Class XmlWriter
XmlWriter: XML written a part at a time, each element started, given its attributes, its content written, and ended, in order, into a String that Finish gives. An indent above 0 puts each element on a line of its own, but in an element that holds text, from its first text on, as a writer that goes a part at a time can't know of text to come.
Examples
Local writer = XmlWriter()
writer.StartElement("greeting")
writer.Attribute("lang", "en")
writer.Text("hi & bye")
writer.EndElement()
Expect(writer.Finish() == "<greeting lang=\"en\">hi & bye</greeting>")-
A writer that indents each element that many spaces for each it's in, or writes them on one line for 0. Panics when
indentis negative. -
Writes
<?xml version="1.0" encoding="UTF-8"?>. Panics after anything else is written. -
Starts an element named
name. Panics whennameisn't an XML name, or the root element has ended. -
Gives the element just started an attribute. Panics when
nameisn't an XML name, it isn't right after the start or another attribute, the element has an attribute of thatnamealready, orvalueholds a character XML hasn't got. -
Writes
textin the open element. Panics outside one, or whentextholds a character XML hasn't got. -
Writes a CDATA section of
textin the open element, one more each timetextholds "]]>", whose "]]" ends one and '>' starts the next. Panics outside an element, or whentextholds a character XML hasn't got. -
Writes a comment. Panics when
textholds "--", ends with '-', or holds a character XML hasn't got. -
Writes a processing instruction. Panics when
targetisn't an XML name or is xml, ortextholds "?>" or a character XML hasn't got. -
Ends the open element, as
<name/>when it's empty. Panics when none is open. -
What was written. Panics when an element is open, or none was written.
Report an issue with this page or with FutureBlitz on GitHub.