-
Notifications
You must be signed in to change notification settings - Fork 0
Document
The Document class represents an XML document. It can be created by instantiating an object using the "new" keyword or by parsing a document.
Instantiate a new document setting the version to version and the encoding to encoding.
args
version - a string representing the desired document version (default '1.0') encoding - a string representing the desired document encoding (default 'utf8')
returns a new document object
A convenience method to get the idxth child of the root element See Element#child for more information
args
idx - a zero indexed integer representing the child element to return
returns a element object or null
Get all the children of the root node
returns an array of element objects
An array of recoverable errors encountered while parsing the document
returns an array of SyntaxErrors
Gets the document's encoding
returns a string representation of the document encoding
Sets the document's encoding
args
enc - must be a string representing the desired encoding
returns the document object
A convenience method to search the document starting at the root node See Element#find for more information
args
xpath - must be a string representing the xpath to search
returns an array of element objects
A convenience method to search the document and get the first node in the results See Element#get for more information
returns a element object or null
A convenience method for creating and setting the root node
args name - the tag name content - text content of the node (a string)
returns the newly created node
The root element of the document
returns an element object or null
Renders the document to a string
args formatting - an optional boolean to indicate whether the output is formatted (newlines, indentation, etc) or not. Default is
true. Specifyfalseif you wish to have unformatted output.
returns a string representation of the document
Gets the document version.
returns a string representation of the document version
Sets the Dtd on the document.
args
name - Name of the DTD
ext - The external id for the DTD
sys - The system id for the DTD