Skip to content

Commit

Permalink
More doco updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Mar 17, 2024
1 parent c1d787d commit 143fa43
Show file tree
Hide file tree
Showing 11 changed files with 1,117 additions and 540 deletions.
554 changes: 371 additions & 183 deletions doc/mxml.3

Large diffs are not rendered by default.

Binary file modified doc/mxml.epub
Binary file not shown.
553 changes: 375 additions & 178 deletions doc/mxml.html

Large diffs are not rendered by default.

44 changes: 25 additions & 19 deletions mxml-attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ static bool mxml_set_attr(mxml_node_t *node, const char *name, char *value);


//
// 'mxmlElementClearAttr()' - Delete an attribute.
// 'mxmlElementClearAttr()' - Remove an attribute from an element.
//
// This function removes the attribute `name` from the element `node`.
//

void
Expand Down Expand Up @@ -63,13 +65,14 @@ mxmlElementClearAttr(mxml_node_t *node, // I - Element


//
// 'mxmlElementGetAttr()' - Get an attribute.
// 'mxmlElementGetAttr()' - Get the value of an attribute.
//
// This function returns @code NULL@ if the node is not an element or the
// named attribute does not exist.
// This function gets the value for the attribute `name` from the element
// `node`. `NULL` is returned if the node is not an element or the named
// attribute does not exist.
//

const char * // O - Attribute value or @code NULL@
const char * // O - Attribute value or `NULL`
mxmlElementGetAttr(mxml_node_t *node, // I - Element node
const char *name) // I - Name of attribute
{
Expand Down Expand Up @@ -103,17 +106,18 @@ mxmlElementGetAttr(mxml_node_t *node, // I - Element node


//
// 'mxmlElementGetAttrByIndex()' - Get an element attribute by index.
// 'mxmlElementGetAttrByIndex()' - Get an attribute by index.
//
// The index ("idx") is 0-based. @code NULL@ is returned if the specified index
// is out of range.
// This function returned the Nth (`idx`) attribute for element `node`. The
// attribute name is optionallly returned in the `name` argument. `NULL` is
// returned if node is not an element or the specified index is out of range.
//

const char * // O - Attribute value
mxmlElementGetAttrByIndex(
mxml_node_t *node, // I - Node
int idx, // I - Attribute index, starting at 0
const char **name) // O - Attribute name
int idx, // I - Attribute index, starting at `0`
const char **name) // O - Attribute name or `NULL` to not return it
{
if (!node || node->type != MXML_TYPE_ELEMENT || idx < 0 || idx >= node->value.element.num_attrs)
return (NULL);
Expand All @@ -128,6 +132,10 @@ mxmlElementGetAttrByIndex(
//
// 'mxmlElementGetAttrCount()' - Get the number of element attributes.
//
// This function returns the number of attributes for the element `node`. `0`
// is returned if the node is not an element or there are no attributes for the
// element.
//

size_t // O - Number of attributes
mxmlElementGetAttrCount(
Expand All @@ -141,12 +149,11 @@ mxmlElementGetAttrCount(


//
// 'mxmlElementSetAttr()' - Set an attribute.
// 'mxmlElementSetAttr()' - Set an attribute for an element.
//
// If the named attribute already exists, the value of the attribute
// is replaced by the new string value. The string value is copied
// into the element node. This function does nothing if the node is
// not an element.
// This function sets attribute `name` to the string `value` for the element
// `node`. If the named attribute already exists, the value of the attribute
// is replaced by the new string value. The string value is copied.
//

void
Expand Down Expand Up @@ -184,10 +191,9 @@ mxmlElementSetAttr(mxml_node_t *node, // I - Element node
//
// 'mxmlElementSetAttrf()' - Set an attribute with a formatted value.
//
// If the named attribute already exists, the value of the attribute
// is replaced by the new formatted string. The formatted string value is
// copied into the element node. This function does nothing if the node
// is not an element.
// This function sets attribute `name` to the formatted value of `format` for
// the element `node`. If the named attribute already exists, the value of the
// attribute is replaced by the new formatted string value.
//

void
Expand Down
16 changes: 16 additions & 0 deletions mxml-entity.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,22 @@
//
// 'mxmlEntityAddCallback()' - Add a callback to convert entities to Unicode.
//
// This function adds a callback to the current thread that converts named
// XML character entities to Unicode characters. The callback function `cb`
// accepts the callback data pointer `cbdata` and the entity name and returns a
// Unicode character value or `-1` if the entity is not known. For example, the
// following entity callback supports the "euro" entity:
//
// ```c
// int my_entity_cb(void *cbdata, const char *name)
// {
// if (!strcmp(name, "euro"))
// return (0x20ac);
// else
// return (-1);
// }
// ```
//

bool // O - `true` on success, `false` on failure
mxmlEntityAddCallback(
Expand Down
Loading

0 comments on commit 143fa43

Please sign in to comment.