User Tools

Site Tools


DzDomDocument

Represents a Document Object Model (DOM) “Document”.

More...

Inherits :

Constructors

DAZ Script
DzDomDocument ()

Methods

Detailed Description

A DAZScript wrapper for QDomDocument. This object represents an entire DOM document. Conceptually, it is the root of the document tree and provides the primary access to the document's data.

Typically, this is the only DOM node that is constructed directly; using the default constructors of the other DOM and XML Objects usually only results in empty objects that cannot be manipulated or inserted into the document.

To populate a document, use loadContent() to cause data to be parsed from an XML (or XML derivative) file, or use setContent() to cause data to be parsed from an XML (or XML derivative) string.

Note that it is also possible to create nodes of the DOM tree from scratch by using the following factory functions:

The parsed XML data is represented by an internal tree of nodes that can be accessed using DOM and XML Objects. The internal objects in the DOM tree are deleted once the last DOM object referencing them and the DzDomDocument itself are deleted.

For more information about the Document Object Model (DOM) see the Level 1 and Level 2 Core specifications.

Constructors


DzDomDocument()

Default constructor. Creates an empty DOM document. Typically, this is the only DOM node that is constructed directly.

Methods


DzDomAttr : createAttribute( String name )

Parameter(s):

  • name - The name of the “Attribute” to create.

Return Value:

  • A new “Attribute” node that is a member of this document.

Attention:

See Also:


DzDomAttr : createAttributeNS( String nsURI, String qName )

Parameter(s):

  • nsURI - The namespace of the “Attribute” to create.
  • qName - The qualified name of the “Attribute” to create.

Return Value:

  • A new “Attribute” node, in the specified namespace, that is a member of this document.

Attention:

See Also:


DzDomCDATASection : createCDATASection( String value )

Parameter(s):

  • value - The string value to store in the document.

Return Value:

  • A new “Character Data Section” node that is a member of this document.

Attention:

  • The node must still be added it as a child of the document or one of its nodes.

See Also:


DzDomComment : createComment( String value )

Parameter(s):

  • value - The text of the comment.

Return Value:

  • A new “Comment” node that is a member of this document.

Attention:

  • The node must still be added it as a child of the document or one of its nodes.

See Also:


DzDomDocumentFragment : createDocumentFragment()

Return Value:

  • A new “Document Fragment” node that is a member of this document.

Attention:

  • The node must still be added it as a child of the document or one of its nodes.

See Also:


DzDomElement : createElement( String tagName )

Parameter(s):

  • tagName - The name of the “Element” node to create.

Return Value:

  • A new “Element” node that is a member of this document.

Attention:

  • The node must still be added it as a child of the document or one of its nodes.

See Also:


DzDomElement : createElementNS( String nsURI, String qName )

Parameter(s):

  • nsURI - The namespace of the “Element” to create.
  • qName - The qualified name of the “Element” to create.

Return Value:

  • A new “Element” node, in the specified namespace, that is a member of this document.

Attention:

  • The node must still be added it as a child of the document or one of its nodes.

See Also:


DzDomEntityReference : createEntityReference( String name )

Parameter(s):

  • name - The name of the “Entity Reference” to create.

Return Value:

  • A new “Entity Reference” node that is a member of this document.

Attention:

  • The node must still be added it as a child of the document or one of its nodes.

See Also:


DzDomProcessingInstruction : createProcessingInstruction( String target, String data )

Parameter(s):

  • target - The target of the processing instruction.
  • data - The data to be processed.

Return Value:

  • A new “Processing Instruction” node that is a member of this document.

Attention:

  • The node must still be added it as a child of the document or one of its nodes.

See Also:


DzDomText : createTextNode( String value )

Parameter(s):

  • value - The text to store in the node.

Return Value:

  • A new “Text” node that is a member of this document.

Attention:

  • The node must still be added it as a child of the document or one of its nodes.

See Also:


DzDomDocumentType : doctype()

Return Value:


DzDomNode : elementById( String id )

Parameter(s):

  • elementId - The ID of the element to retrieve.

Return Value:


DzDomNode : importNode( DzDomNode node, Boolean deep )

Parameter(s):

  • node - The node to import.
  • deep - If true, node and all of its children are imported recursively. If false, only node is imported.

Return Value:

  • A new node that is a member of this document that is a (deep) copy of the specified node.

Attention:

  • The node must still be added it as a child of the document or one of its nodes.

See Also:


Boolean : loadContent( String filename )

Sets the contents of the document by parsing the file at the specified path.

Parameter(s):

  • filename - The (absolute) path of the file to load.

Return Value:

  • true if the file was successfully parsed, otherwise false.

Boolean : saveContent( String filename )

Saves the contents of the document to the specified file.

Parameter(s):

  • filename - The (absolute) path of the file to save.

Return Value:

  • true if the file was successfully saved, otherwise false.

Boolean : setContent( String text )

Sets the contents of this document from the specified string.

Parameter(s):

  • text - The XML document, in string form, to set the contents of this document to; assumed to be a Unicode string, no encoding detection is performed.

Return Value:

  • true if the string was successfully parsed, otherwise false.

See Also:


ByteArray : toByteArray( Number indent=1 )

Parameter(s):

  • indent - The amount of space to indent sub-elements.

Return Value:

  • The contents of this document in its textual representation as a byte array, encoded as UTF-8.

Since:

  • 4.11.0.155

String : toString( Number indent=1 )

Parameter(s):

  • indent - The amount of space to indent sub-elements. (since 4.11.0.155)

Return Value:

  • The contents of the document in its textual representation.