Options
All
  • Public
  • Public/Protected
  • All
Menu

Class XmlDocument

Represents a document.

A sample document is structured as follows:

<?xml version="1.0" encoding="UTF-8"?>
<DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
        <title>My page title</title>
    </head>
    <body>
        <h1>Welcome!</h1>
        <p>I hope you enjoy visiting my website.</p>
        <img src="picture.png"/>
    </body>
</html>

Each component of the document, such as the declaration, document type definition, and root element, are children of this node.

Documents must have exactly one element, which is the document's root element.

Documents can have exactly one declaration and one document type definition in that order, so long as they precede the element.

Documents can have an unlimited number of comments or processing instructions, so long as they follow the declaration, if one exists.

Hierarchy

  • XmlDocument

Index

Constructors

constructor

Properties

Private _children

_children: Child[]

Private _validation

_validation: boolean

Methods

comment

  • Adds a comment to this document and returns the new comment.

    Parameters

    Returns XmlComment<this>

decl

  • Adds a declaration to this document and returns the new declaration.

    Parameters

    Returns XmlDecl<this>

dtd

  • Adds a document type definition to this document and returns the new document type definition.

    Parameters

    Returns XmlDtd<this>

element

  • Adds the root element to this document and returns the element.

    Parameters

    Returns XmlElement<this>

procInst

  • Adds a processing instruction to this document and returns the new processing instruction.

    Parameters

    Returns XmlProcInst<this>

toString

  • Returns an XML string representation of this document using the specified options.

    Parameters

    Returns string

Generated using TypeDoc