Top | ![]() |
![]() |
![]() |
![]() |
GXmlxDocumentGXmlxDocument — Represents an XML xDocument as a tree of GXmlxNodes. |
The xDocument has a root document element GXmlxElement. A xDocument's schema can be defined through its GXmlxDocumentType.
Version: DOM Level 1 Core
URL: http://www.w3.org/TR/DOM-Level-1/level-one-core.html#i-xDocument
void gxml_xdocument_save_to_path (GXmlxDocument *self
,const gchar *file_path
,GError **error
);
Saves a xDocument to the file at path file_path
GXmlError will be returned in error
A GXmlError if an error occurs while writing
self |
the GXmlxDocument instance |
|
file_path |
. A path on the local system to save the document to . |
[in] |
error |
location to store the error occuring, or |
[error-domains GXmlError] |
void gxml_xdocument_save_to_stream (GXmlxDocument *self
,GOutputStream *outstream
,GCancellable *can
,GError **error
);
Saves a xDocument to the OutputStream outstream.
GXmlError will be returned in error
A GXmlError is thrown if saving encounters an error
self |
the GXmlxDocument instance |
|
outstream |
. A destination GOutputStream to save the XML file to . |
[in] |
can |
. A GCancellable to cancel saving with, or . |
[in][allow-none] |
error |
location to store the error occuring, or |
GXmlDocumentFragment *
gxml_xdocument_create_document_fragment
(GXmlxDocument *self
);
Creates a GXmlDocumentFragment.
xDocument fragments do not can contain a subset of a document, without being a complete tree. Its memory is freed when its owner document is freed.
Version: DOM Level 1 Core
URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#method-createDocumentFragment
GXmlxText * gxml_xdocument_create_text_node (GXmlxDocument *self
,const gchar *text_data
);
Creates a GXmlText node containing the text in data. Its memory is freed when its owner document is freed.
XML example:
<someElement>Text is contained here.</someElement>
Version: DOM Level 1 Core
URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#method-createTextNode
self |
the GXmlxDocument instance |
|
text_data |
. The textual data for the GXmlText node . |
[in] |
GXmlxComment * gxml_xdocument_create_managed_comment (GXmlxDocument *self
,const gchar *comment_data
);
Creates an XML comment with data. Its memory is freed when its owner document is freed.
XML example:
<!-- data -->
Version: DOM Level 1 Core
URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#method-createComment
GXmlxCDATASection * gxml_xdocument_create_cdata_section (GXmlxDocument *self
,const gchar *cdata_data
);
Creates a CDATA section containing data.
These do not apply to HTML doctype documents. Its memory is freed when its owner document is freed.
XML example:
<![CDATA[Here contains non-XML data, like code, or something that requires a lot of special XML entities.]]>.
Version: DOM Level 1 Core
URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#method-createCDATASection
GXmlxProcessingInstruction * gxml_xdocument_create_processing_instruction (GXmlxDocument *self
,const gchar *target
,const gchar *data
);
Creates a new GXmlProcessingInstruction.
Its memory is freed when its owner document is freed.
Version: DOM Level 1 Core
URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#method-createProcessingInstruction
self |
the GXmlxDocument instance |
|
target |
. The target of the instruction . |
[in] |
data |
. The content of the instruction . |
[in] |
GXmlxAttr * gxml_xdocument_create_attribute (GXmlxDocument *self
,const gchar *name
);
Creates an GXmlAttribute attribute with name
, usually to be associated with an xElement.
XML example:
<element attributename="attributevalue">content</element>
Version: DOM Level 1 Core
URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#method-createAttribute
GXmlEntityReference * gxml_xdocument_create_entity_reference (GXmlxDocument *self
,const gchar *name
);
Creates an entity reference.
XML example:
&name;
, for example an apostrophe has the name 'apos', so in XML it appears as
'
Version: DOM Level 1 Core
URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#method-createEntityReference
GXmlxNodeList * gxml_xdocument_get_elements_by_tag_name (GXmlxDocument *self
,const gchar *tag_name
);
Obtains a list of GXmlxElements, each with the given tag name tag_name
, contained within this document.
Note that the list is live, updated as new elements are added to the document.
Unlike a GXmlxNode and its subclasses, GXmlNodeList are not part of the document tree, and thus their memory is not managed for the user, so the user must explicitly free them.
Version: DOM Level 1 Core
URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#method-getElementsByTagName
self |
the GXmlxDocument instance |
|
tag_name |
. The GXmlxElement tag name we matching for . |
[in] |
GXmlxNode * gxml_xdocument_copy_node (GXmlxDocument *self
,GXmlxNode *foreign_node
,gboolean deep
);
GXmlxDocument * gxml_xdocument_new_from_libxml2 (xmlDoc *doc
,gboolean require_root
);
Creates a xDocument based on a libxml2 Xml.Doc* object.
GXmlxDocument * gxml_xdocument_new_from_path (const gchar *file_path
,GError **error
);
Creates a xDocument from the file at file_path.
GXmlError will be returned in error
A GXmlError if an error occurs while loading
GXmlxDocument * gxml_xdocument_new_from_gfile (GFile *fin
,GCancellable *can
,GError **error
);
Creates a xDocument for the GFile fin
.
GError will be returned in error
A GError if an error cocurs while reading the GFile
GXmlError will be returned in error
A GXmlError if an error occurs while reading the file as a stream
GXmlxDocument * gxml_xdocument_new_from_stream (GInputStream *instream
,GCancellable *can
,GError **error
);
Creates a GXmlxDocument from data provided through a GInputStream.
GXmlError will be returned in error
A GXmlError if an error occurs while reading the stream
instream |
. A GInputStream providing our document . |
[in] |
can |
. A GCancellable object allowing the caller to interrupt and cancel this operation, or . |
[in][allow-none] |
error |
location to store the error occuring, or |
A new GXmlxDocument built from the contents of instream; this must be freed with g_object_unref()
GXmlxDocument *
gxml_xdocument_new_from_string (const gchar *xml
);
Creates a xDocument from data found in memory.
GXmlxDocument * gxml_xdocument_new_from_string_with_options (const gchar *xml
,const gchar *url
,const gchar *encoding
,gint options
,GError **error
);
Creates a xDocument from data found in memory using options.
GXmlxDocumentType *
gxml_xdocument_get_doctype (GXmlxDocument *self
);
Get and return the current value of the "doctype" property.
The xDocument Type Definition (DTD) defining this document. This may be NULL
.
Version: DOM Level 1 Core URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#attribute-doctype
GXmlImplementation *
gxml_xdocument_get_implementation (GXmlxDocument *self
);
Get and return the current value of the "implementation" property.
Describes the features of the DOM implementation behind this document.
Version: DOM Level 1 Core URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#attribute-implementation
GXmlxElement *
gxml_xdocument_get_document_element (GXmlxDocument *self
);
Get and return the current value of the "document-element" property.
The root node of the document's node tree.
Version: DOM Level 1 Core URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#attribute-documentElement
GXmlNode *
gxml_xdocument_get_root (GXmlxDocument *self
);
Get and return the current value of the "root" property.
#define GXML_TYPE_XDOCUMENT (gxml_xdocument_get_type ())
The type for GXmlxDocument.
struct GXmlxDocument { GXmlxNode parent_instance; GXmlxDocumentPrivate * priv; GHashTable* node_dict; GList* dirty_elements; xmlDoc* xmldoc; GXmlNodeChildNodeList* _node_list; };
Represents an XML xDocument as a tree of GXmlxNodes.
The xDocument has a root document element GXmlxElement. A xDocument's schema can be defined through its GXmlxDocumentType.
Version: DOM Level 1 Core
URL: http://www.w3.org/TR/DOM-Level-1/level-one-core.html#i-xDocument
struct GXmlxDocumentClass { GXmlxNodeClass parent_class; GXmlNode* (*get_root) (GXmlxDocument* self); };
The class structure for GXML_TYPE_XDOCUMENT
. All the fields in this structure are private and should never be accessed directly.