DomDocument Features

A list of features for the xml.DomDocument class.

Table 1. DomDocument Features
Name Description
format-pretty-print

Formats the output by adding white space to produce a pretty-printed, indented, human-readable form.

Possible values are TRUE or FALSE.

Default value is FALSE.

comments

Defines whether the XML comments are kept during the load of a document into a DomDocument object.

Possible values are TRUE or FALSE.

Default value is TRUE.

whitespace-in-element-content

Defines whether XML Text nodes that can be considered "Ignorable" are kept during the load of an XML document into a DomDocument object.

Possible values are TRUE or FALSE.

Default value is TRUE.

cdata-sections

Defines whether XML CData nodes are kept or replaced by XML Text nodes during the load of an XML document into a DomDocument object.

Possible values are TRUE or FALSE.

Default value is TRUE.

expand-entity-references

Defines whether XML EntityReference nodes are kept or replaced during the load of an XML document into a DomDocument object.

Possible values are TRUE or FALSE.

Default value is TRUE.

validation-type

Defines what kind of validation should be performed.

Possible values are: DTD, Schema.

Default is Schema.

external-schemaLocation

Defines a list of namespace-qualified XML schemas to use for validation on a DomDocument object.

Value is a space-separated string of one or several pairs of strings representing the namespace URI of the schema, followed by its location.

Example:

"http://tempuri/org/NS mySchema1.xsd http://www.mycompany.com mySchema2.xsd"

external-noNamespaceSchemaLocation

Defines a list of XML schemas to use for validation on a DomDocument object.

Value is a space-separated string of one or several strings representing the location of a schema.

Example:

"mySchema1.xsd mySchema2.xsd"

schema-uriRecovery

Changes the schema location of an XML schema referenced by import tags in other schemas.

Value is a space-separated string of one or several pairs of strings representing the original schema location followed by the new schema location

Example:

"http://www.w3.org/2001/xml.xsd myXML.xsd http://www.mycompany.com/GWS.xsd myGWS.xsd"

load-save-base64-string

Changes methods loadFromString() and saveToString() to handle Base64 strings.

Parsing an XML document is done from a BASE64 encoded string, and saving an XML document results in a BASE64 encoded string.

Possible values are TRUE or FALSE.

Default is FALSE.

auto-id-attribute

Changes the parsing of an XML document in order to set all unqualified attributes named ID, Id, iD or id to be of type ID.

They can then be retrieved with method getElementById() or with an XPath expression without calling setIdAttribute().

Possible values are TRUE or FALSE.

Default is FALSE.

auto-id-qualified-attribute

Changes the parsing of an XML document in order to set all qualified attributes named ID, Id, iD or id to be of type ID.

They can then be retrieved with method getElementById() or with an XPath expression without calling setIdAttributeNS().

Possible values are TRUE or FALSE.

Default is FALSE.

enable-html-compliancy

Changes methods to parse, normalize and save HTML document via the DomDocument object.

Possible values are TRUE or FALSE.

Default value is FALSE.

The HTML parsing isn't namespace qualified, and document is considered as an XML document after loading.