type

XDoc

src @Js
class XDoc : XNode

XML document encapsulates the root element and document type.

constructors

make

Construct with optional root elem.

fields

docType

Document type declaration or null if undefined.

root

Root element.

methods

add

Add a node to the document.

nodeType

Return the XNodeType.doc.

pis

Get any processing instructions declared before the root element.

removePi

Remove the processing instruction by reference.

toStr

Return string representation.

write

Write this node to the output stream.

Slot Details

add

src @Operator
This add(Obj child)

Add a node to the document. If the node is an XElem then it is defined as the root element, otherwise the child must be a XPi. Return this.

docType

src XDocType? docType

Document type declaration or null if undefined.

make

src new make(XElem? root := null)

Construct with optional root elem.

nodeType

src virtual override XNodeType nodeType()

Return the XNodeType.doc.

pis

src XNode[] pis()

Get any processing instructions declared before the root element. Processing instructions after the root are not supported.

removePi

src XPi? removePi(XPi pi)

Remove the processing instruction by reference.

root

src XElem root

Root element.

toStr

src virtual override Str toStr()

Return string representation.

write

src virtual override Void write(OutStream out)

Write this node to the output stream.