xml¶
meth xml::parse(String: address): xmlReturns
Stringparsed into an XML node.meth xml::parse(String: address, Arg₂: xml::flags): xmlReturns
Stringparsed into an XML node.meth xml::parse(Stream: stream): xmlReturns the contents of
Streamparsed into an XML node.meth xml::parse(Stream: stream, Arg₂: xml::flags): xmlReturns the contents of
Streamparsed into an XML node.fun xml::escape(String: string): stringEscapes characters in
String.import: xml("fmt/xml") xml::escape("\'1 + 2 > 3 & 2 < 4\'") :> "\'1 + 2 > 3 & 2 < 4\'"
meth (Arg₁: visitor):copy(Arg₂: xml::element)TBD
meth (Arg₁: visitor):copy(Arg₂: xml::text)TBD
meth (Arg₁: visitor):visit(Arg₂: xml::element)TBD
type xmlAn XML node.
meth xml(Stream: stream): xmlReturns the contents of
Streamparsed into an XML node.meth xml(Stream: stream, Arg₂: xml::flags): xmlReturns the contents of
Streamparsed into an XML node.meth xml(String: string): xmlReturns
Stringparsed into an XML node.meth xml(String: string, Arg₂: xml::flags): xmlReturns
Stringparsed into an XML node.meth xml(Tag: symbol, ...): xmlReturns a new xml element with tag
Tag, adding attributes and children asxml::element(...).meth (Xml: xml) / (Fn: function): sequenceReturns a sequence of the children of
Xmlfor whichFn(Child)is non-nil.meth (Xml: xml) / (Attribute₁ is Value₁, ...): sequenceReturns a sequence of the children of
XmlwithAttribute₁ = Value₁, etc.meth (Xml: xml) / (Tag: string): sequenceReturns a sequence of the children of
Xmlwith tagTag.meth (Xml: xml) / (Tag: string, Attribute₁ is Value₁, ...): sequenceReturns a sequence of the children of
Xmlwith tagTagandAttribute₁ = Value₁, etc.meth (Xml: xml) // (Fn: function): sequenceReturns a sequence of the recursive children of
Xmlfor whichFn(Child)is non-nil.meth (Xml: xml) // (Attribute₁ is Value₁, ...): sequenceReturns a sequence of the recursive children of
XmlwithAttribute₁ = Value₁, etc.meth (Xml: xml) // (Tag: string): sequenceReturns a sequence of the recursive children of
Xmlwith tagTag.meth (Xml: xml) // (Tag: string, Attribute₁ is Value₁, ...): sequenceReturns a sequence of the recursive children of
Xmlwith tagTagandAttribute₁ = Value₁, etc.meth <(Xml: xml): xml | nilReturns the previous sibling of
Xmlornil.meth (Xml: xml) < (N: integer): xml | nilReturns the
N-th prev sibling ofXmlornil.meth (Xml: xml) < (Attribute₁ is Value₁, ...): xml | nilReturns the prev sibling of
XmlwithAttribute₁ = Value₁, etc., if one exists, otherwisenil.meth (Xml: xml) < (Tag: string): xml | nilReturns the prev sibling of
Xmlwith tagTagif one exists, otherwisenil.meth (Xml: xml) < (Tag: string, Attribute₁ is Value₁, ...): xml | nilReturns the prev sibling of
Xmlwith tagTagandAttribute₁ = Value₁, etc., if one exists, otherwisenil.meth (Xml: xml) << (Fn: function): sequenceReturns a sequence of the previous siblings of
Xmlfor whichFn(Child)is non-nil.meth (Xml: xml) << (Attribute₁ is Value₁, ...): sequenceReturns a sequence of the previous siblings of
XmlwithAttribute₁ = Value₁, etc.meth (Xml: xml) << (Tag: string): sequenceReturns a sequence of the previous siblings of
Xmlwith tagTag.meth (Xml: xml) << (Tag: string, Attribute₁ is Value₁, ...): sequenceReturns a sequence of the previous siblings of
Xmlwith tagTagandAttribute₁ = Value₁, etc.meth >(Xml: xml): xml | nilReturns the next sibling of
Xmlornil.meth (Xml: xml) > (N: integer): xml | nilReturns the
N-th next sibling ofXmlornil.meth (Xml: xml) > (Attribute₁ is Value₁, ...): xml | nilReturns the next sibling of
XmlwithAttribute₁ = Value₁, etc., if one exists, otherwisenil.meth (Xml: xml) > (Tag: string): xml | nilReturns the next sibling of
Xmlwith tagTagif one exists, otherwisenil.meth (Xml: xml) > (Tag: string, Attribute₁ is Value₁, ...): xml | nilReturns the next sibling of
Xmlwith tagTagandAttribute₁ = Value₁, etc., if one exists, otherwisenil.meth (Xml: xml) >> (Fn: function): sequenceReturns a sequence of the next siblings of
Xmlfor whichFn(Child)is non-nil.meth (Xml: xml) >> (Attribute₁ is Value₁, ...): sequenceReturns a sequence of the next siblings of
XmlwithAttribute₁ = Value₁, etc.meth (Xml: xml) >> (Tag: string): sequenceReturns a sequence of the next siblings of
Xmlwith tagTag.meth (Xml: xml) >> (Tag: string, Attribute₁ is Value₁, ...): sequenceReturns a sequence of the next siblings of
Xmlwith tagTagandAttribute₁ = Value₁, etc.meth ^(Xml: xml): xml | nilReturns the parent of
Xmlornil.meth (Xml: xml) ^ (N: integer): xml | nilReturns the
N-th parent ofXmlornil.meth (Xml: xml) ^ (Attribute₁ is Value₁, ...): xml | nilReturns the parent of
XmlwithAttribute₁ = Value₁, etc., if one exists, otherwisenil.meth (Xml: xml) ^ (Tag: string): xml | nilReturns the parent of
Xmlwith tagTagif one exists, otherwisenil.meth (Xml: xml) ^ (Tag: string, Attribute₁ is Value₁, ...): xml | nilReturns the parent of
Xmlwith tagTagandAttribute₁ = Value₁, etc., if one exists, otherwisenil.meth (Node: xml):add_next(Other: any, ...): xmlInserts
Otherdirectly afterNode.meth (Node: xml):add_prev(Other: any, ...): xmlInserts
Otherdirectly beforeNode.meth (Node: xml):index: integer | nilReturns the index of
Nodein its parent ornil.meth (Node: xml):index(Text: boolean): integer | nilReturns the index of
Nodein its parent including or excluding text nodes.meth (Xml: xml):next: xml | nilReturns the next sibling of
Xmlornil.meth (Xml: xml):next(N: integer): xml | nilReturns the
N-th next sibling ofXmlornil.meth (Xml: xml):next(Attribute₁ is Value₁, ...): xml | nilReturns the next sibling of
XmlwithAttribute₁ = Value₁, etc., if one exists, otherwisenil.meth (Xml: xml):next(Tag: string): xml | nilReturns the next sibling of
Xmlwith tagTagif one exists, otherwisenil.meth (Xml: xml):next(Tag: string, Attribute₁ is Value₁, ...): xml | nilReturns the next sibling of
Xmlwith tagTagandAttribute₁ = Value₁, etc., if one exists, otherwisenil.meth (Xml: xml):parent: xml | nilReturns the parent of
Xmlornil.meth (Xml: xml):parent(N: integer): xml | nilReturns the
N-th parent ofXmlornil.meth (Xml: xml):parent(Attribute₁ is Value₁, ...): xml | nilReturns the parent of
XmlwithAttribute₁ = Value₁, etc., if one exists, otherwisenil.meth (Xml: xml):parent(Tag: string): xml | nilReturns the parent of
Xmlwith tagTagif one exists, otherwisenil.meth (Xml: xml):parent(Tag: string, Attribute₁ is Value₁, ...): xml | nilReturns the parent of
Xmlwith tagTagandAttribute₁ = Value₁, etc., if one exists, otherwisenil.meth (Node: xml):path: stringReturns the path of
Nodefrom its root.meth (Parent: xml):path(Node: xml): stringReturns the path of
NodefromParent.meth (Xml: xml):prev: xml | nilReturns the previous sibling of
Xmlornil.meth (Xml: xml):prev(N: integer): xml | nilReturns the
N-th prev sibling ofXmlornil.meth (Xml: xml):prev(Attribute₁ is Value₁, ...): xml | nilReturns the prev sibling of
XmlwithAttribute₁ = Value₁, etc., if one exists, otherwisenil.meth (Xml: xml):prev(Tag: string): xml | nilReturns the prev sibling of
Xmlwith tagTagif one exists, otherwisenil.meth (Xml: xml):prev(Tag: string, Attribute₁ is Value₁, ...): xml | nilReturns the prev sibling of
Xmlwith tagTagandAttribute₁ = Value₁, etc., if one exists, otherwisenil.meth (Node: xml):remove: xmlRemoves
Nodefrom its parent.meth (Node₁: xml):replace(Node₂: xml): xmlRemoves
Node₁from its parent and replaces it withNode₂.type xml::element < xml, sequenceAn XML element node.
meth xml::element(Tag: string, Arg₁, : any, ...): xml::elementReturns a new XML node with tag
Tagand optional children and attributes depending on the types of eachArgᵢ:string: added as child text node. Consecutive strings are added a single node.xml: added as a child node.list: each value must be astringorxmland is added as above.map: keys and values must be strings, set as attributes.name is value: values must be strings, set as attributes.
import: xml("fmt/xml") xml::element("test", "Text", type is "example") :> error("XMLError", "Attribute values must be strings")
meth (Parent: xml::element) :: (Attribute: string): string | nilReturns the value of the
Attributeattribute ofParent.meth /(Xml: xml::element): sequenceReturns a sequence of the children of
Xml.meth //(Xml: xml::element): sequenceReturns a sequence of the recursive children of
Xml, includingXml.meth <<(Xml: xml::element): sequenceReturns a sequence of the previous siblings of
Xml.meth >>(Xml: xml::element): sequenceReturns a sequence of the next siblings of
Xml.meth (Parent: xml::element)[Index: integer]: xml | nilReturns the
Index-th child ofParentornil.meth (Arg₁: xml::element)[Arg₂: integer, Arg₃₁ is Value₁, ...]TBD
meth (Parent: xml::element)[Index: integer, Tag: string]: xml | nilReturns the
Index-th child ofParentwith tagTagornil.meth (Arg₁: xml::element)[Arg₂: integer, Arg₃: string, Arg₄₁ is Value₁, ...]TBD
meth (Parent: xml::element)[Attribute: string]: string | nilReturns the value of the
Attributeattribute ofParent.meth (Xml: xml::element):attributes: mapReturns the attributes of
Xml.meth (Parent: xml::element):empty: xmlRemoves the contents of
Parent.meth (Parent: xml::element):grow(Children: sequence, ...): xmlAdds each node generated by
ChildrentoParentand returnsParent.meth (Parent: xml::element):put(Child: any, ...): xmlAdds
ChildtoParent.meth (Xml: xml::element):set(Attribute: string, Value: string): xmlSets the value of attribute
AttributeinXmltoValueand returnsXml.meth (Xml: xml::element):tag: stringReturns the tag of
Xml.meth (Xml: xml::element):text: stringReturns the (recursive) text content of
Xml.meth (Xml: xml::element):text(Sep: string): stringReturns the (recursive) text content of
Xml, addingSepbetween the contents of adjacent nodes.meth (Buffer: string::buffer):append(Xml: xml::element)Appends a string representation of
XmltoBuffer.meth (Arg₁: string::buffer):append(Arg₂: xml::element, Arg₃: nil, Arg₄: xml)TBD
meth (Arg₁: string::buffer):append(Arg₂: xml::element, Arg₃: xml, Arg₄: nil)TBD
meth (Arg₁: string::buffer):append(Arg₂: xml::element, Arg₃: xml, Arg₄: xml)TBD
type xml::filter < functionAn XML filter.
meth xml::filter(Attr₁ is Value₁, ...): xml::filterReturns an XML filter that checks if a node has attributes
Attrᵢ = Valueᵢ.meth xml::filter(Tag: string, Attr₁ is Value₁, ...): xml::filterReturns an XML filter that checks if a node has tag
Tagand attributesAttrᵢ = Valueᵢ.type xml::flags < flags::NoText::Trim
type xml::parser < streamA callback based streaming XML parser.
fun xml::parser(Callback: any): xml::parserReturns a new parser that calls
Callback(Xml)each time a complete XML document is parsed.meth (Sequence: xml::sequence) / (Args: any, ...): sequenceGenerates the sequence
Nodeᵢ / ArgswhereNodeᵢare the nodes generated bySequence.meth (Sequence: xml::sequence) // (Args: any, ...): sequenceGenerates the sequence
Nodeᵢ // ArgswhereNodeᵢare the nodes generated bySequence.meth (Sequence: xml::sequence) < (Args: any, ...): sequenceGenerates the sequence
Nodeᵢ < ArgswhereNodeᵢare the nodes generated bySequence.meth (Sequence: xml::sequence) << (Args: any, ...): sequenceGenerates the sequence
Nodeᵢ << ArgswhereNodeᵢare the nodes generated bySequence.meth (Sequence: xml::sequence) > (Args: any, ...): sequenceGenerates the sequence
Nodeᵢ > ArgswhereNodeᵢare the nodes generated bySequence.meth (Sequence: xml::sequence) >> (Args: any, ...): sequenceGenerates the sequence
Nodeᵢ >> ArgswhereNodeᵢare the nodes generated bySequence.meth (Sequence: xml::sequence) ^ (Args: any, ...): sequenceGenerates the sequence
Nodeᵢ ^ ArgswhereNodeᵢare the nodes generated bySequence.meth (Sequence: xml::sequence):contains(Regex: regex): sequenceEquivalent to
Sequence ->? fun(X) X:text:find(Regex).meth (Sequence: xml::sequence):contains(String: string): sequenceEquivalent to
Sequence ->? fun(X) X:text:find(String).meth (Sequence: xml::sequence):has(Fn: function): sequenceEquivalent to
Sequence ->? fun(X) some(Fn(X)).meth (Sequence: xml::sequence):next(Args: any, ...): sequenceGenerates the sequence
Nodeᵢ > ArgswhereNodeᵢare the nodes generated bySequence.meth (Sequence: xml::sequence):parent(Args: any, ...): sequenceGenerates the sequence
Nodeᵢ ^ ArgswhereNodeᵢare the nodes generated bySequence.meth (Sequence: xml::sequence):prev(Args: any, ...): sequenceGenerates the sequence
Nodeᵢ < ArgswhereNodeᵢare the nodes generated bySequence.type xml::text < xml, stringAn XML text node.
meth (Xml: xml::text):text: stringReturns the text content of
Xml.type xml::writer < streamUsed to incremental write XML to a target stream. An XML writer tracks the open element and uses an internal buffer,
:closemust be called on the writer when finished to close any open elements and flush the internal buffer to the target stream.meth xml::writer(Stream: stream): xml::writerCreates a new XML writer with target
Streamand default flags.meth xml::writer(Stream: stream, Flags: xml::writer::flags): xml::writerCreates a new XML writer with target
Streamand flagsFlags.meth /(Writer: xml::writer): WriterClose the current element and returns
Writer.meth (Writer: xml::writer) / (Tag: string): WriterOpens a new element with tag
Tagand returnsWriter.meth (Writer: xml::writer) / (Tag: string, Attr₁ is Value₁, ...): WriterOpens a new element with tag
Tagand attributesAttrᵢ = Valueᵢ, ...and returnsWriter.meth (Writer: xml::writer):attr(Attr₁ is Value₁, ...): WriterAdds attributes
Attrᵢ = Valueᵢ, ...to the current element and returnsWriter. Raises an error if any content or children have been added to the current element.meth (Writer: xml::writer):attr(Attr: string, Value: string): WriterAdds the attribute
Attr = Valueto the current element and returnsWriter. Raises an error if any content or children have been added to the current element.meth (Writer: xml::writer):close: streamCloses all remaining open elements, flushes the internal buffer to the target stream and returns the target stream.
meth (Writer: xml::writer):put(Element: xml::element): WriterAdds
Elementto the current element and returnsWriter.meth (Writer: xml::writer):write(Text: string): WriterAdds
Textto the current element and returnsWriter.type xml::writer::flags < enum::None::Indent