LsmDomDocument: Lasem Reference Manual

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

## Functions

LsmDomDocument * | (*LsmDomDocumentCreateFunction) ()
LsmDomDocument * | lsm_dom_implementation_create_document ()
void | lsm_dom_implementation_cleanup ()
void | lsm_dom_document_append_from_memory ()
LsmDomDocument * | lsm_dom_document_new_from_memory ()
LsmDomDocument * | lsm_dom_document_new_from_path ()
LsmDomDocument * | lsm_dom_document_new_from_url ()
void | lsm_dom_document_save_to_stream ()
void | lsm_dom_document_save_to_memory ()
void | lsm_dom_document_save_to_path ()
void | lsm_dom_document_save_to_url ()
LsmDomElement * | lsm_dom_document_get_document_element ()
LsmDomElement * | lsm_dom_document_create_element ()
LsmDomText * | lsm_dom_document_create_text_node ()
LsmDomElement * | lsm_dom_document_get_element_by_id ()
void | lsm_dom_document_register_element ()
LsmDomView * | lsm_dom_document_create_view ()
const char * | lsm_dom_document_get_url ()
void | lsm_dom_document_set_url ()
void | lsm_dom_document_set_path ()
void * | lsm_dom_document_get_href_data ()
const char * | lsm_dom_get_entity ()

## Types and Values

| LsmDomDocument

## Object Hierarchy

        GObject
        ╰── LsmDomNode
            ╰── LsmDomDocument

## Description

## Functions

### LsmDomDocumentCreateFunction ()

    LsmDomDocument *
    (*LsmDomDocumentCreateFunction) (void);

### lsm_dom_implementation_create_document ()

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

#### Parameters

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.

#### Parameters

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);

#### Parameters

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);

#### Parameters

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);

#### Parameters

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);

#### Parameters

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);

#### Parameters

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);

#### Parameters

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);

#### Parameters

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);

## Types and Values

### LsmDomDocument

    typedef struct _LsmDomDocument LsmDomDocument;