LsmDomDocument

## LsmDomDocument LsmDomDocument — Base class for DOM document nodes |

## Synopsis

                        LsmDomDocument;
    LsmDomDocument *    (*LsmDomDocumentCreateFunction)     (void);
    LsmDomDocument *    lsm_dom_implementation_create_document
                                                            (const char *namespace_uri,
                                                             const char *qualified_name);
    void                lsm_dom_implementation_cleanup      (void);
    void                lsm_dom_document_append_from_memory (LsmDomDocument *document,
                                                             LsmDomNode *node,
                                                             const void *buffer,
                                                             int size,
                                                             GError **error);
    LsmDomDocument *    lsm_dom_document_new_from_memory    (const void *buffer,
                                                             int size,
                                                             GError **error);
    LsmDomDocument *    lsm_dom_document_new_from_path      (const char *path,
                                                             GError **error);
    LsmDomDocument *    lsm_dom_document_new_from_url       (const char *url,
                                                             GError **error);
    void                lsm_dom_document_save_to_stream     (LsmDomDocument *document,
                                                             GOutputStream *stream,
                                                             GError **error);
    void                lsm_dom_document_save_to_memory     (LsmDomDocument *documennt,
                                                             void **buffer,
                                                             int *size,
                                                             GError **error);
    void                lsm_dom_document_save_to_path       (LsmDomDocument *documennt,
                                                             const char *path,
                                                             GError **error);
    void                lsm_dom_document_save_to_url        (LsmDomDocument *documennt,
                                                             const char *path,
                                                             GError **error);
    LsmDomElement *     lsm_dom_document_get_document_element
                                                            (LsmDomDocument *self);
    LsmDomElement *     lsm_dom_document_create_element     (LsmDomDocument *self,
                                                             const char *tag_name);
    LsmDomText *        lsm_dom_document_create_text_node   (LsmDomDocument *self,
                                                             const char *data);
    LsmDomElement *     lsm_dom_document_get_element_by_id  (LsmDomDocument *self,
                                                             const char *id);
    void                lsm_dom_document_register_element   (LsmDomDocument *self,
                                                             LsmDomElement *element,
                                                             const char *id);
    LsmDomView *        lsm_dom_document_create_view        (LsmDomDocument *self);
    const char *        lsm_dom_document_get_url            (LsmDomDocument *self);
    void                lsm_dom_document_set_url            (LsmDomDocument *self,
                                                             const char *url);
    void                lsm_dom_document_set_path           (LsmDomDocument *self,
                                                             const char *path);
    void *              lsm_dom_document_get_href_data      (LsmDomDocument *self,
                                                             const char *href,
                                                             gsize *size);
    const char *        lsm_dom_get_entity                  (const char *name);

## Object Hierarchy

      GObject
       +----LsmDomNode
             +----LsmDomDocument

## Description

## Details

### LsmDomDocument

    typedef struct _LsmDomDocument LsmDomDocument;

### LsmDomDocumentCreateFunction ()

    LsmDomDocument *    (*LsmDomDocumentCreateFunction)     (void);

### lsm_dom_implementation_create_document ()

    LsmDomDocument *    lsm_dom_implementation_create_document
                                                            (const char *namespace_uri,
                                                             const char *qualified_name);

`namespace_uri` : | namespace uri
`qualified_name` : | qualified name
Returns : | a new LsmDomDocument. [transfer full]

### lsm_dom_implementation_cleanup ()

    void                lsm_dom_implementation_cleanup      (void);

### lsm_dom_document_append_from_memory ()

    void                lsm_dom_document_append_from_memory (LsmDomDocument *document,
                                                             LsmDomNode *node,
                                                             const void *buffer,
                                                             int size,
                                                             GError **error);

Append a chunk of xml tree to an existing document. The resulting nodes will be appended to `node`, or to `document` if `node` == NULL.

Size set to a negative value indicated an unknow xml data size.

