GXmlTDocument

GXmlTDocument — Class implemeting GXmlDocument interface, not tied to libxml-2.0 library.

Functions

Types and Values

Description

This class use xmlTextWriter to write down XML documents using its contained GXmlNode children or other XML structures.

Functions

gxml_tdocument_save_to ()

gboolean
gxml_tdocument_save_to (GXmlTDocument *self,
                        GFile *f,
                        GCancellable *cancellable,
                        GError **error);

gxml_tdocument_save_to is deprecated and should not be used in newly-written code.

Parameters

self

the GXmlTDocument instance

 

f

 

 

cancellable

 

 

error

location to store the error occuring, or NULL to ignore

 

gxml_tdocument_new ()

GXmlTDocument *
gxml_tdocument_new (void);

gxml_tdocument_new_from_path ()

GXmlTDocument *
gxml_tdocument_new_from_path (const gchar *path);

Parameters

path

 

 

gxml_tdocument_new_from_uri ()

GXmlTDocument *
gxml_tdocument_new_from_uri (const gchar *uri);

Parameters

uri

 

 

gxml_tdocument_new_from_file ()

GXmlTDocument *
gxml_tdocument_new_from_file (GFile *file);

Parameters

file

 

 

gxml_tdocument_new_from_stream ()

GXmlTDocument *
gxml_tdocument_new_from_stream (GInputStream *stream);

Parameters

stream

 

 

gxml_tdocument_new_from_string ()

GXmlTDocument *
gxml_tdocument_new_from_string (const gchar *str);

Parameters

str

 

 

gxml_tdocument_new_from_path_with_readtype_func ()

GXmlTDocument *
gxml_tdocument_new_from_path_with_readtype_func
                               (const gchar *path,
                                GXmlTDocumentReadTypeFunc func,
                                void *func_target);

Parameters

func_target

user data to pass to func .

[allow-none][closure]

path

 

 

func

 

 

gxml_tdocument_new_from_uri_with_readtype_func ()

GXmlTDocument *
gxml_tdocument_new_from_uri_with_readtype_func
                               (const gchar *uri,
                                GXmlTDocumentReadTypeFunc func,
                                void *func_target);

Parameters

func_target

user data to pass to func .

[allow-none][closure]

uri

 

 

func

 

 

gxml_tdocument_new_from_file_with_readtype_func ()

GXmlTDocument *
gxml_tdocument_new_from_file_with_readtype_func
                               (GFile *file,
                                GXmlTDocumentReadTypeFunc func,
                                void *func_target);

Parameters

func_target

user data to pass to func .

[allow-none][closure]

file

 

 

func

 

 

gxml_tdocument_new_from_stream_with_readtype_func ()

GXmlTDocument *
gxml_tdocument_new_from_stream_with_readtype_func
                               (GInputStream *stream,
                                GXmlTDocumentReadTypeFunc func,
                                void *func_target);

Parameters

func_target

user data to pass to func .

[allow-none][closure]

stream

 

 

func

 

 

gxml_tdocument_new_from_string_with_readtype_func ()

GXmlTDocument *
gxml_tdocument_new_from_string_with_readtype_func
                               (const gchar *str,
                                GXmlTDocumentReadTypeFunc func,
                                void *func_target);

Parameters

func_target

user data to pass to func .

[allow-none][closure]

str

 

 

func

 

 

GXmlTDocumentReadTypeFunc ()

GXmlTDocumentReadType
(*GXmlTDocumentReadTypeFunc) (GXmlNode *node,
                              xmlTextReader *tr,
                              void *user_data);

Delegate function to control parsing of XML documents. Return GXML_TDOCUMENT_READ_TYPE_NEXT to skip all children nodes of current GXmlNode; GXML_TDOCUMENT_READ_TYPE_CONTINUE continue parsing nodes or GXML_TDOCUMENT_READ_TYPE_STOP to stop reading.

While you get the current xmlTextReader used in parsing, you can control next action to take depending on current node.

