GXml.Document – GXml-0.20 Reference Manual

# Document

## Object Hierarchy:

## Description:

public class Document : Node, DomParentNode, DomNonElementParentNode, DomDocument, DomXMLDocument

A DOM4 implementation of DomDocument, for one step parsing.

This object avoids pre and post XML parsing, by using a one step parsing to translate text XML tree to an GObject based tree.

If you define a property in a derived class with a nick's name '::ROOT' it will be initialized and used as root node to parse documents, when you call DomDocument.read_from_string, DomDocument.read_from_file or the like.

All known sub-classes:

- HtmlDocument

Namespace: GXml
Package: GXml-0.20

## Content:

### Properties:

- public string character_set { get; }
- public int child_element_count { get; }
- public DomHTMLCollection children { owned get; }
- public string compat_mode { get; }
- public string content_type { get; }
- public DomDocumentType? doctype { owned get; }
- public DomElement? document_element { owned get; }
- public string document_uri { get; }
- public DomElement? first_element_child { owned get; }
- public DomImplementation implementation { get; }
- public DomElement? last_element_child { owned get; }
- public string origin { get; }
- public string url { get; }

### Creation methods:

- public Document ()
- public Document.from_file (File file) throws Error
  Creates a document parsing a file.
- public Document.from_path (string path) throws Error
- public Document.from_stream (InputStream stream) throws Error
  Creates a document parsing a stream.
- public Document.from_string (string str) throws Error
  Creates a document parsing a string.
- public Document.from_uri (string uri) throws Error
  Creates a document parsing a URI file.

### Methods:

- public DomNode adopt_node (DomNode node) throws Error
- public DomComment create_comment (string data) throws Error
- public DomDocumentFragment create_document_fragment ()
- public DomElement create_element (string local_name) throws Error
- public DomElement create_element_ns (string? namespace_uri, string qualified_name) throws Error
- public DomEvent create_event (string iface)
- public DomNodeIterator create_node_iterator (DomNode root, int what_to_show = ( int)0xFFFFFFFF)
- public DomProcessingInstruction create_processing_instruction (string target, string data) throws Error
- public DomRange create_range ()
- public DomText create_text_node (string data) throws Error
- public DomTreeWalker create_tree_walker (DomNode root, int what_to_show = ( int)0xFFFFFFFF)
- public DomElement? get_element_by_id (string element_id) throws Error
- public DomHTMLCollection get_elements_by_class_name (string class_names)
- public DomHTMLCollection get_elements_by_tag_name (string local_name)
- public DomHTMLCollection get_elements_by_tag_name_ns (string? ns, string local_name)
- public Parser get_xml_parser ()
- public DomNode import_node (DomNode node, bool deep = false) throws Error
- public DomNodeList query_selector_all (string selectors) throws Error
- public Element search_root_element_property ()
  Search, instantiate and append the element marked as root, with the nick equal to '::ROOT' (without ').
- public void set_xml_parser (Parser parser)

### Fields:

- protected string _character_set
- protected string _compat_mode
- protected DomEvent _constructor
- protected string _content_type
- protected DomImplementation _implementation
- protected string _origin
- protected Parser _parser
- protected string _url

### Inherited Members:

All known members inherited from class GXml.Node

- _base_uri
- _child_nodes
- _document
- _local_name
- _node_type
- _node_value
- _parent
- _prefix
- add_event_listener
- append_child
- base_uri
- child_nodes

- compare_document_position
- contains
- dispatch_event
- first_child
- has_child_nodes
- insert_before
- is_default_namespace
- is_equal_node
- last_child
- lookup_namespace_uri
- lookup_prefix
- next_sibling

- node_name
- node_type
- node_value
- normalize
- owner_document
- parent_element
- parent_node
- previous_sibling
- remove_child
- remove_event_listener
- replace_child
- text_content

All known members inherited from class GLib.Object

- @get
- @new
- @ref
- @set
- add_toggle_ref
- add_weak_pointer
- bind_property
- connect
- constructed
- disconnect
- dispose
- dup_data
- dup_qdata
- force_floating
- freeze_notify
- get_class
- get_data

- get_property
- get_qdata
- get_type
- getv
- interface_find_property
- interface_install_property
- interface_list_properties
- is_floating
- new_valist
- new_with_properties
- newv
- notify
- notify_property
- ref_count
- ref_sink
- remove_toggle_ref
- remove_weak_pointer

- replace_data
- replace_qdata
- set_data
- set_data_full
- set_property
- set_qdata
- set_qdata_full
- set_valist
- setv
- steal_data
- steal_qdata
- thaw_notify
- unref
- watch_closure
- weak_ref
- weak_unref

All known members inherited from interface GXml.DomParentNode

- child_element_count
- children
- first_element_child

- get_elements_by_property_value
- last_element_child

- query_selector
- query_selector_all

All known members inherited from interface GXml.DomNonElementParentNode

- get_element_by_id

All known members inherited from interface GXml.DomDocument

- adopt_node
- character_set
- compat_mode
- content_type
- create_comment
- create_document_fragment
- create_element
- create_element_ns
- create_event
- create_node_iterator
- create_processing_instruction
- create_range
- create_stream
- create_stream_async

- create_text_node
- create_tree_walker
- doctype
- document_element
- document_uri
- get_elements_by_class_name
- get_elements_by_tag_name
- get_elements_by_tag_name_ns
- get_xml_parser
- implementation
- import_node
- origin
- read_from_file

- read_from_file_async
- read_from_stream
- read_from_stream_async
- read_from_string
- read_from_string_async
- set_xml_parser
- url
- write_file
- write_file_async
- write_stream
- write_stream_async
- write_string
- write_string_async

All known members inherited from interface GXml.DomEventTarget

- add_event_listener

- dispatch_event

- remove_event_listener

All known members inherited from interface GXml.DomNode

- append_child
- base_uri
- child_nodes
- compare_document_position
- contains
- copy
- first_child
- has_child_nodes
- insert_before

- is_default_namespace
- is_equal_node
- last_child
- lookup_namespace_uri
- lookup_prefix
- next_sibling
- node_name
- node_type
- node_value

- normalize
- owner_document
- parent_element
- parent_node
- previous_sibling
- remove_child
- replace_child
- text_content