`document` : | a LsmDomDocument
`node` : | a LsmDomNode
`buffer` : | a memory buffer holding xml data
`size` : | size of the xml data, in bytes
`error` : | an error placeholder

### lsm_dom_document_new_from_memory ()

    LsmDomDocument *    lsm_dom_document_new_from_memory    (const void *buffer,
                                                             int size,
                                                             GError **error);

### lsm_dom_document_new_from_path ()

    LsmDomDocument *    lsm_dom_document_new_from_path      (const char *path,
                                                             GError **error);

### lsm_dom_document_new_from_url ()

    LsmDomDocument *    lsm_dom_document_new_from_url       (const char *url,
                                                             GError **error);

### lsm_dom_document_save_to_stream ()

    void                lsm_dom_document_save_to_stream     (LsmDomDocument *document,
                                                             GOutputStream *stream,
                                                             GError **error);

`document` : | a LsmDomDocument
`stream` : | stream to save to
`error` : | an error placeholder

### lsm_dom_document_save_to_memory ()

    void                lsm_dom_document_save_to_memory     (LsmDomDocument *documennt,
                                                             void **buffer,
                                                             int *size,
                                                             GError **error);

### lsm_dom_document_save_to_path ()

    void                lsm_dom_document_save_to_path       (LsmDomDocument *documennt,
                                                             const char *path,
                                                             GError **error);

### lsm_dom_document_save_to_url ()

    void                lsm_dom_document_save_to_url        (LsmDomDocument *documennt,
                                                             const char *path,
                                                             GError **error);

### lsm_dom_document_get_document_element ()

    LsmDomElement *     lsm_dom_document_get_document_element
                                                            (LsmDomDocument *self);

`self` : | a LsmDomElement
Returns : | document element. [transfer none]

### lsm_dom_document_create_element ()

    LsmDomElement *     lsm_dom_document_create_element     (LsmDomDocument *self,
                                                             const char *tag_name);

`self` : | a LsmDomDocument
`tag_name` : | name of the element to create
Returns : | a newly created LsmDomElement. [transfer full]

### lsm_dom_document_create_text_node ()

    LsmDomText *        lsm_dom_document_create_text_node   (LsmDomDocument *self,
                                                             const char *data);

`self` : | a LsmDomDocument
`data` : | content of the text node
Returns : | a newly created LsmDomText. [transfer full]

### lsm_dom_document_get_element_by_id ()

    LsmDomElement *     lsm_dom_document_get_element_by_id  (LsmDomDocument *self,
                                                             const char *id);

`self` : | a LsmDomDocument
`id` : | id of the element to find
Returns : | the requested element, NULL if not found. [transfer none]

### lsm_dom_document_register_element ()

    void                lsm_dom_document_register_element   (LsmDomDocument *self,
                                                             LsmDomElement *element,
                                                             const char *id);

### lsm_dom_document_create_view ()

    LsmDomView *        lsm_dom_document_create_view        (LsmDomDocument *self);

`self` : | a LsmDomDocument
Returns : | a new LsmDomView. [transfer full]

### lsm_dom_document_get_url ()

    const char *        lsm_dom_document_get_url            (LsmDomDocument *self);

### lsm_dom_document_set_url ()

    void                lsm_dom_document_set_url            (LsmDomDocument *self,
                                                             const char *url);

### lsm_dom_document_set_path ()

    void                lsm_dom_document_set_path           (LsmDomDocument *self,
                                                             const char *path);

### lsm_dom_document_get_href_data ()

    void *              lsm_dom_document_get_href_data      (LsmDomDocument *self,
                                                             const char *href,
                                                             gsize *size);

`self` : | a LsmDomDocument
`href` : | href
`size` : | placeholder for the size of the returned data
Returns : | a newly allocated buffer containing the requested data. [transfer full]

### lsm_dom_get_entity ()

    const char *        lsm_dom_get_entity                  (const char *name);