Parameters

node

 

 

tr

 

 

user_data

data to pass to the delegate function.

[closure]

gxml_tdocument_tw_save_as ()

gboolean
gxml_tdocument_tw_save_as (GXmlDocument *doc,
                           GFile *f,
                           GCancellable *cancellable,
                           GError **error);

Parameters

doc

 

 

f

 

 

cancellable

 

 

error

location to store the error occuring, or NULL to ignore

 

gxml_tdocument_write_document ()

void
gxml_tdocument_write_document (GXmlDocument *doc,
                               xmlTextWriter *tw,
                               GError **error);

Parameters

doc

 

 

tw

 

 

error

location to store the error occuring, or NULL to ignore

 

gxml_tdocument_start_node ()

void
gxml_tdocument_start_node (GXmlDocument *doc,
                           xmlTextWriter *tw,
                           GXmlNode *node,
                           gboolean root,
                           GeeArrayList **declared_ns,
                           GError **error);

Parameters

doc

 

 

tw

 

 

node

 

 

root

 

 

declared_ns

 

 

error

location to store the error occuring, or NULL to ignore

 

gxml_tdocument_read_doc ()

void
gxml_tdocument_read_doc (GXmlDocument *doc,
                         GFile *file,
                         GXmlTDocumentReadTypeFunc rtfunc,
                         void *rtfunc_target,
                         GError **error);

Read a GXmlDocument from a GFile, parsing is controller using GXmlTDocumentReadTypeFunc, if null it parse all nodes.

Parameters

rtfunc_target

user data to pass to rtfunc .

[allow-none][closure]

doc

 

 

file

 

 

rtfunc

 

 

error

location to store the error occuring, or NULL to ignore

 

gxml_tdocument_read_doc_stream ()

void
gxml_tdocument_read_doc_stream (GXmlDocument *doc,
                                GInputStream *istream,
                                GXmlTDocumentReadTypeFunc rtfunc,
                                void *rtfunc_target,
                                GError **error);

Reads document from GInputStream objects.

Parameters

rtfunc_target

user data to pass to rtfunc .

[allow-none][closure]

doc

 

 

istream

 

 

rtfunc

 

 

error

location to store the error occuring, or NULL to ignore

 

gxml_tdocument_read_node ()

GXmlTDocumentReadType
gxml_tdocument_read_node (GXmlNode *node,
                          xmlTextReader *tr,
                          GXmlTDocumentReadTypeFunc rntfunc,
                          void *rntfunc_target,
                          GError **error);

Parse current node in xmlTextReader.

Returns: a GXmlNode respresenting current parsed one.

Parameters

rntfunc_target

user data to pass to rntfunc .

[allow-none][closure]

node

 

 

tr

 

 

rntfunc

 

 

error

location to store the error occuring, or NULL to ignore

 

Types and Values

GXML_TYPE_TDOCUMENT

#define GXML_TYPE_TDOCUMENT (gxml_tdocument_get_type ())

The type for GXmlTDocument.


enum GXmlTDocumentReadType

Enum for xmlTextReader flag on parsing.

Members

GXML_TDOCUMENT_READ_TYPE_NEXT

   

GXML_TDOCUMENT_READ_TYPE_CONTINUE

   

GXML_TDOCUMENT_READ_TYPE_STOP

   

struct GXmlTDocument

struct GXmlTDocument {
	GXmlTNode parent_instance;
	GXmlTDocumentPrivate * priv;
	GeeArrayList* _namespaces;
	GeeArrayList* _children;
};

Class implemeting GXmlDocument interface, not tied to libxml-2.0 library.

This class use xmlTextWriter to write down XML documents using its contained GXmlNode children or other XML structures.


struct GXmlTDocumentClass

struct GXmlTDocumentClass {
	GXmlTNodeClass parent_class;
};

The class structure for GXML_TYPE_TDOCUMENT. All the fields in this structure are private and should never be accessed directly.

Members