mirror of
https://github.com/michaelrsweet/mxml.git
synced 2025-02-20 17:35:30 +00:00
Update/fix documentation.
Add mxmlNewOpaquef and mxmlSetOpaquef functions. Fix discussion writing code to look for opaque strings. Fix dependencies for documentation generation.
This commit is contained in:
parent
48c3c62521
commit
bcfa6ef518
@ -11,6 +11,8 @@
|
||||
- The mxmldoc utility now supports the `SOURCE_DATE_EPOCH` environment
|
||||
variable for reproducible builds (Issue #193)
|
||||
- The mxmldoc utility now supports Markdown (Issue #194)
|
||||
- Added `mxmlNewOpaquef` and `mxmlSetOpaquef` functions to add and set formatted
|
||||
opaque string values.
|
||||
|
||||
|
||||
# Changes in Mini-XML 2.10
|
||||
|
13
Makefile.in
13
Makefile.in
@ -360,7 +360,10 @@ testmxml.o: mxml.h
|
||||
# mxml.xml
|
||||
#
|
||||
|
||||
mxml.xml: mxmldoc-static mxml.h $(PUBLIBOBJS:.o=.c)
|
||||
mxml.xml: mxmldoc-static mxml.h $(PUBLIBOBJS:.o=.c) \
|
||||
doc/body.man doc/body.md \
|
||||
doc/docset.css doc/docset.header \
|
||||
doc/reference.header
|
||||
echo Generating API documentation...
|
||||
$(RM) mxml.xml
|
||||
./mxmldoc-static --header doc/reference.header \
|
||||
@ -390,13 +393,9 @@ mxml.xml: mxmldoc-static mxml.h $(PUBLIBOBJS:.o=.c)
|
||||
# mxml.epub
|
||||
#
|
||||
|
||||
mxml.epub: mxml.xml
|
||||
mxml.epub: mxml.xml doc/body.md doc/mxml-cover.png
|
||||
echo Generating EPUB API documentation...
|
||||
./mxmldoc-static --header doc/docset.header \
|
||||
--body doc/body.md \
|
||||
--docversion @VERSION@ --author "Michael R Sweet" \
|
||||
--copyright "Copyright 2003-2017, All Rights Reserved." \
|
||||
--title "Mini-XML API Reference" \
|
||||
./mxmldoc-static --body doc/body.md \
|
||||
--coverimage doc/mxml-cover.png \
|
||||
--epub mxml.epub mxml.xml
|
||||
|
||||
|
1101
doc/body.md
1101
doc/body.md
File diff suppressed because it is too large
Load Diff
204
doc/mxml.man
204
doc/mxml.man
@ -1,4 +1,4 @@
|
||||
.TH mxml 3 "Mini-XML API" "04/23/17" "Mini-XML API"
|
||||
.TH mxml 3 "Mini-XML API" "04/24/17" "Mini-XML API"
|
||||
.SH NAME
|
||||
mxml \- Mini-XML API
|
||||
.SH INCLUDE FILE
|
||||
@ -244,12 +244,12 @@ void mxmlAdd (
|
||||
);
|
||||
.fi
|
||||
.PP
|
||||
Adds the specified node to the parent. If the child argument is not
|
||||
NULL, puts the new node before or after the specified child depending
|
||||
on the value of the where argument. If the child argument is NULL,
|
||||
puts the new node at the beginning of the child list (MXML_ADD_BEFORE)
|
||||
or at the end of the child list (MXML_ADD_AFTER). The constant
|
||||
MXML_ADD_TO_PARENT can be used to specify a NULL child pointer.
|
||||
Adds the specified node to the parent. If the child argument is not
|
||||
\fBNULL\fR, puts the new node before or after the specified child depending
|
||||
on the value of the where argument. If the child argument is \fBNULL\fR,
|
||||
puts the new node at the beginning of the child list (\fBMXML_ADD_BEFORE\fR)
|
||||
or at the end of the child list (\fBMXML_ADD_AFTER\fR). The constant
|
||||
\fBMXML_ADD_TO_PARENT\fR can be used to specify a \fBNULL\fR child pointer.
|
||||
.SS mxmlDelete
|
||||
Delete a node and all of its children.
|
||||
.PP
|
||||
@ -260,7 +260,7 @@ void mxmlDelete (
|
||||
.fi
|
||||
.PP
|
||||
If the specified node has a parent, this function first removes the
|
||||
node from its parent using the mxmlRemove() function.
|
||||
node from its parent using the \fImxmlRemove\fR function.
|
||||
.SS mxmlElementDeleteAttr
|
||||
Delete an attribute.
|
||||
.PP
|
||||
@ -282,7 +282,7 @@ const char * mxmlElementGetAttr (
|
||||
);
|
||||
.fi
|
||||
.PP
|
||||
This function returns NULL if the node is not an element or the
|
||||
This function returns \fBNULL\fR if the node is not an element or the
|
||||
named attribute does not exist.
|
||||
.SS mxmlElementGetAttrByIndex
|
||||
Get an element attribute by index.
|
||||
@ -359,7 +359,7 @@ const char * mxmlEntityGetName (
|
||||
);
|
||||
.fi
|
||||
.PP
|
||||
If val does not need to be represented by a named entity, NULL is returned.
|
||||
If val does not need to be represented by a named entity, \fBNULL\fR is returned.
|
||||
.SS mxmlEntityGetValue
|
||||
Get the character corresponding to a named entity.
|
||||
.PP
|
||||
@ -386,7 +386,7 @@ Find the named element.
|
||||
mxml_node_t * mxmlFindElement (
|
||||
mxml_node_t *node,
|
||||
mxml_node_t *top,
|
||||
const char *name,
|
||||
const char *element,
|
||||
const char *attr,
|
||||
const char *value,
|
||||
int descend
|
||||
@ -394,12 +394,12 @@ mxml_node_t * mxmlFindElement (
|
||||
.fi
|
||||
.PP
|
||||
The search is constrained by the name, attribute name, and value; any
|
||||
NULL names or values are treated as wildcards, so different kinds of
|
||||
\fBNULL\fR names or values are treated as wildcards, so different kinds of
|
||||
searches can be implemented by looking for all elements of a given name
|
||||
or all elements with a specific attribute. The descend argument determines
|
||||
whether the search descends into child nodes; normally you will use
|
||||
MXML_DESCEND_FIRST for the initial search and MXML_NO_DESCEND to find
|
||||
additional direct descendents of the node. The top node argument
|
||||
\fBMXML_DESCEND_FIRST\fR for the initial search and \fBMXML_NO_DESCEND\fR
|
||||
to find additional direct descendents of the node. The top node argument
|
||||
constrains the search to a particular node's children.
|
||||
.SS mxmlFindPath
|
||||
Find a node with the given path.
|
||||
@ -577,7 +577,7 @@ const char * mxmlGetText (
|
||||
.fi
|
||||
.PP
|
||||
\fBNULL\fR is returned if the node (or its first child) is not a text node.
|
||||
The "whitespace" argument can be NULL.
|
||||
The "whitespace" argument can be \fBNULL\fR.
|
||||
|
||||
|
||||
.SS mxmlGetType
|
||||
@ -619,7 +619,9 @@ mxml_node_t * mxmlIndexEnum (
|
||||
);
|
||||
.fi
|
||||
.PP
|
||||
Nodes are returned in the sorted order of the index.
|
||||
You should call \fImxmlIndexReset\fR prior to using this function to get
|
||||
the first node in the index. Nodes are returned in the sorted order of the
|
||||
index.
|
||||
.SS mxmlIndexFind
|
||||
Find the next matching node.
|
||||
.PP
|
||||
@ -631,10 +633,10 @@ mxml_node_t * mxmlIndexFind (
|
||||
);
|
||||
.fi
|
||||
.PP
|
||||
You should call mxmlIndexReset() prior to using this function for
|
||||
You should call \fImxmlIndexReset\fR prior to using this function for
|
||||
the first time with a particular set of "element" and "value"
|
||||
strings. Passing NULL for both "element" and "value" is equivalent
|
||||
to calling mxmlIndexEnum().
|
||||
strings. Passing \fBNULL\fR for both "element" and "value" is equivalent
|
||||
to calling \fImxmlIndexEnum\fR.
|
||||
.SS mxmlIndexGetCount
|
||||
Get the number of nodes in an index.
|
||||
.PP
|
||||
@ -657,7 +659,7 @@ mxml_index_t * mxmlIndexNew (
|
||||
.fi
|
||||
.PP
|
||||
The index will contain all nodes that contain the named element and/or
|
||||
attribute. If both "element" and "attr" are NULL, then the index will
|
||||
attribute. If both "element" and "attr" are \fBNULL\fR, then the index will
|
||||
contain a sorted list of the elements in the node tree. Nodes are
|
||||
sorted by element name and optionally by attribute value if the "attr"
|
||||
argument is not NULL.
|
||||
@ -671,8 +673,8 @@ mxml_node_t * mxmlIndexReset (
|
||||
);
|
||||
.fi
|
||||
.PP
|
||||
This function should be called prior to using mxmlIndexEnum() or
|
||||
mxmlIndexFind() for the first time.
|
||||
This function should be called prior to using \fImxmlIndexEnum\fR or
|
||||
\fImxmlIndexFind\fR for the first time.
|
||||
.SS mxmlLoadFd
|
||||
Load a file descriptor into an XML node tree.
|
||||
.PP
|
||||
@ -688,12 +690,9 @@ The nodes in the specified file are added to the specified top node.
|
||||
If no top node is provided, the XML file MUST be well-formed with a
|
||||
single parent node like <?xml> for the entire file. The callback
|
||||
function returns the value type that should be used for child nodes.
|
||||
If MXML_NO_CALLBACK is specified then all child nodes will be either
|
||||
MXML_ELEMENT or MXML_TEXT nodes.
|
||||
.PP
|
||||
The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK,
|
||||
MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading
|
||||
child nodes of the specified type.
|
||||
The constants \fBMXML_INTEGER_CALLBACK\fR, \fBMXML_OPAQUE_CALLBACK\fR,
|
||||
\fBMXML_REAL_CALLBACK\fR, and \fBMXML_TEXT_CALLBACK\fR are defined for
|
||||
loading child (data) nodes of the specified type.
|
||||
.SS mxmlLoadFile
|
||||
Load a file into an XML node tree.
|
||||
.PP
|
||||
@ -709,12 +708,9 @@ The nodes in the specified file are added to the specified top node.
|
||||
If no top node is provided, the XML file MUST be well-formed with a
|
||||
single parent node like <?xml> for the entire file. The callback
|
||||
function returns the value type that should be used for child nodes.
|
||||
If MXML_NO_CALLBACK is specified then all child nodes will be either
|
||||
MXML_ELEMENT or MXML_TEXT nodes.
|
||||
.PP
|
||||
The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK,
|
||||
MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading
|
||||
child nodes of the specified type.
|
||||
The constants \fBMXML_INTEGER_CALLBACK\fR, \fBMXML_OPAQUE_CALLBACK\fR,
|
||||
\fBMXML_REAL_CALLBACK\fR, and \fBMXML_TEXT_CALLBACK\fR are defined for
|
||||
loading child (data) nodes of the specified type.
|
||||
.SS mxmlLoadString
|
||||
Load a string into an XML node tree.
|
||||
.PP
|
||||
@ -730,12 +726,9 @@ The nodes in the specified string are added to the specified top node.
|
||||
If no top node is provided, the XML string MUST be well-formed with a
|
||||
single parent node like <?xml> for the entire string. The callback
|
||||
function returns the value type that should be used for child nodes.
|
||||
If MXML_NO_CALLBACK is specified then all child nodes will be either
|
||||
MXML_ELEMENT or MXML_TEXT nodes.
|
||||
.PP
|
||||
The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK,
|
||||
MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading
|
||||
child nodes of the specified type.
|
||||
The constants \fBMXML_INTEGER_CALLBACK\fR, \fBMXML_OPAQUE_CALLBACK\fR,
|
||||
\fBMXML_REAL_CALLBACK\fR, and \fBMXML_TEXT_CALLBACK\fR are defined for
|
||||
loading child (data) nodes of the specified type.
|
||||
.SS mxmlNewCDATA
|
||||
Create a new CDATA node.
|
||||
.PP
|
||||
@ -747,9 +740,10 @@ mxml_node_t * mxmlNewCDATA (
|
||||
.fi
|
||||
.PP
|
||||
The new CDATA node is added to the end of the specified parent's child
|
||||
list. The constant MXML_NO_PARENT can be used to specify that the new
|
||||
CDATA node has no parent. The data string must be nul-terminated and
|
||||
is copied into the new node. CDATA nodes use the MXML_ELEMENT type.
|
||||
list. The constant \fBMXML_NO_PARENT\fR can be used to specify that the new
|
||||
CDATA node has no parent. The data string must be nul-terminated and
|
||||
is copied into the new node. CDATA nodes currently use the
|
||||
\fBMXML_ELEMENT\fR type.
|
||||
|
||||
|
||||
.SS mxmlNewCustom
|
||||
@ -764,8 +758,8 @@ mxml_node_t * mxmlNewCustom (
|
||||
.fi
|
||||
.PP
|
||||
The new custom node is added to the end of the specified parent's child
|
||||
list. The constant MXML_NO_PARENT can be used to specify that the new
|
||||
element node has no parent. NULL can be passed when the data in the
|
||||
list. The constant \fBMXML_NO_PARENT\fR can be used to specify that the new
|
||||
element node has no parent. \fBNULL\fR can be passed when the data in the
|
||||
node is not dynamically allocated or is separately managed.
|
||||
|
||||
|
||||
@ -780,7 +774,7 @@ mxml_node_t * mxmlNewElement (
|
||||
.fi
|
||||
.PP
|
||||
The new element node is added to the end of the specified parent's child
|
||||
list. The constant MXML_NO_PARENT can be used to specify that the new
|
||||
list. The constant \fBMXML_NO_PARENT\fR can be used to specify that the new
|
||||
element node has no parent.
|
||||
.SS mxmlNewInteger
|
||||
Create a new integer node.
|
||||
@ -793,7 +787,7 @@ mxml_node_t * mxmlNewInteger (
|
||||
.fi
|
||||
.PP
|
||||
The new integer node is added to the end of the specified parent's child
|
||||
list. The constant MXML_NO_PARENT can be used to specify that the new
|
||||
list. The constant \fBMXML_NO_PARENT\fR can be used to specify that the new
|
||||
integer node has no parent.
|
||||
.SS mxmlNewOpaque
|
||||
Create a new opaque string.
|
||||
@ -805,10 +799,25 @@ mxml_node_t * mxmlNewOpaque (
|
||||
);
|
||||
.fi
|
||||
.PP
|
||||
The new opaque node is added to the end of the specified parent's child
|
||||
list. The constant MXML_NO_PARENT can be used to specify that the new
|
||||
opaque node has no parent. The opaque string must be nul-terminated and
|
||||
is copied into the new node.
|
||||
The new opaque string node is added to the end of the specified parent's
|
||||
child list. The constant \fBMXML_NO_PARENT\fR can be used to specify that
|
||||
the new opaque string node has no parent. The opaque string must be nul-
|
||||
terminated and is copied into the new node.
|
||||
.SS mxmlNewOpaquef
|
||||
Create a new formatted opaque string node.
|
||||
.PP
|
||||
.nf
|
||||
mxml_node_t * mxmlNewOpaquef (
|
||||
mxml_node_t *parent,
|
||||
const char *format,
|
||||
...
|
||||
);
|
||||
.fi
|
||||
.PP
|
||||
The new opaque string node is added to the end of the specified parent's
|
||||
child list. The constant \fBMXML_NO_PARENT\fR can be used to specify that
|
||||
the new opaque string node has no parent. The format string must be
|
||||
nul-terminated and is formatted into the new node.
|
||||
.SS mxmlNewReal
|
||||
Create a new real number node.
|
||||
.PP
|
||||
@ -820,7 +829,7 @@ mxml_node_t * mxmlNewReal (
|
||||
.fi
|
||||
.PP
|
||||
The new real number node is added to the end of the specified parent's
|
||||
child list. The constant MXML_NO_PARENT can be used to specify that
|
||||
child list. The constant \fBMXML_NO_PARENT\fR can be used to specify that
|
||||
the new real number node has no parent.
|
||||
.SS mxmlNewText
|
||||
Create a new text fragment node.
|
||||
@ -834,9 +843,9 @@ mxml_node_t * mxmlNewText (
|
||||
.fi
|
||||
.PP
|
||||
The new text node is added to the end of the specified parent's child
|
||||
list. The constant MXML_NO_PARENT can be used to specify that the new
|
||||
text node has no parent. The whitespace parameter is used to specify
|
||||
whether leading whitespace is present before the node. The text
|
||||
list. The constant \fBMXML_NO_PARENT\fR can be used to specify that the new
|
||||
text node has no parent. The whitespace parameter is used to specify
|
||||
whether leading whitespace is present before the node. The text
|
||||
string must be nul-terminated and is copied into the new node.
|
||||
.SS mxmlNewTextf
|
||||
Create a new formatted text fragment node.
|
||||
@ -851,9 +860,9 @@ mxml_node_t * mxmlNewTextf (
|
||||
.fi
|
||||
.PP
|
||||
The new text node is added to the end of the specified parent's child
|
||||
list. The constant MXML_NO_PARENT can be used to specify that the new
|
||||
text node has no parent. The whitespace parameter is used to specify
|
||||
whether leading whitespace is present before the node. The format
|
||||
list. The constant \fBMXML_NO_PARENT\fR can be used to specify that the new
|
||||
text node has no parent. The whitespace parameter is used to specify
|
||||
whether leading whitespace is present before the node. The format
|
||||
string must be nul-terminated and is formatted into the new node.
|
||||
.SS mxmlNewXML
|
||||
Create a new XML document tree.
|
||||
@ -865,7 +874,7 @@ mxml_node_t * mxmlNewXML (
|
||||
.fi
|
||||
.PP
|
||||
The "version" argument specifies the version number to put in the
|
||||
?xml element node. If NULL, version 1.0 is assumed.
|
||||
?xml element node. If \fBNULL\fR, version "1.0" is assumed.
|
||||
|
||||
|
||||
.SS mxmlRelease
|
||||
@ -878,7 +887,7 @@ int mxmlRelease (
|
||||
.fi
|
||||
.PP
|
||||
When the reference count reaches zero, the node (and any children)
|
||||
is deleted via mxmlDelete().
|
||||
is deleted via \fImxmlDelete\fR.
|
||||
|
||||
|
||||
.SS mxmlRemove
|
||||
@ -890,8 +899,8 @@ void mxmlRemove (
|
||||
);
|
||||
.fi
|
||||
.PP
|
||||
Does not free memory used by the node - use mxmlDelete() for that.
|
||||
This function does nothing if the node has no parent.
|
||||
This function does not free memory used by the node - use \fImxmlDelete\fR
|
||||
for that. This function does nothing if the node has no parent.
|
||||
.SS mxmlRetain
|
||||
Retain a node.
|
||||
.PP
|
||||
@ -920,14 +929,11 @@ The nodes in the specified file are added to the specified top node.
|
||||
If no top node is provided, the XML file MUST be well-formed with a
|
||||
single parent node like <?xml> for the entire file. The callback
|
||||
function returns the value type that should be used for child nodes.
|
||||
If MXML_NO_CALLBACK is specified then all child nodes will be either
|
||||
MXML_ELEMENT or MXML_TEXT nodes.
|
||||
The constants \fBMXML_INTEGER_CALLBACK\fR, \fBMXML_OPAQUE_CALLBACK\fR,
|
||||
\fBMXML_REAL_CALLBACK\fR, and \fBMXML_TEXT_CALLBACK\fR are defined for
|
||||
loading child nodes of the specified type.
|
||||
.PP
|
||||
The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK,
|
||||
MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading
|
||||
child nodes of the specified type.
|
||||
.PP
|
||||
The SAX callback must call mxmlRetain() for any nodes that need to
|
||||
The SAX callback must call \fImxmlRetain\fR for any nodes that need to
|
||||
be kept for later use. Otherwise, nodes are deleted when the parent
|
||||
node is closed or after each data, comment, CDATA, or directive node.
|
||||
|
||||
@ -950,14 +956,11 @@ The nodes in the specified file are added to the specified top node.
|
||||
If no top node is provided, the XML file MUST be well-formed with a
|
||||
single parent node like <?xml> for the entire file. The callback
|
||||
function returns the value type that should be used for child nodes.
|
||||
If MXML_NO_CALLBACK is specified then all child nodes will be either
|
||||
MXML_ELEMENT or MXML_TEXT nodes.
|
||||
The constants \fBMXML_INTEGER_CALLBACK\fR, \fBMXML_OPAQUE_CALLBACK\fR,
|
||||
\fBMXML_REAL_CALLBACK\fR, and \fBMXML_TEXT_CALLBACK\fR are defined for
|
||||
loading child nodes of the specified type.
|
||||
.PP
|
||||
The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK,
|
||||
MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading
|
||||
child nodes of the specified type.
|
||||
.PP
|
||||
The SAX callback must call mxmlRetain() for any nodes that need to
|
||||
The SAX callback must call \fImxmlRetain\fR for any nodes that need to
|
||||
be kept for later use. Otherwise, nodes are deleted when the parent
|
||||
node is closed or after each data, comment, CDATA, or directive node.
|
||||
|
||||
@ -980,14 +983,11 @@ The nodes in the specified string are added to the specified top node.
|
||||
If no top node is provided, the XML string MUST be well-formed with a
|
||||
single parent node like <?xml> for the entire string. The callback
|
||||
function returns the value type that should be used for child nodes.
|
||||
If MXML_NO_CALLBACK is specified then all child nodes will be either
|
||||
MXML_ELEMENT or MXML_TEXT nodes.
|
||||
The constants \fBMXML_INTEGER_CALLBACK\fR, \fBMXML_OPAQUE_CALLBACK\fR,
|
||||
\fBMXML_REAL_CALLBACK\fR, and \fBMXML_TEXT_CALLBACK\fR are defined for
|
||||
loading child nodes of the specified type.
|
||||
.PP
|
||||
The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK,
|
||||
MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading
|
||||
child nodes of the specified type.
|
||||
.PP
|
||||
The SAX callback must call mxmlRetain() for any nodes that need to
|
||||
The SAX callback must call \fImxmlRetain\fR for any nodes that need to
|
||||
be kept for later use. Otherwise, nodes are deleted when the parent
|
||||
node is closed or after each data, comment, CDATA, or directive node.
|
||||
|
||||
@ -1004,13 +1004,13 @@ char * mxmlSaveAllocString (
|
||||
.PP
|
||||
This function returns a pointer to a string containing the textual
|
||||
representation of the XML node tree. The string should be freed
|
||||
using the free() function when you are done with it. NULL is returned
|
||||
using the free() function when you are done with it. \fBNULL\fR is returned
|
||||
if the node would produce an empty string or if the string cannot be
|
||||
allocated.
|
||||
.PP
|
||||
The callback argument specifies a function that returns a whitespace
|
||||
string or NULL before and after each element. If MXML_NO_CALLBACK
|
||||
is specified, whitespace will only be added before MXML_TEXT nodes
|
||||
string or NULL before and after each element. If \fBMXML_NO_CALLBACK\fR
|
||||
is specified, whitespace will only be added before \fBMXML_TEXT\fR nodes
|
||||
with leading whitespace and before attribute names inside opening
|
||||
element tags.
|
||||
.SS mxmlSaveFd
|
||||
@ -1025,8 +1025,8 @@ int mxmlSaveFd (
|
||||
.fi
|
||||
.PP
|
||||
The callback argument specifies a function that returns a whitespace
|
||||
string or NULL before and after each element. If MXML_NO_CALLBACK
|
||||
is specified, whitespace will only be added before MXML_TEXT nodes
|
||||
string or NULL before and after each element. If \fBMXML_NO_CALLBACK\fR
|
||||
is specified, whitespace will only be added before \fBMXML_TEXT\fR nodes
|
||||
with leading whitespace and before attribute names inside opening
|
||||
element tags.
|
||||
.SS mxmlSaveFile
|
||||
@ -1041,8 +1041,8 @@ int mxmlSaveFile (
|
||||
.fi
|
||||
.PP
|
||||
The callback argument specifies a function that returns a whitespace
|
||||
string or NULL before and after each element. If MXML_NO_CALLBACK
|
||||
is specified, whitespace will only be added before MXML_TEXT nodes
|
||||
string or NULL before and after each element. If \fBMXML_NO_CALLBACK\fR
|
||||
is specified, whitespace will only be added before \fBMXML_TEXT\fR nodes
|
||||
with leading whitespace and before attribute names inside opening
|
||||
element tags.
|
||||
.SS mxmlSaveString
|
||||
@ -1062,8 +1062,8 @@ required for the string but only copies (bufsize - 1) characters
|
||||
into the specified buffer.
|
||||
.PP
|
||||
The callback argument specifies a function that returns a whitespace
|
||||
string or NULL before and after each element. If MXML_NO_CALLBACK
|
||||
is specified, whitespace will only be added before MXML_TEXT nodes
|
||||
string or NULL before and after each element. If \fBMXML_NO_CALLBACK\fR
|
||||
is specified, whitespace will only be added before \fBMXML_TEXT\fR nodes
|
||||
with leading whitespace and before attribute names inside opening
|
||||
element tags.
|
||||
.SS mxmlSetCDATA
|
||||
@ -1107,7 +1107,7 @@ The load function accepts a node pointer and a data string and must
|
||||
return 0 on success and non-zero on error.
|
||||
.PP
|
||||
The save function accepts a node pointer and must return a malloc'd
|
||||
string on success and NULL on error.
|
||||
string on success and \fBNULL\fR on error.
|
||||
.SS mxmlSetElement
|
||||
Set the name of an element node.
|
||||
.PP
|
||||
@ -1149,6 +1149,20 @@ int mxmlSetOpaque (
|
||||
.fi
|
||||
.PP
|
||||
The node is not changed if it (or its first child) is not an opaque node.
|
||||
.SS mxmlSetOpaquef
|
||||
Set the value of an opaque string node to a formatted string.
|
||||
.PP
|
||||
.nf
|
||||
int mxmlSetOpaquef (
|
||||
mxml_node_t *node,
|
||||
const char *format,
|
||||
...
|
||||
);
|
||||
.fi
|
||||
.PP
|
||||
The node is not changed if it (or its first child) is not an opaque node.
|
||||
|
||||
|
||||
.SS mxmlSetReal
|
||||
Set the value of a real number node.
|
||||
.PP
|
||||
@ -1220,7 +1234,7 @@ mxml_node_t * mxmlWalkNext (
|
||||
.fi
|
||||
.PP
|
||||
The descend argument controls whether the first child is considered
|
||||
to be the next node. The top node argument constrains the walk to
|
||||
to be the next node. The top node argument constrains the walk to
|
||||
the node's children.
|
||||
.SS mxmlWalkPrev
|
||||
Walk to the previous logical node in the tree.
|
||||
@ -1234,7 +1248,7 @@ mxml_node_t * mxmlWalkPrev (
|
||||
.fi
|
||||
.PP
|
||||
The descend argument controls whether the previous node's last child
|
||||
is considered to be the previous node. The top node argument constrains
|
||||
is considered to be the previous node. The top node argument constrains
|
||||
the walk to the node's children.
|
||||
.SH TYPES
|
||||
.SS mxml_custom_destroy_cb_t
|
||||
|
@ -85,11 +85,20 @@ div.contents ul.contents {
|
||||
}
|
||||
.variable {
|
||||
}
|
||||
blockquote {
|
||||
border: solid thin gray;
|
||||
box-shadow: 3px 3px 5px rgba(0,0,0,0.5);
|
||||
padding: 0px 10px;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
p code, li code, p.code, pre, ul.code li {
|
||||
background: rgba(127,127,127,0.1);
|
||||
border: thin dotted gray;
|
||||
font-family: monospace;
|
||||
font-size: 90%;
|
||||
hyphens: manual;
|
||||
-webkit-hyphens: manual;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
p.code, pre, ul.code li {
|
||||
padding: 10px;
|
||||
@ -196,6 +205,7 @@ h3.title {
|
||||
<li><a href="#mxmlNewElement">mxmlNewElement</a></li>
|
||||
<li><a href="#mxmlNewInteger">mxmlNewInteger</a></li>
|
||||
<li><a href="#mxmlNewOpaque">mxmlNewOpaque</a></li>
|
||||
<li><a href="#mxmlNewOpaquef">mxmlNewOpaquef</a></li>
|
||||
<li><a href="#mxmlNewReal">mxmlNewReal</a></li>
|
||||
<li><a href="#mxmlNewText">mxmlNewText</a></li>
|
||||
<li><a href="#mxmlNewTextf">mxmlNewTextf</a></li>
|
||||
@ -217,6 +227,7 @@ h3.title {
|
||||
<li><a href="#mxmlSetErrorCallback">mxmlSetErrorCallback</a></li>
|
||||
<li><a href="#mxmlSetInteger">mxmlSetInteger</a></li>
|
||||
<li><a href="#mxmlSetOpaque">mxmlSetOpaque</a></li>
|
||||
<li><a href="#mxmlSetOpaquef">mxmlSetOpaquef</a></li>
|
||||
<li><a href="#mxmlSetReal">mxmlSetReal</a></li>
|
||||
<li><a href="#mxmlSetText">mxmlSetText</a></li>
|
||||
<li><a href="#mxmlSetTextf">mxmlSetTextf</a></li>
|
||||
@ -261,19 +272,12 @@ void mxmlAdd (<br>
|
||||
<dt>parent</dt>
|
||||
<dd class="description">Parent node</dd>
|
||||
<dt>where</dt>
|
||||
<dd class="description">Where to add, MXML_ADD_BEFORE or MXML_ADD_AFTER</dd>
|
||||
<dd class="description">Where to add, <code>MXML_ADD_BEFORE</code> or <code>MXML_ADD_AFTER</code></dd>
|
||||
<dt>child</dt>
|
||||
<dd class="description">Child node for where or MXML_ADD_TO_PARENT</dd>
|
||||
<dd class="description">Child node for where or <code>MXML_ADD_TO_PARENT</code></dd>
|
||||
<dt>node</dt>
|
||||
<dd class="description">Node to add</dd>
|
||||
</dl>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">Adds the specified node to the parent. If the child argument is not
|
||||
NULL, puts the new node before or after the specified child depending
|
||||
on the value of the where argument. If the child argument is NULL,
|
||||
puts the new node at the beginning of the child list (MXML_ADD_BEFORE)
|
||||
or at the end of the child list (MXML_ADD_AFTER). The constant
|
||||
MXML_ADD_TO_PARENT can be used to specify a NULL child pointer.</p>
|
||||
<h3 class="function"><a id="mxmlDelete">mxmlDelete</a></h3>
|
||||
<p class="description">Delete a node and all of its children.</p>
|
||||
<p class="code">
|
||||
@ -285,9 +289,6 @@ void mxmlDelete (<br>
|
||||
<dt>node</dt>
|
||||
<dd class="description">Node to delete</dd>
|
||||
</dl>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">If the specified node has a parent, this function first removes the
|
||||
node from its parent using the mxmlRemove() function.</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.4 </span><a id="mxmlElementDeleteAttr">mxmlElementDeleteAttr</a></h3>
|
||||
<p class="description">Delete an attribute.</p>
|
||||
<p class="code">
|
||||
@ -317,10 +318,7 @@ const char *mxmlElementGetAttr (<br>
|
||||
<dd class="description">Name of attribute</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Attribute value or NULL</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">This function returns NULL if the node is not an element or the
|
||||
named attribute does not exist.</p>
|
||||
<p class="description">Attribute value or <code>NULL</code></p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.11 </span><a id="mxmlElementGetAttrByIndex">mxmlElementGetAttrByIndex</a></h3>
|
||||
<p class="description">Get an element attribute by index.</p>
|
||||
<p class="code">
|
||||
@ -340,11 +338,6 @@ const char *mxmlElementGetAttrByIndex (<br>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Attribute value</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The index ("idx") is 0-based. <code>NULL</code> is returned if the specified index
|
||||
is out of range.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.11 </span><a id="mxmlElementGetAttrCount">mxmlElementGetAttrCount</a></h3>
|
||||
<p class="description">Get the number of element attributes.</p>
|
||||
<p class="code">
|
||||
@ -375,11 +368,6 @@ void mxmlElementSetAttr (<br>
|
||||
<dt>value</dt>
|
||||
<dd class="description">Attribute value</dd>
|
||||
</dl>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">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.</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.3 </span><a id="mxmlElementSetAttrf">mxmlElementSetAttrf</a></h3>
|
||||
<p class="description">Set an attribute with a formatted value.</p>
|
||||
<p class="code">
|
||||
@ -400,13 +388,6 @@ void mxmlElementSetAttrf (<br>
|
||||
<dt>...</dt>
|
||||
<dd class="description">Additional arguments as needed</dd>
|
||||
</dl>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">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.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><a id="mxmlEntityAddCallback">mxmlEntityAddCallback</a></h3>
|
||||
<p class="description">Add a callback to convert entities to Unicode.</p>
|
||||
<p class="code">
|
||||
@ -432,9 +413,7 @@ const char *mxmlEntityGetName (<br>
|
||||
<dd class="description">Character value</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Entity name or NULL</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">If val does not need to be represented by a named entity, NULL is returned.</p>
|
||||
<p class="description">Entity name or <code>NULL</code></p>
|
||||
<h3 class="function"><a id="mxmlEntityGetValue">mxmlEntityGetValue</a></h3>
|
||||
<p class="description">Get the character corresponding to a named entity.</p>
|
||||
<p class="code">
|
||||
@ -448,9 +427,6 @@ int mxmlEntityGetValue (<br>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Character value or -1 on error</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The entity name can also be a numeric constant. -1 is returned if the
|
||||
name is not known.</p>
|
||||
<h3 class="function"><a id="mxmlEntityRemoveCallback">mxmlEntityRemoveCallback</a></h3>
|
||||
<p class="description">Remove a callback.</p>
|
||||
<p class="code">
|
||||
@ -468,7 +444,7 @@ void mxmlEntityRemoveCallback (<br>
|
||||
<a href="#mxml_node_t">mxml_node_t</a> *mxmlFindElement (<br>
|
||||
    <a href="#mxml_node_t">mxml_node_t</a> *node,<br>
|
||||
    <a href="#mxml_node_t">mxml_node_t</a> *top,<br>
|
||||
    const char *name,<br>
|
||||
    const char *element,<br>
|
||||
    const char *attr,<br>
|
||||
    const char *value,<br>
|
||||
    int descend<br>
|
||||
@ -479,26 +455,17 @@ void mxmlEntityRemoveCallback (<br>
|
||||
<dd class="description">Current node</dd>
|
||||
<dt>top</dt>
|
||||
<dd class="description">Top node</dd>
|
||||
<dt>name</dt>
|
||||
<dd class="description">Element name or NULL for any</dd>
|
||||
<dt>element</dt>
|
||||
<dd class="description">Element name or <code>NULL</code> for any</dd>
|
||||
<dt>attr</dt>
|
||||
<dd class="description">Attribute name, or NULL for none</dd>
|
||||
<dd class="description">Attribute name, or <code>NULL</code> for none</dd>
|
||||
<dt>value</dt>
|
||||
<dd class="description">Attribute value, or NULL for any</dd>
|
||||
<dd class="description">Attribute value, or <code>NULL</code> for any</dd>
|
||||
<dt>descend</dt>
|
||||
<dd class="description">Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST</dd>
|
||||
<dd class="description">Descend into tree - <code>MXML_DESCEND</code>, <code>MXML_NO_DESCEND</code>, or <code>MXML_DESCEND_FIRST</code></dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Element node or NULL</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The search is constrained by the name, attribute name, and value; any
|
||||
NULL names or values are treated as wildcards, so different kinds of
|
||||
searches can be implemented by looking for all elements of a given name
|
||||
or all elements with a specific attribute. The descend argument determines
|
||||
whether the search descends into child nodes; normally you will use
|
||||
MXML_DESCEND_FIRST for the initial search and MXML_NO_DESCEND to find
|
||||
additional direct descendents of the node. The top node argument
|
||||
constrains the search to a particular node's children.</p>
|
||||
<p class="description">Element node or <code>NULL</code></p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a id="mxmlFindPath">mxmlFindPath</a></h3>
|
||||
<p class="description">Find a node with the given path.</p>
|
||||
<p class="code">
|
||||
@ -514,16 +481,7 @@ constrains the search to a particular node's children.</p>
|
||||
<dd class="description">Path to element</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Found node or NULL</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The "path" is a slash-separated list of element names. The name "*" is
|
||||
considered a wildcard for one or more levels of elements. For example,
|
||||
"foo/one/two", "bar/two/one", "*/one", and so forth.<br>
|
||||
<br>
|
||||
The first child node of the found node is returned if the given node has
|
||||
children and the first child is a value node.
|
||||
|
||||
</p>
|
||||
<p class="description">Found node or <code>NULL</code></p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a id="mxmlGetCDATA">mxmlGetCDATA</a></h3>
|
||||
<p class="description">Get the value for a CDATA node.</p>
|
||||
<p class="code">
|
||||
@ -536,11 +494,7 @@ const char *mxmlGetCDATA (<br>
|
||||
<dd class="description">Node to get</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">CDATA value or NULL</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion"><code>NULL</code> is returned if the node is not a CDATA element.
|
||||
|
||||
</p>
|
||||
<p class="description">CDATA value or <code>NULL</code></p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a id="mxmlGetCustom">mxmlGetCustom</a></h3>
|
||||
<p class="description">Get the value for a custom node.</p>
|
||||
<p class="code">
|
||||
@ -553,12 +507,7 @@ const void *mxmlGetCustom (<br>
|
||||
<dd class="description">Node to get</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Custom value or NULL</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion"><code>NULL</code> is returned if the node (or its first child) is not a custom
|
||||
value node.
|
||||
|
||||
</p>
|
||||
<p class="description">Custom value or <code>NULL</code></p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a id="mxmlGetElement">mxmlGetElement</a></h3>
|
||||
<p class="description">Get the name for an element node.</p>
|
||||
<p class="code">
|
||||
@ -571,11 +520,7 @@ const char *mxmlGetElement (<br>
|
||||
<dd class="description">Node to get</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Element name or NULL</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion"><code>NULL</code> is returned if the node is not an element node.
|
||||
|
||||
</p>
|
||||
<p class="description">Element name or <code>NULL</code></p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a id="mxmlGetFirstChild">mxmlGetFirstChild</a></h3>
|
||||
<p class="description">Get the first child of an element node.</p>
|
||||
<p class="code">
|
||||
@ -588,12 +533,7 @@ const char *mxmlGetElement (<br>
|
||||
<dd class="description">Node to get</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">First child or NULL</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion"><code>NULL</code> is returned if the node is not an element node or if the node
|
||||
has no children.
|
||||
|
||||
</p>
|
||||
<p class="description">First child or <code>NULL</code></p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a id="mxmlGetInteger">mxmlGetInteger</a></h3>
|
||||
<p class="description">Get the integer value from the specified node or its
|
||||
first child.</p>
|
||||
@ -608,10 +548,6 @@ int mxmlGetInteger (<br>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Integer value or 0</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">0 is returned if the node (or its first child) is not an integer value node.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a id="mxmlGetLastChild">mxmlGetLastChild</a></h3>
|
||||
<p class="description">Get the last child of an element node.</p>
|
||||
<p class="code">
|
||||
@ -624,12 +560,7 @@ int mxmlGetInteger (<br>
|
||||
<dd class="description">Node to get</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Last child or NULL</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion"><code>NULL</code> is returned if the node is not an element node or if the node
|
||||
has no children.
|
||||
|
||||
</p>
|
||||
<p class="description">Last child or <code>NULL</code></p>
|
||||
<h3 class="function"><a id="mxmlGetNextSibling">mxmlGetNextSibling</a></h3>
|
||||
<p class="description">Return the node type...</p>
|
||||
<p class="code">
|
||||
@ -658,12 +589,7 @@ const char *mxmlGetOpaque (<br>
|
||||
<dd class="description">Node to get</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Opaque string or NULL</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion"><code>NULL</code> is returned if the node (or its first child) is not an opaque
|
||||
value node.
|
||||
|
||||
</p>
|
||||
<p class="description">Opaque string or <code>NULL</code></p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a id="mxmlGetParent">mxmlGetParent</a></h3>
|
||||
<p class="description">Get the parent node.</p>
|
||||
<p class="code">
|
||||
@ -676,11 +602,7 @@ value node.
|
||||
<dd class="description">Node to get</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Parent node or NULL</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion"><code>NULL</code> is returned for a root node.
|
||||
|
||||
</p>
|
||||
<p class="description">Parent node or <code>NULL</code></p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a id="mxmlGetPrevSibling">mxmlGetPrevSibling</a></h3>
|
||||
<p class="description">Get the previous node for the current parent.</p>
|
||||
<p class="code">
|
||||
@ -693,11 +615,7 @@ value node.
|
||||
<dd class="description">Node to get</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Previous node or NULL</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion"><code>NULL</code> is returned if this is the first child for the current parent.
|
||||
|
||||
</p>
|
||||
<p class="description">Previous node or <code>NULL</code></p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a id="mxmlGetReal">mxmlGetReal</a></h3>
|
||||
<p class="description">Get the real value for a node or its first child.</p>
|
||||
<p class="code">
|
||||
@ -711,10 +629,6 @@ double mxmlGetReal (<br>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Real value or 0.0</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">0.0 is returned if the node (or its first child) is not a real value node.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a id="mxmlGetRefCount">mxmlGetRefCount</a></h3>
|
||||
<p class="description">Get the current reference (use) count for a node.</p>
|
||||
<p class="code">
|
||||
@ -728,12 +642,6 @@ int mxmlGetRefCount (<br>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Reference count</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The initial reference count of new nodes is 1. Use the <a href="#mxmlRetain"><code>mxmlRetain</code></a>
|
||||
and <a href="#mxmlRelease"><code>mxmlRelease</code></a> functions to increment and decrement a node's
|
||||
reference count.
|
||||
|
||||
.</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a id="mxmlGetText">mxmlGetText</a></h3>
|
||||
<p class="description">Get the text value for a node or its first child.</p>
|
||||
<p class="code">
|
||||
@ -749,12 +657,7 @@ const char *mxmlGetText (<br>
|
||||
<dd class="description">1 if string is preceded by whitespace, 0 otherwise</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Text string or NULL</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion"><code>NULL</code> is returned if the node (or its first child) is not a text node.
|
||||
The "whitespace" argument can be NULL.
|
||||
|
||||
</p>
|
||||
<p class="description">Text string or <code>NULL</code></p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a id="mxmlGetType">mxmlGetType</a></h3>
|
||||
<p class="description">Get the node type.</p>
|
||||
<p class="code">
|
||||
@ -768,10 +671,6 @@ The "whitespace" argument can be NULL.
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Type of node</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion"><code>MXML_IGNORE</code> is returned if "node" is <code>NULL</code>.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a id="mxmlGetUserData">mxmlGetUserData</a></h3>
|
||||
<p class="description">Get the user data pointer for a node.</p>
|
||||
<p class="code">
|
||||
@ -808,9 +707,7 @@ void mxmlIndexDelete (<br>
|
||||
<dd class="description">Index to enumerate</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Next node or NULL if there is none</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">Nodes are returned in the sorted order of the index.</p>
|
||||
<p class="description">Next node or <code>NULL</code> if there is none</p>
|
||||
<h3 class="function"><a id="mxmlIndexFind">mxmlIndexFind</a></h3>
|
||||
<p class="description">Find the next matching node.</p>
|
||||
<p class="code">
|
||||
@ -829,12 +726,7 @@ void mxmlIndexDelete (<br>
|
||||
<dd class="description">Attribute value, if any</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Node or NULL if none found</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">You should call mxmlIndexReset() prior to using this function for
|
||||
the first time with a particular set of "element" and "value"
|
||||
strings. Passing NULL for both "element" and "value" is equivalent
|
||||
to calling mxmlIndexEnum().</p>
|
||||
<p class="description">Node or <code>NULL</code> if none found</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a id="mxmlIndexGetCount">mxmlIndexGetCount</a></h3>
|
||||
<p class="description">Get the number of nodes in an index.</p>
|
||||
<p class="code">
|
||||
@ -861,18 +753,12 @@ int mxmlIndexGetCount (<br>
|
||||
<dt>node</dt>
|
||||
<dd class="description">XML node tree</dd>
|
||||
<dt>element</dt>
|
||||
<dd class="description">Element to index or NULL for all</dd>
|
||||
<dd class="description">Element to index or <code>NULL</code> for all</dd>
|
||||
<dt>attr</dt>
|
||||
<dd class="description">Attribute to index or NULL for none</dd>
|
||||
<dd class="description">Attribute to index or <code>NULL</code> for none</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">New index</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The index will contain all nodes that contain the named element and/or
|
||||
attribute. If both "element" and "attr" are NULL, then the index will
|
||||
contain a sorted list of the elements in the node tree. Nodes are
|
||||
sorted by element name and optionally by attribute value if the "attr"
|
||||
argument is not NULL.</p>
|
||||
<h3 class="function"><a id="mxmlIndexReset">mxmlIndexReset</a></h3>
|
||||
<p class="description">Reset the enumeration/find pointer in the index and
|
||||
return the first node in the index.</p>
|
||||
@ -886,10 +772,7 @@ return the first node in the index.</p>
|
||||
<dd class="description">Index to reset</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">First node or NULL if there is none</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">This function should be called prior to using mxmlIndexEnum() or
|
||||
mxmlIndexFind() for the first time.</p>
|
||||
<p class="description">First node or <code>NULL</code> if there is none</p>
|
||||
<h3 class="function"><a id="mxmlLoadFd">mxmlLoadFd</a></h3>
|
||||
<p class="description">Load a file descriptor into an XML node tree.</p>
|
||||
<p class="code">
|
||||
@ -905,21 +788,10 @@ mxmlIndexFind() for the first time.</p>
|
||||
<dt>fd</dt>
|
||||
<dd class="description">File descriptor to read from</dd>
|
||||
<dt>cb</dt>
|
||||
<dd class="description">Callback function or MXML_NO_CALLBACK</dd>
|
||||
<dd class="description">Callback function or constant</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">First node or NULL if the file could not be read.</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The nodes in the specified file are added to the specified top node.
|
||||
If no top node is provided, the XML file MUST be well-formed with a
|
||||
single parent node like <?xml> for the entire file. The callback
|
||||
function returns the value type that should be used for child nodes.
|
||||
If MXML_NO_CALLBACK is specified then all child nodes will be either
|
||||
MXML_ELEMENT or MXML_TEXT nodes.<br>
|
||||
<br>
|
||||
The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK,
|
||||
MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading
|
||||
child nodes of the specified type.</p>
|
||||
<p class="description">First node or <code>NULL</code> if the file could not be read.</p>
|
||||
<h3 class="function"><a id="mxmlLoadFile">mxmlLoadFile</a></h3>
|
||||
<p class="description">Load a file into an XML node tree.</p>
|
||||
<p class="code">
|
||||
@ -935,21 +807,10 @@ child nodes of the specified type.</p>
|
||||
<dt>fp</dt>
|
||||
<dd class="description">File to read from</dd>
|
||||
<dt>cb</dt>
|
||||
<dd class="description">Callback function or MXML_NO_CALLBACK</dd>
|
||||
<dd class="description">Callback function or constant</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">First node or NULL if the file could not be read.</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The nodes in the specified file are added to the specified top node.
|
||||
If no top node is provided, the XML file MUST be well-formed with a
|
||||
single parent node like <?xml> for the entire file. The callback
|
||||
function returns the value type that should be used for child nodes.
|
||||
If MXML_NO_CALLBACK is specified then all child nodes will be either
|
||||
MXML_ELEMENT or MXML_TEXT nodes.<br>
|
||||
<br>
|
||||
The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK,
|
||||
MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading
|
||||
child nodes of the specified type.</p>
|
||||
<p class="description">First node or <code>NULL</code> if the file could not be read.</p>
|
||||
<h3 class="function"><a id="mxmlLoadString">mxmlLoadString</a></h3>
|
||||
<p class="description">Load a string into an XML node tree.</p>
|
||||
<p class="code">
|
||||
@ -965,21 +826,10 @@ child nodes of the specified type.</p>
|
||||
<dt>s</dt>
|
||||
<dd class="description">String to load</dd>
|
||||
<dt>cb</dt>
|
||||
<dd class="description">Callback function or MXML_NO_CALLBACK</dd>
|
||||
<dd class="description">Callback function or constant</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">First node or NULL if the string has errors.</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The nodes in the specified string are added to the specified top node.
|
||||
If no top node is provided, the XML string MUST be well-formed with a
|
||||
single parent node like <?xml> for the entire string. The callback
|
||||
function returns the value type that should be used for child nodes.
|
||||
If MXML_NO_CALLBACK is specified then all child nodes will be either
|
||||
MXML_ELEMENT or MXML_TEXT nodes.<br>
|
||||
<br>
|
||||
The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK,
|
||||
MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading
|
||||
child nodes of the specified type.</p>
|
||||
<p class="description">First node or <code>NULL</code> if the string has errors.</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.3 </span><a id="mxmlNewCDATA">mxmlNewCDATA</a></h3>
|
||||
<p class="description">Create a new CDATA node.</p>
|
||||
<p class="code">
|
||||
@ -990,19 +840,12 @@ child nodes of the specified type.</p>
|
||||
<h4 class="parameters">Parameters</h4>
|
||||
<dl>
|
||||
<dt>parent</dt>
|
||||
<dd class="description">Parent node or MXML_NO_PARENT</dd>
|
||||
<dd class="description">Parent node or <code>MXML_NO_PARENT</code></dd>
|
||||
<dt>data</dt>
|
||||
<dd class="description">Data string</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">New node</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The new CDATA node is added to the end of the specified parent's child
|
||||
list. The constant MXML_NO_PARENT can be used to specify that the new
|
||||
CDATA node has no parent. The data string must be nul-terminated and
|
||||
is copied into the new node. CDATA nodes use the MXML_ELEMENT type.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.1 </span><a id="mxmlNewCustom">mxmlNewCustom</a></h3>
|
||||
<p class="description">Create a new custom data node.</p>
|
||||
<p class="code">
|
||||
@ -1014,7 +857,7 @@ is copied into the new node. CDATA nodes use the MXML_ELEMENT type.
|
||||
<h4 class="parameters">Parameters</h4>
|
||||
<dl>
|
||||
<dt>parent</dt>
|
||||
<dd class="description">Parent node or MXML_NO_PARENT</dd>
|
||||
<dd class="description">Parent node or <code>MXML_NO_PARENT</code></dd>
|
||||
<dt>data</dt>
|
||||
<dd class="description">Pointer to data</dd>
|
||||
<dt>destroy</dt>
|
||||
@ -1022,13 +865,6 @@ is copied into the new node. CDATA nodes use the MXML_ELEMENT type.
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">New node</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The new custom node is added to the end of the specified parent's child
|
||||
list. The constant MXML_NO_PARENT can be used to specify that the new
|
||||
element node has no parent. NULL can be passed when the data in the
|
||||
node is not dynamically allocated or is separately managed.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><a id="mxmlNewElement">mxmlNewElement</a></h3>
|
||||
<p class="description">Create a new element node.</p>
|
||||
<p class="code">
|
||||
@ -1039,16 +875,12 @@ node is not dynamically allocated or is separately managed.
|
||||
<h4 class="parameters">Parameters</h4>
|
||||
<dl>
|
||||
<dt>parent</dt>
|
||||
<dd class="description">Parent node or MXML_NO_PARENT</dd>
|
||||
<dd class="description">Parent node or <code>MXML_NO_PARENT</code></dd>
|
||||
<dt>name</dt>
|
||||
<dd class="description">Name of element</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">New node</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The new element node is added to the end of the specified parent's child
|
||||
list. The constant MXML_NO_PARENT can be used to specify that the new
|
||||
element node has no parent.</p>
|
||||
<h3 class="function"><a id="mxmlNewInteger">mxmlNewInteger</a></h3>
|
||||
<p class="description">Create a new integer node.</p>
|
||||
<p class="code">
|
||||
@ -1059,16 +891,12 @@ element node has no parent.</p>
|
||||
<h4 class="parameters">Parameters</h4>
|
||||
<dl>
|
||||
<dt>parent</dt>
|
||||
<dd class="description">Parent node or MXML_NO_PARENT</dd>
|
||||
<dd class="description">Parent node or <code>MXML_NO_PARENT</code></dd>
|
||||
<dt>integer</dt>
|
||||
<dd class="description">Integer value</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">New node</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The new integer node is added to the end of the specified parent's child
|
||||
list. The constant MXML_NO_PARENT can be used to specify that the new
|
||||
integer node has no parent.</p>
|
||||
<h3 class="function"><a id="mxmlNewOpaque">mxmlNewOpaque</a></h3>
|
||||
<p class="description">Create a new opaque string.</p>
|
||||
<p class="code">
|
||||
@ -1079,17 +907,31 @@ integer node has no parent.</p>
|
||||
<h4 class="parameters">Parameters</h4>
|
||||
<dl>
|
||||
<dt>parent</dt>
|
||||
<dd class="description">Parent node or MXML_NO_PARENT</dd>
|
||||
<dd class="description">Parent node or <code>MXML_NO_PARENT</code></dd>
|
||||
<dt>opaque</dt>
|
||||
<dd class="description">Opaque string</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">New node</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The new opaque node is added to the end of the specified parent's child
|
||||
list. The constant MXML_NO_PARENT can be used to specify that the new
|
||||
opaque node has no parent. The opaque string must be nul-terminated and
|
||||
is copied into the new node.</p>
|
||||
<h3 class="function"><a id="mxmlNewOpaquef">mxmlNewOpaquef</a></h3>
|
||||
<p class="description">Create a new formatted opaque string node.</p>
|
||||
<p class="code">
|
||||
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewOpaquef (<br>
|
||||
    <a href="#mxml_node_t">mxml_node_t</a> *parent,<br>
|
||||
    const char *format,<br>
|
||||
    ...<br>
|
||||
);</p>
|
||||
<h4 class="parameters">Parameters</h4>
|
||||
<dl>
|
||||
<dt>parent</dt>
|
||||
<dd class="description">Parent node or <code>MXML_NO_PARENT</code></dd>
|
||||
<dt>format</dt>
|
||||
<dd class="description">Printf-style format string</dd>
|
||||
<dt>...</dt>
|
||||
<dd class="description">Additional args as needed</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">New node</p>
|
||||
<h3 class="function"><a id="mxmlNewReal">mxmlNewReal</a></h3>
|
||||
<p class="description">Create a new real number node.</p>
|
||||
<p class="code">
|
||||
@ -1100,16 +942,12 @@ is copied into the new node.</p>
|
||||
<h4 class="parameters">Parameters</h4>
|
||||
<dl>
|
||||
<dt>parent</dt>
|
||||
<dd class="description">Parent node or MXML_NO_PARENT</dd>
|
||||
<dd class="description">Parent node or <code>MXML_NO_PARENT</code></dd>
|
||||
<dt>real</dt>
|
||||
<dd class="description">Real number value</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">New node</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The new real number node is added to the end of the specified parent's
|
||||
child list. The constant MXML_NO_PARENT can be used to specify that
|
||||
the new real number node has no parent.</p>
|
||||
<h3 class="function"><a id="mxmlNewText">mxmlNewText</a></h3>
|
||||
<p class="description">Create a new text fragment node.</p>
|
||||
<p class="code">
|
||||
@ -1121,7 +959,7 @@ the new real number node has no parent.</p>
|
||||
<h4 class="parameters">Parameters</h4>
|
||||
<dl>
|
||||
<dt>parent</dt>
|
||||
<dd class="description">Parent node or MXML_NO_PARENT</dd>
|
||||
<dd class="description">Parent node or <code>MXML_NO_PARENT</code></dd>
|
||||
<dt>whitespace</dt>
|
||||
<dd class="description">1 = leading whitespace, 0 = no whitespace</dd>
|
||||
<dt>string</dt>
|
||||
@ -1129,12 +967,6 @@ the new real number node has no parent.</p>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">New node</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The new text node is added to the end of the specified parent's child
|
||||
list. The constant MXML_NO_PARENT can be used to specify that the new
|
||||
text node has no parent. The whitespace parameter is used to specify
|
||||
whether leading whitespace is present before the node. The text
|
||||
string must be nul-terminated and is copied into the new node.</p>
|
||||
<h3 class="function"><a id="mxmlNewTextf">mxmlNewTextf</a></h3>
|
||||
<p class="description">Create a new formatted text fragment node.</p>
|
||||
<p class="code">
|
||||
@ -1147,22 +979,16 @@ string must be nul-terminated and is copied into the new node.</p>
|
||||
<h4 class="parameters">Parameters</h4>
|
||||
<dl>
|
||||
<dt>parent</dt>
|
||||
<dd class="description">Parent node or MXML_NO_PARENT</dd>
|
||||
<dd class="description">Parent node or <code>MXML_NO_PARENT</code></dd>
|
||||
<dt>whitespace</dt>
|
||||
<dd class="description">1 = leading whitespace, 0 = no whitespace</dd>
|
||||
<dt>format</dt>
|
||||
<dd class="description">Printf-style frmat string</dd>
|
||||
<dd class="description">Printf-style format string</dd>
|
||||
<dt>...</dt>
|
||||
<dd class="description">Additional args as needed</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">New node</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The new text node is added to the end of the specified parent's child
|
||||
list. The constant MXML_NO_PARENT can be used to specify that the new
|
||||
text node has no parent. The whitespace parameter is used to specify
|
||||
whether leading whitespace is present before the node. The format
|
||||
string must be nul-terminated and is formatted into the new node.</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.3 </span><a id="mxmlNewXML">mxmlNewXML</a></h3>
|
||||
<p class="description">Create a new XML document tree.</p>
|
||||
<p class="code">
|
||||
@ -1176,11 +1002,6 @@ string must be nul-terminated and is formatted into the new node.</p>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">New ?xml node</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The "version" argument specifies the version number to put in the
|
||||
?xml element node. If NULL, version 1.0 is assumed.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.3 </span><a id="mxmlRelease">mxmlRelease</a></h3>
|
||||
<p class="description">Release a node.</p>
|
||||
<p class="code">
|
||||
@ -1194,11 +1015,6 @@ int mxmlRelease (<br>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">New reference count</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">When the reference count reaches zero, the node (and any children)
|
||||
is deleted via mxmlDelete().
|
||||
|
||||
</p>
|
||||
<h3 class="function"><a id="mxmlRemove">mxmlRemove</a></h3>
|
||||
<p class="description">Remove a node from its parent.</p>
|
||||
<p class="code">
|
||||
@ -1210,9 +1026,6 @@ void mxmlRemove (<br>
|
||||
<dt>node</dt>
|
||||
<dd class="description">Node to remove</dd>
|
||||
</dl>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">Does not free memory used by the node - use mxmlDelete() for that.
|
||||
This function does nothing if the node has no parent.</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.3 </span><a id="mxmlRetain">mxmlRetain</a></h3>
|
||||
<p class="description">Retain a node.</p>
|
||||
<p class="code">
|
||||
@ -1244,31 +1057,14 @@ using a SAX callback.</p>
|
||||
<dt>fd</dt>
|
||||
<dd class="description">File descriptor to read from</dd>
|
||||
<dt>cb</dt>
|
||||
<dd class="description">Callback function or MXML_NO_CALLBACK</dd>
|
||||
<dd class="description">Callback function or constant</dd>
|
||||
<dt>sax_cb</dt>
|
||||
<dd class="description">SAX callback or MXML_NO_CALLBACK</dd>
|
||||
<dd class="description">SAX callback or <code>MXML_NO_CALLBACK</code></dd>
|
||||
<dt>sax_data</dt>
|
||||
<dd class="description">SAX user data</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">First node or NULL if the file could not be read.</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The nodes in the specified file are added to the specified top node.
|
||||
If no top node is provided, the XML file MUST be well-formed with a
|
||||
single parent node like <?xml> for the entire file. The callback
|
||||
function returns the value type that should be used for child nodes.
|
||||
If MXML_NO_CALLBACK is specified then all child nodes will be either
|
||||
MXML_ELEMENT or MXML_TEXT nodes.<br>
|
||||
<br>
|
||||
The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK,
|
||||
MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading
|
||||
child nodes of the specified type.<br>
|
||||
<br>
|
||||
The SAX callback must call mxmlRetain() for any nodes that need to
|
||||
be kept for later use. Otherwise, nodes are deleted when the parent
|
||||
node is closed or after each data, comment, CDATA, or directive node.
|
||||
|
||||
</p>
|
||||
<p class="description">First node or <code>NULL</code> if the file could not be read.</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.3 </span><a id="mxmlSAXLoadFile">mxmlSAXLoadFile</a></h3>
|
||||
<p class="description">Load a file into an XML node tree
|
||||
using a SAX callback.</p>
|
||||
@ -1287,31 +1083,14 @@ using a SAX callback.</p>
|
||||
<dt>fp</dt>
|
||||
<dd class="description">File to read from</dd>
|
||||
<dt>cb</dt>
|
||||
<dd class="description">Callback function or MXML_NO_CALLBACK</dd>
|
||||
<dd class="description">Callback function or constant</dd>
|
||||
<dt>sax_cb</dt>
|
||||
<dd class="description">SAX callback or MXML_NO_CALLBACK</dd>
|
||||
<dd class="description">SAX callback or <code>MXML_NO_CALLBACK</code></dd>
|
||||
<dt>sax_data</dt>
|
||||
<dd class="description">SAX user data</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">First node or NULL if the file could not be read.</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The nodes in the specified file are added to the specified top node.
|
||||
If no top node is provided, the XML file MUST be well-formed with a
|
||||
single parent node like <?xml> for the entire file. The callback
|
||||
function returns the value type that should be used for child nodes.
|
||||
If MXML_NO_CALLBACK is specified then all child nodes will be either
|
||||
MXML_ELEMENT or MXML_TEXT nodes.<br>
|
||||
<br>
|
||||
The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK,
|
||||
MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading
|
||||
child nodes of the specified type.<br>
|
||||
<br>
|
||||
The SAX callback must call mxmlRetain() for any nodes that need to
|
||||
be kept for later use. Otherwise, nodes are deleted when the parent
|
||||
node is closed or after each data, comment, CDATA, or directive node.
|
||||
|
||||
</p>
|
||||
<p class="description">First node or <code>NULL</code> if the file could not be read.</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.3 </span><a id="mxmlSAXLoadString">mxmlSAXLoadString</a></h3>
|
||||
<p class="description">Load a string into an XML node tree
|
||||
using a SAX callback.</p>
|
||||
@ -1330,31 +1109,14 @@ using a SAX callback.</p>
|
||||
<dt>s</dt>
|
||||
<dd class="description">String to load</dd>
|
||||
<dt>cb</dt>
|
||||
<dd class="description">Callback function or MXML_NO_CALLBACK</dd>
|
||||
<dd class="description">Callback function or constant</dd>
|
||||
<dt>sax_cb</dt>
|
||||
<dd class="description">SAX callback or MXML_NO_CALLBACK</dd>
|
||||
<dd class="description">SAX callback or <code>MXML_NO_CALLBACK</code></dd>
|
||||
<dt>sax_data</dt>
|
||||
<dd class="description">SAX user data</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">First node or NULL if the string has errors.</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The nodes in the specified string are added to the specified top node.
|
||||
If no top node is provided, the XML string MUST be well-formed with a
|
||||
single parent node like <?xml> for the entire string. The callback
|
||||
function returns the value type that should be used for child nodes.
|
||||
If MXML_NO_CALLBACK is specified then all child nodes will be either
|
||||
MXML_ELEMENT or MXML_TEXT nodes.<br>
|
||||
<br>
|
||||
The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK,
|
||||
MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading
|
||||
child nodes of the specified type.<br>
|
||||
<br>
|
||||
The SAX callback must call mxmlRetain() for any nodes that need to
|
||||
be kept for later use. Otherwise, nodes are deleted when the parent
|
||||
node is closed or after each data, comment, CDATA, or directive node.
|
||||
|
||||
</p>
|
||||
<p class="description">First node or <code>NULL</code> if the string has errors.</p>
|
||||
<h3 class="function"><a id="mxmlSaveAllocString">mxmlSaveAllocString</a></h3>
|
||||
<p class="description">Save an XML tree to an allocated string.</p>
|
||||
<p class="code">
|
||||
@ -1367,22 +1129,10 @@ char *mxmlSaveAllocString (<br>
|
||||
<dt>node</dt>
|
||||
<dd class="description">Node to write</dd>
|
||||
<dt>cb</dt>
|
||||
<dd class="description">Whitespace callback or MXML_NO_CALLBACK</dd>
|
||||
<dd class="description">Whitespace callback or <code>MXML_NO_CALLBACK</code></dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Allocated string or NULL</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">This function returns a pointer to a string containing the textual
|
||||
representation of the XML node tree. The string should be freed
|
||||
using the free() function when you are done with it. NULL is returned
|
||||
if the node would produce an empty string or if the string cannot be
|
||||
allocated.<br>
|
||||
<br>
|
||||
The callback argument specifies a function that returns a whitespace
|
||||
string or NULL before and after each element. If MXML_NO_CALLBACK
|
||||
is specified, whitespace will only be added before MXML_TEXT nodes
|
||||
with leading whitespace and before attribute names inside opening
|
||||
element tags.</p>
|
||||
<p class="description">Allocated string or <code>NULL</code></p>
|
||||
<h3 class="function"><a id="mxmlSaveFd">mxmlSaveFd</a></h3>
|
||||
<p class="description">Save an XML tree to a file descriptor.</p>
|
||||
<p class="code">
|
||||
@ -1398,16 +1148,10 @@ int mxmlSaveFd (<br>
|
||||
<dt>fd</dt>
|
||||
<dd class="description">File descriptor to write to</dd>
|
||||
<dt>cb</dt>
|
||||
<dd class="description">Whitespace callback or MXML_NO_CALLBACK</dd>
|
||||
<dd class="description">Whitespace callback or <code>MXML_NO_CALLBACK</code></dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">0 on success, -1 on error.</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The callback argument specifies a function that returns a whitespace
|
||||
string or NULL before and after each element. If MXML_NO_CALLBACK
|
||||
is specified, whitespace will only be added before MXML_TEXT nodes
|
||||
with leading whitespace and before attribute names inside opening
|
||||
element tags.</p>
|
||||
<h3 class="function"><a id="mxmlSaveFile">mxmlSaveFile</a></h3>
|
||||
<p class="description">Save an XML tree to a file.</p>
|
||||
<p class="code">
|
||||
@ -1423,16 +1167,10 @@ int mxmlSaveFile (<br>
|
||||
<dt>fp</dt>
|
||||
<dd class="description">File to write to</dd>
|
||||
<dt>cb</dt>
|
||||
<dd class="description">Whitespace callback or MXML_NO_CALLBACK</dd>
|
||||
<dd class="description">Whitespace callback or <code>MXML_NO_CALLBACK</code></dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">0 on success, -1 on error.</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The callback argument specifies a function that returns a whitespace
|
||||
string or NULL before and after each element. If MXML_NO_CALLBACK
|
||||
is specified, whitespace will only be added before MXML_TEXT nodes
|
||||
with leading whitespace and before attribute names inside opening
|
||||
element tags.</p>
|
||||
<h3 class="function"><a id="mxmlSaveString">mxmlSaveString</a></h3>
|
||||
<p class="description">Save an XML node tree to a string.</p>
|
||||
<p class="code">
|
||||
@ -1451,20 +1189,10 @@ int mxmlSaveString (<br>
|
||||
<dt>bufsize</dt>
|
||||
<dd class="description">Size of string buffer</dd>
|
||||
<dt>cb</dt>
|
||||
<dd class="description">Whitespace callback or MXML_NO_CALLBACK</dd>
|
||||
<dd class="description">Whitespace callback or <code>MXML_NO_CALLBACK</code></dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Size of string</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">This function returns the total number of bytes that would be
|
||||
required for the string but only copies (bufsize - 1) characters
|
||||
into the specified buffer.<br>
|
||||
<br>
|
||||
The callback argument specifies a function that returns a whitespace
|
||||
string or NULL before and after each element. If MXML_NO_CALLBACK
|
||||
is specified, whitespace will only be added before MXML_TEXT nodes
|
||||
with leading whitespace and before attribute names inside opening
|
||||
element tags.</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.3 </span><a id="mxmlSetCDATA">mxmlSetCDATA</a></h3>
|
||||
<p class="description">Set the element name of a CDATA node.</p>
|
||||
<p class="code">
|
||||
@ -1481,10 +1209,6 @@ int mxmlSetCDATA (<br>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">0 on success, -1 on failure</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The node is not changed if it (or its first child) is not a CDATA element node.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.1 </span><a id="mxmlSetCustom">mxmlSetCustom</a></h3>
|
||||
<p class="description">Set the data and destructor of a custom data node.</p>
|
||||
<p class="code">
|
||||
@ -1504,10 +1228,6 @@ int mxmlSetCustom (<br>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">0 on success, -1 on failure</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The node is not changed if it (or its first child) is not a custom node.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><a id="mxmlSetCustomHandlers">mxmlSetCustomHandlers</a></h3>
|
||||
<p class="description">Set the handling functions for custom data.</p>
|
||||
<p class="code">
|
||||
@ -1522,12 +1242,6 @@ void mxmlSetCustomHandlers (<br>
|
||||
<dt>save</dt>
|
||||
<dd class="description">Save function</dd>
|
||||
</dl>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The load function accepts a node pointer and a data string and must
|
||||
return 0 on success and non-zero on error.<br>
|
||||
<br>
|
||||
The save function accepts a node pointer and must return a malloc'd
|
||||
string on success and NULL on error.</p>
|
||||
<h3 class="function"><a id="mxmlSetElement">mxmlSetElement</a></h3>
|
||||
<p class="description">Set the name of an element node.</p>
|
||||
<p class="code">
|
||||
@ -1544,8 +1258,6 @@ int mxmlSetElement (<br>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">0 on success, -1 on failure</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The node is not changed if it is not an element node.</p>
|
||||
<h3 class="function"><a id="mxmlSetErrorCallback">mxmlSetErrorCallback</a></h3>
|
||||
<p class="description">Set the error message callback.</p>
|
||||
<p class="code">
|
||||
@ -1573,8 +1285,6 @@ int mxmlSetInteger (<br>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">0 on success, -1 on failure</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The node is not changed if it (or its first child) is not an integer node.</p>
|
||||
<h3 class="function"><a id="mxmlSetOpaque">mxmlSetOpaque</a></h3>
|
||||
<p class="description">Set the value of an opaque node.</p>
|
||||
<p class="code">
|
||||
@ -1591,8 +1301,25 @@ int mxmlSetOpaque (<br>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">0 on success, -1 on failure</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The node is not changed if it (or its first child) is not an opaque node.</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.11 </span><a id="mxmlSetOpaquef">mxmlSetOpaquef</a></h3>
|
||||
<p class="description">Set the value of an opaque string node to a formatted string.</p>
|
||||
<p class="code">
|
||||
int mxmlSetOpaquef (<br>
|
||||
    <a href="#mxml_node_t">mxml_node_t</a> *node,<br>
|
||||
    const char *format,<br>
|
||||
    ...<br>
|
||||
);</p>
|
||||
<h4 class="parameters">Parameters</h4>
|
||||
<dl>
|
||||
<dt>node</dt>
|
||||
<dd class="description">Node to set</dd>
|
||||
<dt>format</dt>
|
||||
<dd class="description">Printf-style format string</dd>
|
||||
<dt>...</dt>
|
||||
<dd class="description">Additional arguments as needed</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">0 on success, -1 on failure</p>
|
||||
<h3 class="function"><a id="mxmlSetReal">mxmlSetReal</a></h3>
|
||||
<p class="description">Set the value of a real number node.</p>
|
||||
<p class="code">
|
||||
@ -1609,8 +1336,6 @@ int mxmlSetReal (<br>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">0 on success, -1 on failure</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The node is not changed if it (or its first child) is not a real number node.</p>
|
||||
<h3 class="function"><a id="mxmlSetText">mxmlSetText</a></h3>
|
||||
<p class="description">Set the value of a text node.</p>
|
||||
<p class="code">
|
||||
@ -1630,8 +1355,6 @@ int mxmlSetText (<br>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">0 on success, -1 on failure</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The node is not changed if it (or its first child) is not a text node.</p>
|
||||
<h3 class="function"><a id="mxmlSetTextf">mxmlSetTextf</a></h3>
|
||||
<p class="description">Set the value of a text node to a formatted string.</p>
|
||||
<p class="code">
|
||||
@ -1654,8 +1377,6 @@ int mxmlSetTextf (<br>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">0 on success, -1 on failure</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The node is not changed if it (or its first child) is not a text node.</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a id="mxmlSetUserData">mxmlSetUserData</a></h3>
|
||||
<p class="description">Set the user data pointer for a node.</p>
|
||||
<p class="code">
|
||||
@ -1683,10 +1404,6 @@ void mxmlSetWrapMargin (<br>
|
||||
<dt>column</dt>
|
||||
<dd class="description">Column for wrapping, 0 to disable wrapping</dd>
|
||||
</dl>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">Wrapping is disabled when "column" is 0.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><a id="mxmlWalkNext">mxmlWalkNext</a></h3>
|
||||
<p class="description">Walk to the next logical node in the tree.</p>
|
||||
<p class="code">
|
||||
@ -1702,14 +1419,10 @@ void mxmlSetWrapMargin (<br>
|
||||
<dt>top</dt>
|
||||
<dd class="description">Top node</dd>
|
||||
<dt>descend</dt>
|
||||
<dd class="description">Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST</dd>
|
||||
<dd class="description">Descend into tree - <code>MXML_DESCEND</code>, <code>MXML_NO_DESCEND</code>, or <code>MXML_DESCEND_FIRST</code></dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Next node or NULL</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The descend argument controls whether the first child is considered
|
||||
to be the next node. The top node argument constrains the walk to
|
||||
the node's children.</p>
|
||||
<p class="description">Next node or <code>NULL</code></p>
|
||||
<h3 class="function"><a id="mxmlWalkPrev">mxmlWalkPrev</a></h3>
|
||||
<p class="description">Walk to the previous logical node in the tree.</p>
|
||||
<p class="code">
|
||||
@ -1725,14 +1438,10 @@ the node's children.</p>
|
||||
<dt>top</dt>
|
||||
<dd class="description">Top node</dd>
|
||||
<dt>descend</dt>
|
||||
<dd class="description">Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST</dd>
|
||||
<dd class="description">Descend into tree - <code>MXML_DESCEND</code>, <code>MXML_NO_DESCEND</code>, or <code>MXML_DESCEND_FIRST</code></dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Previous node or NULL</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The descend argument controls whether the previous node's last child
|
||||
is considered to be the previous node. The top node argument constrains
|
||||
the walk to the node's children.</p>
|
||||
<p class="description">Previous node or <code>NULL</code></p>
|
||||
<h2 class="title"><a id="TYPES">Data Types</a></h2>
|
||||
<h3 class="typedef"><a id="mxml_custom_destroy_cb_t">mxml_custom_destroy_cb_t</a></h3>
|
||||
<p class="description">Custom data destructor</p>
|
||||
|
@ -92,11 +92,11 @@ mxmlElementDeleteAttr(mxml_node_t *node,/* I - Element */
|
||||
/*
|
||||
* 'mxmlElementGetAttr()' - Get an attribute.
|
||||
*
|
||||
* This function returns NULL if the node is not an element or the
|
||||
* This function returns @code NULL@ if the node is not an element or the
|
||||
* named attribute does not exist.
|
||||
*/
|
||||
|
||||
const char * /* O - Attribute value or NULL */
|
||||
const char * /* O - Attribute value or @code NULL@ */
|
||||
mxmlElementGetAttr(mxml_node_t *node, /* I - Element node */
|
||||
const char *name) /* I - Name of attribute */
|
||||
{
|
||||
|
@ -50,10 +50,10 @@ mxmlEntityAddCallback(
|
||||
/*
|
||||
* 'mxmlEntityGetName()' - Get the name that corresponds to the character value.
|
||||
*
|
||||
* If val does not need to be represented by a named entity, NULL is returned.
|
||||
* If val does not need to be represented by a named entity, @code NULL@ is returned.
|
||||
*/
|
||||
|
||||
const char * /* O - Entity name or NULL */
|
||||
const char * /* O - Entity name or @code NULL@ */
|
||||
mxmlEntityGetName(int val) /* I - Character value */
|
||||
{
|
||||
switch (val)
|
||||
|
120
mxml-file.c
120
mxml-file.c
@ -103,18 +103,15 @@ static int mxml_write_ws(mxml_node_t *node, void *p,
|
||||
* If no top node is provided, the XML file MUST be well-formed with a
|
||||
* single parent node like <?xml> for the entire file. The callback
|
||||
* function returns the value type that should be used for child nodes.
|
||||
* If MXML_NO_CALLBACK is specified then all child nodes will be either
|
||||
* MXML_ELEMENT or MXML_TEXT nodes.
|
||||
*
|
||||
* The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK,
|
||||
* MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading
|
||||
* child nodes of the specified type.
|
||||
* The constants @code MXML_INTEGER_CALLBACK@, @code MXML_OPAQUE_CALLBACK@,
|
||||
* @code MXML_REAL_CALLBACK@, and @code MXML_TEXT_CALLBACK@ are defined for
|
||||
* loading child (data) nodes of the specified type.
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - First node or NULL if the file could not be read. */
|
||||
mxml_node_t * /* O - First node or @code NULL@ if the file could not be read. */
|
||||
mxmlLoadFd(mxml_node_t *top, /* I - Top node */
|
||||
int fd, /* I - File descriptor to read from */
|
||||
mxml_load_cb_t cb) /* I - Callback function or MXML_NO_CALLBACK */
|
||||
mxml_load_cb_t cb) /* I - Callback function or constant */
|
||||
{
|
||||
_mxml_fdbuf_t buf; /* File descriptor buffer */
|
||||
|
||||
@ -142,18 +139,15 @@ mxmlLoadFd(mxml_node_t *top, /* I - Top node */
|
||||
* If no top node is provided, the XML file MUST be well-formed with a
|
||||
* single parent node like <?xml> for the entire file. The callback
|
||||
* function returns the value type that should be used for child nodes.
|
||||
* If MXML_NO_CALLBACK is specified then all child nodes will be either
|
||||
* MXML_ELEMENT or MXML_TEXT nodes.
|
||||
*
|
||||
* The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK,
|
||||
* MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading
|
||||
* child nodes of the specified type.
|
||||
* The constants @code MXML_INTEGER_CALLBACK@, @code MXML_OPAQUE_CALLBACK@,
|
||||
* @code MXML_REAL_CALLBACK@, and @code MXML_TEXT_CALLBACK@ are defined for
|
||||
* loading child (data) nodes of the specified type.
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - First node or NULL if the file could not be read. */
|
||||
mxml_node_t * /* O - First node or @code NULL@ if the file could not be read. */
|
||||
mxmlLoadFile(mxml_node_t *top, /* I - Top node */
|
||||
FILE *fp, /* I - File to read from */
|
||||
mxml_load_cb_t cb) /* I - Callback function or MXML_NO_CALLBACK */
|
||||
mxml_load_cb_t cb) /* I - Callback function or constant */
|
||||
{
|
||||
/*
|
||||
* Read the XML data...
|
||||
@ -170,18 +164,15 @@ mxmlLoadFile(mxml_node_t *top, /* I - Top node */
|
||||
* If no top node is provided, the XML string MUST be well-formed with a
|
||||
* single parent node like <?xml> for the entire string. The callback
|
||||
* function returns the value type that should be used for child nodes.
|
||||
* If MXML_NO_CALLBACK is specified then all child nodes will be either
|
||||
* MXML_ELEMENT or MXML_TEXT nodes.
|
||||
*
|
||||
* The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK,
|
||||
* MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading
|
||||
* child nodes of the specified type.
|
||||
* The constants @code MXML_INTEGER_CALLBACK@, @code MXML_OPAQUE_CALLBACK@,
|
||||
* @code MXML_REAL_CALLBACK@, and @code MXML_TEXT_CALLBACK@ are defined for
|
||||
* loading child (data) nodes of the specified type.
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - First node or NULL if the string has errors. */
|
||||
mxml_node_t * /* O - First node or @code NULL@ if the string has errors. */
|
||||
mxmlLoadString(mxml_node_t *top, /* I - Top node */
|
||||
const char *s, /* I - String to load */
|
||||
mxml_load_cb_t cb) /* I - Callback function or MXML_NO_CALLBACK */
|
||||
mxml_load_cb_t cb) /* I - Callback function or constant */
|
||||
{
|
||||
/*
|
||||
* Read the XML data...
|
||||
@ -197,21 +188,21 @@ mxmlLoadString(mxml_node_t *top, /* I - Top node */
|
||||
*
|
||||
* This function returns a pointer to a string containing the textual
|
||||
* representation of the XML node tree. The string should be freed
|
||||
* using the free() function when you are done with it. NULL is returned
|
||||
* using the free() function when you are done with it. @code NULL@ is returned
|
||||
* if the node would produce an empty string or if the string cannot be
|
||||
* allocated.
|
||||
*
|
||||
* The callback argument specifies a function that returns a whitespace
|
||||
* string or NULL before and after each element. If MXML_NO_CALLBACK
|
||||
* is specified, whitespace will only be added before MXML_TEXT nodes
|
||||
* string or NULL before and after each element. If @code MXML_NO_CALLBACK@
|
||||
* is specified, whitespace will only be added before @code MXML_TEXT@ nodes
|
||||
* with leading whitespace and before attribute names inside opening
|
||||
* element tags.
|
||||
*/
|
||||
|
||||
char * /* O - Allocated string or NULL */
|
||||
char * /* O - Allocated string or @code NULL@ */
|
||||
mxmlSaveAllocString(
|
||||
mxml_node_t *node, /* I - Node to write */
|
||||
mxml_save_cb_t cb) /* I - Whitespace callback or MXML_NO_CALLBACK */
|
||||
mxml_save_cb_t cb) /* I - Whitespace callback or @code MXML_NO_CALLBACK@ */
|
||||
{
|
||||
int bytes; /* Required bytes */
|
||||
char buffer[8192]; /* Temporary buffer */
|
||||
@ -259,8 +250,8 @@ mxmlSaveAllocString(
|
||||
* 'mxmlSaveFd()' - Save an XML tree to a file descriptor.
|
||||
*
|
||||
* The callback argument specifies a function that returns a whitespace
|
||||
* string or NULL before and after each element. If MXML_NO_CALLBACK
|
||||
* is specified, whitespace will only be added before MXML_TEXT nodes
|
||||
* string or NULL before and after each element. If @code MXML_NO_CALLBACK@
|
||||
* is specified, whitespace will only be added before @code MXML_TEXT@ nodes
|
||||
* with leading whitespace and before attribute names inside opening
|
||||
* element tags.
|
||||
*/
|
||||
@ -268,7 +259,7 @@ mxmlSaveAllocString(
|
||||
int /* O - 0 on success, -1 on error. */
|
||||
mxmlSaveFd(mxml_node_t *node, /* I - Node to write */
|
||||
int fd, /* I - File descriptor to write to */
|
||||
mxml_save_cb_t cb) /* I - Whitespace callback or MXML_NO_CALLBACK */
|
||||
mxml_save_cb_t cb) /* I - Whitespace callback or @code MXML_NO_CALLBACK@ */
|
||||
{
|
||||
int col; /* Final column */
|
||||
_mxml_fdbuf_t buf; /* File descriptor buffer */
|
||||
@ -307,8 +298,8 @@ mxmlSaveFd(mxml_node_t *node, /* I - Node to write */
|
||||
* 'mxmlSaveFile()' - Save an XML tree to a file.
|
||||
*
|
||||
* The callback argument specifies a function that returns a whitespace
|
||||
* string or NULL before and after each element. If MXML_NO_CALLBACK
|
||||
* is specified, whitespace will only be added before MXML_TEXT nodes
|
||||
* string or NULL before and after each element. If @code MXML_NO_CALLBACK@
|
||||
* is specified, whitespace will only be added before @code MXML_TEXT@ nodes
|
||||
* with leading whitespace and before attribute names inside opening
|
||||
* element tags.
|
||||
*/
|
||||
@ -316,7 +307,7 @@ mxmlSaveFd(mxml_node_t *node, /* I - Node to write */
|
||||
int /* O - 0 on success, -1 on error. */
|
||||
mxmlSaveFile(mxml_node_t *node, /* I - Node to write */
|
||||
FILE *fp, /* I - File to write to */
|
||||
mxml_save_cb_t cb) /* I - Whitespace callback or MXML_NO_CALLBACK */
|
||||
mxml_save_cb_t cb) /* I - Whitespace callback or @code MXML_NO_CALLBACK@ */
|
||||
{
|
||||
int col; /* Final column */
|
||||
_mxml_global_t *global = _mxml_global();
|
||||
@ -350,8 +341,8 @@ mxmlSaveFile(mxml_node_t *node, /* I - Node to write */
|
||||
* into the specified buffer.
|
||||
*
|
||||
* The callback argument specifies a function that returns a whitespace
|
||||
* string or NULL before and after each element. If MXML_NO_CALLBACK
|
||||
* is specified, whitespace will only be added before MXML_TEXT nodes
|
||||
* string or NULL before and after each element. If @code MXML_NO_CALLBACK@
|
||||
* is specified, whitespace will only be added before @code MXML_TEXT@ nodes
|
||||
* with leading whitespace and before attribute names inside opening
|
||||
* element tags.
|
||||
*/
|
||||
@ -360,7 +351,7 @@ int /* O - Size of string */
|
||||
mxmlSaveString(mxml_node_t *node, /* I - Node to write */
|
||||
char *buffer, /* I - String buffer */
|
||||
int bufsize, /* I - Size of string buffer */
|
||||
mxml_save_cb_t cb) /* I - Whitespace callback or MXML_NO_CALLBACK */
|
||||
mxml_save_cb_t cb) /* I - Whitespace callback or @code MXML_NO_CALLBACK@ */
|
||||
{
|
||||
int col; /* Final column */
|
||||
char *ptr[2]; /* Pointers for putc_cb */
|
||||
@ -406,25 +397,22 @@ mxmlSaveString(mxml_node_t *node, /* I - Node to write */
|
||||
* If no top node is provided, the XML file MUST be well-formed with a
|
||||
* single parent node like <?xml> for the entire file. The callback
|
||||
* function returns the value type that should be used for child nodes.
|
||||
* If MXML_NO_CALLBACK is specified then all child nodes will be either
|
||||
* MXML_ELEMENT or MXML_TEXT nodes.
|
||||
* The constants @code MXML_INTEGER_CALLBACK@, @code MXML_OPAQUE_CALLBACK@,
|
||||
* @code MXML_REAL_CALLBACK@, and @code MXML_TEXT_CALLBACK@ are defined for
|
||||
* loading child nodes of the specified type.
|
||||
*
|
||||
* The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK,
|
||||
* MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading
|
||||
* child nodes of the specified type.
|
||||
*
|
||||
* The SAX callback must call mxmlRetain() for any nodes that need to
|
||||
* The SAX callback must call @link mxmlRetain@ for any nodes that need to
|
||||
* be kept for later use. Otherwise, nodes are deleted when the parent
|
||||
* node is closed or after each data, comment, CDATA, or directive node.
|
||||
*
|
||||
* @since Mini-XML 2.3@
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - First node or NULL if the file could not be read. */
|
||||
mxml_node_t * /* O - First node or @code NULL@ if the file could not be read. */
|
||||
mxmlSAXLoadFd(mxml_node_t *top, /* I - Top node */
|
||||
int fd, /* I - File descriptor to read from */
|
||||
mxml_load_cb_t cb, /* I - Callback function or MXML_NO_CALLBACK */
|
||||
mxml_sax_cb_t sax_cb, /* I - SAX callback or MXML_NO_CALLBACK */
|
||||
mxml_load_cb_t cb, /* I - Callback function or constant */
|
||||
mxml_sax_cb_t sax_cb, /* I - SAX callback or @code MXML_NO_CALLBACK@ */
|
||||
void *sax_data) /* I - SAX user data */
|
||||
{
|
||||
_mxml_fdbuf_t buf; /* File descriptor buffer */
|
||||
@ -454,26 +442,23 @@ mxmlSAXLoadFd(mxml_node_t *top, /* I - Top node */
|
||||
* If no top node is provided, the XML file MUST be well-formed with a
|
||||
* single parent node like <?xml> for the entire file. The callback
|
||||
* function returns the value type that should be used for child nodes.
|
||||
* If MXML_NO_CALLBACK is specified then all child nodes will be either
|
||||
* MXML_ELEMENT or MXML_TEXT nodes.
|
||||
* The constants @code MXML_INTEGER_CALLBACK@, @code MXML_OPAQUE_CALLBACK@,
|
||||
* @code MXML_REAL_CALLBACK@, and @code MXML_TEXT_CALLBACK@ are defined for
|
||||
* loading child nodes of the specified type.
|
||||
*
|
||||
* The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK,
|
||||
* MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading
|
||||
* child nodes of the specified type.
|
||||
*
|
||||
* The SAX callback must call mxmlRetain() for any nodes that need to
|
||||
* The SAX callback must call @link mxmlRetain@ for any nodes that need to
|
||||
* be kept for later use. Otherwise, nodes are deleted when the parent
|
||||
* node is closed or after each data, comment, CDATA, or directive node.
|
||||
*
|
||||
* @since Mini-XML 2.3@
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - First node or NULL if the file could not be read. */
|
||||
mxml_node_t * /* O - First node or @code NULL@ if the file could not be read. */
|
||||
mxmlSAXLoadFile(
|
||||
mxml_node_t *top, /* I - Top node */
|
||||
FILE *fp, /* I - File to read from */
|
||||
mxml_load_cb_t cb, /* I - Callback function or MXML_NO_CALLBACK */
|
||||
mxml_sax_cb_t sax_cb, /* I - SAX callback or MXML_NO_CALLBACK */
|
||||
mxml_load_cb_t cb, /* I - Callback function or constant */
|
||||
mxml_sax_cb_t sax_cb, /* I - SAX callback or @code MXML_NO_CALLBACK@ */
|
||||
void *sax_data) /* I - SAX user data */
|
||||
{
|
||||
/*
|
||||
@ -492,26 +477,23 @@ mxmlSAXLoadFile(
|
||||
* If no top node is provided, the XML string MUST be well-formed with a
|
||||
* single parent node like <?xml> for the entire string. The callback
|
||||
* function returns the value type that should be used for child nodes.
|
||||
* If MXML_NO_CALLBACK is specified then all child nodes will be either
|
||||
* MXML_ELEMENT or MXML_TEXT nodes.
|
||||
* The constants @code MXML_INTEGER_CALLBACK@, @code MXML_OPAQUE_CALLBACK@,
|
||||
* @code MXML_REAL_CALLBACK@, and @code MXML_TEXT_CALLBACK@ are defined for
|
||||
* loading child nodes of the specified type.
|
||||
*
|
||||
* The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK,
|
||||
* MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading
|
||||
* child nodes of the specified type.
|
||||
*
|
||||
* The SAX callback must call mxmlRetain() for any nodes that need to
|
||||
* The SAX callback must call @link mxmlRetain@ for any nodes that need to
|
||||
* be kept for later use. Otherwise, nodes are deleted when the parent
|
||||
* node is closed or after each data, comment, CDATA, or directive node.
|
||||
*
|
||||
* @since Mini-XML 2.3@
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - First node or NULL if the string has errors. */
|
||||
mxml_node_t * /* O - First node or @code NULL@ if the string has errors. */
|
||||
mxmlSAXLoadString(
|
||||
mxml_node_t *top, /* I - Top node */
|
||||
const char *s, /* I - String to load */
|
||||
mxml_load_cb_t cb, /* I - Callback function or MXML_NO_CALLBACK */
|
||||
mxml_sax_cb_t sax_cb, /* I - SAX callback or MXML_NO_CALLBACK */
|
||||
mxml_load_cb_t cb, /* I - Callback function or constant */
|
||||
mxml_sax_cb_t sax_cb, /* I - SAX callback or @code MXML_NO_CALLBACK@ */
|
||||
void *sax_data) /* I - SAX user data */
|
||||
{
|
||||
/*
|
||||
@ -529,7 +511,7 @@ mxmlSAXLoadString(
|
||||
* return 0 on success and non-zero on error.
|
||||
*
|
||||
* The save function accepts a node pointer and must return a malloc'd
|
||||
* string on success and NULL on error.
|
||||
* string on success and @code NULL@ on error.
|
||||
*
|
||||
*/
|
||||
|
||||
|
20
mxml-get.c
20
mxml-get.c
@ -28,7 +28,7 @@
|
||||
* @since Mini-XML 2.7@
|
||||
*/
|
||||
|
||||
const char * /* O - CDATA value or NULL */
|
||||
const char * /* O - CDATA value or @code NULL@ */
|
||||
mxmlGetCDATA(mxml_node_t *node) /* I - Node to get */
|
||||
{
|
||||
/*
|
||||
@ -56,7 +56,7 @@ mxmlGetCDATA(mxml_node_t *node) /* I - Node to get */
|
||||
* @since Mini-XML 2.7@
|
||||
*/
|
||||
|
||||
const void * /* O - Custom value or NULL */
|
||||
const void * /* O - Custom value or @code NULL@ */
|
||||
mxmlGetCustom(mxml_node_t *node) /* I - Node to get */
|
||||
{
|
||||
/*
|
||||
@ -89,7 +89,7 @@ mxmlGetCustom(mxml_node_t *node) /* I - Node to get */
|
||||
* @since Mini-XML 2.7@
|
||||
*/
|
||||
|
||||
const char * /* O - Element name or NULL */
|
||||
const char * /* O - Element name or @code NULL@ */
|
||||
mxmlGetElement(mxml_node_t *node) /* I - Node to get */
|
||||
{
|
||||
/*
|
||||
@ -116,7 +116,7 @@ mxmlGetElement(mxml_node_t *node) /* I - Node to get */
|
||||
* @since Mini-XML 2.7@
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - First child or NULL */
|
||||
mxml_node_t * /* O - First child or @code NULL@ */
|
||||
mxmlGetFirstChild(mxml_node_t *node) /* I - Node to get */
|
||||
{
|
||||
/*
|
||||
@ -177,7 +177,7 @@ mxmlGetInteger(mxml_node_t *node) /* I - Node to get */
|
||||
* @since Mini-XML 2.7@
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - Last child or NULL */
|
||||
mxml_node_t * /* O - Last child or @code NULL@ */
|
||||
mxmlGetLastChild(mxml_node_t *node) /* I - Node to get */
|
||||
{
|
||||
/*
|
||||
@ -230,7 +230,7 @@ mxmlGetNextSibling(mxml_node_t *node) /* I - Node to get */
|
||||
* @since Mini-XML 2.7@
|
||||
*/
|
||||
|
||||
const char * /* O - Opaque string or NULL */
|
||||
const char * /* O - Opaque string or @code NULL@ */
|
||||
mxmlGetOpaque(mxml_node_t *node) /* I - Node to get */
|
||||
{
|
||||
/*
|
||||
@ -263,7 +263,7 @@ mxmlGetOpaque(mxml_node_t *node) /* I - Node to get */
|
||||
* @since Mini-XML 2.7@
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - Parent node or NULL */
|
||||
mxml_node_t * /* O - Parent node or @code NULL@ */
|
||||
mxmlGetParent(mxml_node_t *node) /* I - Node to get */
|
||||
{
|
||||
/*
|
||||
@ -289,7 +289,7 @@ mxmlGetParent(mxml_node_t *node) /* I - Node to get */
|
||||
* @since Mini-XML 2.7@
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - Previous node or NULL */
|
||||
mxml_node_t * /* O - Previous node or @code NULL@ */
|
||||
mxmlGetPrevSibling(mxml_node_t *node) /* I - Node to get */
|
||||
{
|
||||
/*
|
||||
@ -344,12 +344,12 @@ mxmlGetReal(mxml_node_t *node) /* I - Node to get */
|
||||
* 'mxmlGetText()' - Get the text value for a node or its first child.
|
||||
*
|
||||
* @code NULL@ is returned if the node (or its first child) is not a text node.
|
||||
* The "whitespace" argument can be NULL.
|
||||
* The "whitespace" argument can be @code NULL@.
|
||||
*
|
||||
* @since Mini-XML 2.7@
|
||||
*/
|
||||
|
||||
const char * /* O - Text string or NULL */
|
||||
const char * /* O - Text string or @code NULL@ */
|
||||
mxmlGetText(mxml_node_t *node, /* I - Node to get */
|
||||
int *whitespace) /* O - 1 if string is preceded by whitespace, 0 otherwise */
|
||||
{
|
||||
|
30
mxml-index.c
30
mxml-index.c
@ -62,10 +62,12 @@ mxmlIndexDelete(mxml_index_t *ind) /* I - Index to delete */
|
||||
/*
|
||||
* 'mxmlIndexEnum()' - Return the next node in the index.
|
||||
*
|
||||
* Nodes are returned in the sorted order of the index.
|
||||
* You should call @link mxmlIndexReset@ prior to using this function to get
|
||||
* the first node in the index. Nodes are returned in the sorted order of the
|
||||
* index.
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - Next node or NULL if there is none */
|
||||
mxml_node_t * /* O - Next node or @code NULL@ if there is none */
|
||||
mxmlIndexEnum(mxml_index_t *ind) /* I - Index to enumerate */
|
||||
{
|
||||
/*
|
||||
@ -89,13 +91,13 @@ mxmlIndexEnum(mxml_index_t *ind) /* I - Index to enumerate */
|
||||
/*
|
||||
* 'mxmlIndexFind()' - Find the next matching node.
|
||||
*
|
||||
* You should call mxmlIndexReset() prior to using this function for
|
||||
* You should call @link mxmlIndexReset@ prior to using this function for
|
||||
* the first time with a particular set of "element" and "value"
|
||||
* strings. Passing NULL for both "element" and "value" is equivalent
|
||||
* to calling mxmlIndexEnum().
|
||||
* strings. Passing @code NULL@ for both "element" and "value" is equivalent
|
||||
* to calling @link mxmlIndexEnum@.
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - Node or NULL if none found */
|
||||
mxml_node_t * /* O - Node or @code NULL@ if none found */
|
||||
mxmlIndexFind(mxml_index_t *ind, /* I - Index to search */
|
||||
const char *element, /* I - Element name to find, if any */
|
||||
const char *value) /* I - Attribute value, if any */
|
||||
@ -297,7 +299,7 @@ mxmlIndexGetCount(mxml_index_t *ind) /* I - Index of nodes */
|
||||
* 'mxmlIndexNew()' - Create a new index.
|
||||
*
|
||||
* The index will contain all nodes that contain the named element and/or
|
||||
* attribute. If both "element" and "attr" are NULL, then the index will
|
||||
* attribute. If both "element" and "attr" are @code NULL@, then the index will
|
||||
* contain a sorted list of the elements in the node tree. Nodes are
|
||||
* sorted by element name and optionally by attribute value if the "attr"
|
||||
* argument is not NULL.
|
||||
@ -305,8 +307,8 @@ mxmlIndexGetCount(mxml_index_t *ind) /* I - Index of nodes */
|
||||
|
||||
mxml_index_t * /* O - New index */
|
||||
mxmlIndexNew(mxml_node_t *node, /* I - XML node tree */
|
||||
const char *element, /* I - Element to index or NULL for all */
|
||||
const char *attr) /* I - Attribute to index or NULL for none */
|
||||
const char *element, /* I - Element to index or @code NULL@ for all */
|
||||
const char *attr) /* I - Attribute to index or @code NULL@ for none */
|
||||
{
|
||||
mxml_index_t *ind; /* New index */
|
||||
mxml_node_t *current, /* Current node in index */
|
||||
@ -457,11 +459,11 @@ mxmlIndexNew(mxml_node_t *node, /* I - XML node tree */
|
||||
* 'mxmlIndexReset()' - Reset the enumeration/find pointer in the index and
|
||||
* return the first node in the index.
|
||||
*
|
||||
* This function should be called prior to using mxmlIndexEnum() or
|
||||
* mxmlIndexFind() for the first time.
|
||||
* This function should be called prior to using @link mxmlIndexEnum@ or
|
||||
* @link mxmlIndexFind@ for the first time.
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - First node or NULL if there is none */
|
||||
mxml_node_t * /* O - First node or @code NULL@ if there is none */
|
||||
mxmlIndexReset(mxml_index_t *ind) /* I - Index to reset */
|
||||
{
|
||||
#ifdef DEBUG
|
||||
@ -537,8 +539,8 @@ index_compare(mxml_index_t *ind, /* I - Index */
|
||||
|
||||
static int /* O - Result of comparison */
|
||||
index_find(mxml_index_t *ind, /* I - Index */
|
||||
const char *element, /* I - Element name or NULL */
|
||||
const char *value, /* I - Attribute value or NULL */
|
||||
const char *element, /* I - Element name or @code NULL@ */
|
||||
const char *value, /* I - Attribute value or @code NULL@ */
|
||||
mxml_node_t *node) /* I - Node */
|
||||
{
|
||||
int diff; /* Difference */
|
||||
|
127
mxml-node.c
127
mxml-node.c
@ -31,18 +31,18 @@ static mxml_node_t *mxml_new(mxml_node_t *parent, mxml_type_t type);
|
||||
/*
|
||||
* 'mxmlAdd()' - Add a node to a tree.
|
||||
*
|
||||
* Adds the specified node to the parent. If the child argument is not
|
||||
* NULL, puts the new node before or after the specified child depending
|
||||
* on the value of the where argument. If the child argument is NULL,
|
||||
* puts the new node at the beginning of the child list (MXML_ADD_BEFORE)
|
||||
* or at the end of the child list (MXML_ADD_AFTER). The constant
|
||||
* MXML_ADD_TO_PARENT can be used to specify a NULL child pointer.
|
||||
* Adds the specified node to the parent. If the child argument is not
|
||||
* @code NULL@, puts the new node before or after the specified child depending
|
||||
* on the value of the where argument. If the child argument is @code NULL@,
|
||||
* puts the new node at the beginning of the child list (@code MXML_ADD_BEFORE@)
|
||||
* or at the end of the child list (@code MXML_ADD_AFTER@). The constant
|
||||
* @code MXML_ADD_TO_PARENT@ can be used to specify a @code NULL@ child pointer.
|
||||
*/
|
||||
|
||||
void
|
||||
mxmlAdd(mxml_node_t *parent, /* I - Parent node */
|
||||
int where, /* I - Where to add, MXML_ADD_BEFORE or MXML_ADD_AFTER */
|
||||
mxml_node_t *child, /* I - Child node for where or MXML_ADD_TO_PARENT */
|
||||
int where, /* I - Where to add, @code MXML_ADD_BEFORE@ or @code MXML_ADD_AFTER@ */
|
||||
mxml_node_t *child, /* I - Child node for where or @code MXML_ADD_TO_PARENT@ */
|
||||
mxml_node_t *node) /* I - Node to add */
|
||||
{
|
||||
#ifdef DEBUG
|
||||
@ -170,7 +170,7 @@ mxmlAdd(mxml_node_t *parent, /* I - Parent node */
|
||||
* 'mxmlDelete()' - Delete a node and all of its children.
|
||||
*
|
||||
* If the specified node has a parent, this function first removes the
|
||||
* node from its parent using the mxmlRemove() function.
|
||||
* node from its parent using the @link mxmlRemove@ function.
|
||||
*/
|
||||
|
||||
void
|
||||
@ -274,15 +274,16 @@ mxmlGetRefCount(mxml_node_t *node) /* I - Node */
|
||||
* 'mxmlNewCDATA()' - Create a new CDATA node.
|
||||
*
|
||||
* The new CDATA node is added to the end of the specified parent's child
|
||||
* list. The constant MXML_NO_PARENT can be used to specify that the new
|
||||
* CDATA node has no parent. The data string must be nul-terminated and
|
||||
* is copied into the new node. CDATA nodes use the MXML_ELEMENT type.
|
||||
* list. The constant @code MXML_NO_PARENT@ can be used to specify that the new
|
||||
* CDATA node has no parent. The data string must be nul-terminated and
|
||||
* is copied into the new node. CDATA nodes currently use the
|
||||
* @code MXML_ELEMENT@ type.
|
||||
*
|
||||
* @since Mini-XML 2.3@
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - New node */
|
||||
mxmlNewCDATA(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */
|
||||
mxmlNewCDATA(mxml_node_t *parent, /* I - Parent node or @code MXML_NO_PARENT@ */
|
||||
const char *data) /* I - Data string */
|
||||
{
|
||||
mxml_node_t *node; /* New node */
|
||||
@ -315,8 +316,8 @@ mxmlNewCDATA(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */
|
||||
* 'mxmlNewCustom()' - Create a new custom data node.
|
||||
*
|
||||
* The new custom node is added to the end of the specified parent's child
|
||||
* list. The constant MXML_NO_PARENT can be used to specify that the new
|
||||
* element node has no parent. NULL can be passed when the data in the
|
||||
* list. The constant @code MXML_NO_PARENT@ can be used to specify that the new
|
||||
* element node has no parent. @code NULL@ can be passed when the data in the
|
||||
* node is not dynamically allocated or is separately managed.
|
||||
*
|
||||
* @since Mini-XML 2.1@
|
||||
@ -324,7 +325,7 @@ mxmlNewCDATA(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */
|
||||
|
||||
mxml_node_t * /* O - New node */
|
||||
mxmlNewCustom(
|
||||
mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */
|
||||
mxml_node_t *parent, /* I - Parent node or @code MXML_NO_PARENT@ */
|
||||
void *data, /* I - Pointer to data */
|
||||
mxml_custom_destroy_cb_t destroy) /* I - Function to destroy data */
|
||||
{
|
||||
@ -354,12 +355,12 @@ mxmlNewCustom(
|
||||
* 'mxmlNewElement()' - Create a new element node.
|
||||
*
|
||||
* The new element node is added to the end of the specified parent's child
|
||||
* list. The constant MXML_NO_PARENT can be used to specify that the new
|
||||
* list. The constant @code MXML_NO_PARENT@ can be used to specify that the new
|
||||
* element node has no parent.
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - New node */
|
||||
mxmlNewElement(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */
|
||||
mxmlNewElement(mxml_node_t *parent, /* I - Parent node or @code MXML_NO_PARENT@ */
|
||||
const char *name) /* I - Name of element */
|
||||
{
|
||||
mxml_node_t *node; /* New node */
|
||||
@ -392,12 +393,12 @@ mxmlNewElement(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */
|
||||
* 'mxmlNewInteger()' - Create a new integer node.
|
||||
*
|
||||
* The new integer node is added to the end of the specified parent's child
|
||||
* list. The constant MXML_NO_PARENT can be used to specify that the new
|
||||
* list. The constant @code MXML_NO_PARENT@ can be used to specify that the new
|
||||
* integer node has no parent.
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - New node */
|
||||
mxmlNewInteger(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */
|
||||
mxmlNewInteger(mxml_node_t *parent, /* I - Parent node or @code MXML_NO_PARENT@ */
|
||||
int integer) /* I - Integer value */
|
||||
{
|
||||
mxml_node_t *node; /* New node */
|
||||
@ -421,14 +422,14 @@ mxmlNewInteger(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */
|
||||
/*
|
||||
* 'mxmlNewOpaque()' - Create a new opaque string.
|
||||
*
|
||||
* The new opaque node is added to the end of the specified parent's child
|
||||
* list. The constant MXML_NO_PARENT can be used to specify that the new
|
||||
* opaque node has no parent. The opaque string must be nul-terminated and
|
||||
* is copied into the new node.
|
||||
* The new opaque string node is added to the end of the specified parent's
|
||||
* child list. The constant @code MXML_NO_PARENT@ can be used to specify that
|
||||
* the new opaque string node has no parent. The opaque string must be nul-
|
||||
* terminated and is copied into the new node.
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - New node */
|
||||
mxmlNewOpaque(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */
|
||||
mxmlNewOpaque(mxml_node_t *parent, /* I - Parent node or @code MXML_NO_PARENT@ */
|
||||
const char *opaque) /* I - Opaque string */
|
||||
{
|
||||
mxml_node_t *node; /* New node */
|
||||
@ -457,16 +458,62 @@ mxmlNewOpaque(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlNewOpaquef()' - Create a new formatted opaque string node.
|
||||
*
|
||||
* The new opaque string node is added to the end of the specified parent's
|
||||
* child list. The constant @code MXML_NO_PARENT@ can be used to specify that
|
||||
* the new opaque string node has no parent. The format string must be
|
||||
* nul-terminated and is formatted into the new node.
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - New node */
|
||||
mxmlNewOpaquef(mxml_node_t *parent, /* I - Parent node or @code MXML_NO_PARENT@ */
|
||||
const char *format, /* I - Printf-style format string */
|
||||
...) /* I - Additional args as needed */
|
||||
{
|
||||
mxml_node_t *node; /* New node */
|
||||
va_list ap; /* Pointer to arguments */
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "mxmlNewOpaquef(parent=%p, format=\"%s\", ...)\n", parent, format ? format : "(null)");
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!format)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Create the node and set the text value...
|
||||
*/
|
||||
|
||||
if ((node = mxml_new(parent, MXML_OPAQUE)) != NULL)
|
||||
{
|
||||
va_start(ap, format);
|
||||
|
||||
node->value.opaque = _mxml_vstrdupf(format, ap);
|
||||
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
return (node);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlNewReal()' - Create a new real number node.
|
||||
*
|
||||
* The new real number node is added to the end of the specified parent's
|
||||
* child list. The constant MXML_NO_PARENT can be used to specify that
|
||||
* child list. The constant @code MXML_NO_PARENT@ can be used to specify that
|
||||
* the new real number node has no parent.
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - New node */
|
||||
mxmlNewReal(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */
|
||||
mxmlNewReal(mxml_node_t *parent, /* I - Parent node or @code MXML_NO_PARENT@ */
|
||||
double real) /* I - Real number value */
|
||||
{
|
||||
mxml_node_t *node; /* New node */
|
||||
@ -491,14 +538,14 @@ mxmlNewReal(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */
|
||||
* 'mxmlNewText()' - Create a new text fragment node.
|
||||
*
|
||||
* The new text node is added to the end of the specified parent's child
|
||||
* list. The constant MXML_NO_PARENT can be used to specify that the new
|
||||
* text node has no parent. The whitespace parameter is used to specify
|
||||
* whether leading whitespace is present before the node. The text
|
||||
* list. The constant @code MXML_NO_PARENT@ can be used to specify that the new
|
||||
* text node has no parent. The whitespace parameter is used to specify
|
||||
* whether leading whitespace is present before the node. The text
|
||||
* string must be nul-terminated and is copied into the new node.
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - New node */
|
||||
mxmlNewText(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */
|
||||
mxmlNewText(mxml_node_t *parent, /* I - Parent node or @code MXML_NO_PARENT@ */
|
||||
int whitespace, /* I - 1 = leading whitespace, 0 = no whitespace */
|
||||
const char *string) /* I - String */
|
||||
{
|
||||
@ -535,16 +582,16 @@ mxmlNewText(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */
|
||||
* 'mxmlNewTextf()' - Create a new formatted text fragment node.
|
||||
*
|
||||
* The new text node is added to the end of the specified parent's child
|
||||
* list. The constant MXML_NO_PARENT can be used to specify that the new
|
||||
* text node has no parent. The whitespace parameter is used to specify
|
||||
* whether leading whitespace is present before the node. The format
|
||||
* list. The constant @code MXML_NO_PARENT@ can be used to specify that the new
|
||||
* text node has no parent. The whitespace parameter is used to specify
|
||||
* whether leading whitespace is present before the node. The format
|
||||
* string must be nul-terminated and is formatted into the new node.
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - New node */
|
||||
mxmlNewTextf(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */
|
||||
mxmlNewTextf(mxml_node_t *parent, /* I - Parent node or @code MXML_NO_PARENT@ */
|
||||
int whitespace, /* I - 1 = leading whitespace, 0 = no whitespace */
|
||||
const char *format, /* I - Printf-style frmat string */
|
||||
const char *format, /* I - Printf-style format string */
|
||||
...) /* I - Additional args as needed */
|
||||
{
|
||||
mxml_node_t *node; /* New node */
|
||||
@ -584,8 +631,8 @@ mxmlNewTextf(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */
|
||||
/*
|
||||
* 'mxmlRemove()' - Remove a node from its parent.
|
||||
*
|
||||
* Does not free memory used by the node - use mxmlDelete() for that.
|
||||
* This function does nothing if the node has no parent.
|
||||
* This function does not free memory used by the node - use @link mxmlDelete@
|
||||
* for that. This function does nothing if the node has no parent.
|
||||
*/
|
||||
|
||||
void
|
||||
@ -652,7 +699,7 @@ mxmlRemove(mxml_node_t *node) /* I - Node to remove */
|
||||
* 'mxmlNewXML()' - Create a new XML document tree.
|
||||
*
|
||||
* The "version" argument specifies the version number to put in the
|
||||
* ?xml element node. If NULL, version 1.0 is assumed.
|
||||
* ?xml element node. If @code NULL@, version "1.0" is assumed.
|
||||
*
|
||||
* @since Mini-XML 2.3@
|
||||
*/
|
||||
@ -674,7 +721,7 @@ mxmlNewXML(const char *version) /* I - Version number to use */
|
||||
* 'mxmlRelease()' - Release a node.
|
||||
*
|
||||
* When the reference count reaches zero, the node (and any children)
|
||||
* is deleted via mxmlDelete().
|
||||
* is deleted via @link mxmlDelete@.
|
||||
*
|
||||
* @since Mini-XML 2.3@
|
||||
*/
|
||||
|
@ -24,22 +24,22 @@
|
||||
* 'mxmlFindElement()' - Find the named element.
|
||||
*
|
||||
* The search is constrained by the name, attribute name, and value; any
|
||||
* NULL names or values are treated as wildcards, so different kinds of
|
||||
* @code NULL@ names or values are treated as wildcards, so different kinds of
|
||||
* searches can be implemented by looking for all elements of a given name
|
||||
* or all elements with a specific attribute. The descend argument determines
|
||||
* whether the search descends into child nodes; normally you will use
|
||||
* MXML_DESCEND_FIRST for the initial search and MXML_NO_DESCEND to find
|
||||
* additional direct descendents of the node. The top node argument
|
||||
* @code MXML_DESCEND_FIRST@ for the initial search and @code MXML_NO_DESCEND@
|
||||
* to find additional direct descendents of the node. The top node argument
|
||||
* constrains the search to a particular node's children.
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - Element node or NULL */
|
||||
mxml_node_t * /* O - Element node or @code NULL@ */
|
||||
mxmlFindElement(mxml_node_t *node, /* I - Current node */
|
||||
mxml_node_t *top, /* I - Top node */
|
||||
const char *name, /* I - Element name or NULL for any */
|
||||
const char *attr, /* I - Attribute name, or NULL for none */
|
||||
const char *value, /* I - Attribute value, or NULL for any */
|
||||
int descend) /* I - Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST */
|
||||
const char *element, /* I - Element name or @code NULL@ for any */
|
||||
const char *attr, /* I - Attribute name, or @code NULL@ for none */
|
||||
const char *value, /* I - Attribute value, or @code NULL@ for any */
|
||||
int descend) /* I - Descend into tree - @code MXML_DESCEND@, @code MXML_NO_DESCEND@, or @code MXML_DESCEND_FIRST@ */
|
||||
{
|
||||
const char *temp; /* Current attribute value */
|
||||
|
||||
@ -69,7 +69,7 @@ mxmlFindElement(mxml_node_t *node, /* I - Current node */
|
||||
|
||||
if (node->type == MXML_ELEMENT &&
|
||||
node->value.element.name &&
|
||||
(!name || !strcmp(node->value.element.name, name)))
|
||||
(!element || !strcmp(node->value.element.name, element)))
|
||||
{
|
||||
/*
|
||||
* See if we need to check for an attribute...
|
||||
@ -120,7 +120,7 @@ mxmlFindElement(mxml_node_t *node, /* I - Current node */
|
||||
* @since Mini-XML 2.7@
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - Found node or NULL */
|
||||
mxml_node_t * /* O - Found node or @code NULL@ */
|
||||
mxmlFindPath(mxml_node_t *top, /* I - Top node */
|
||||
const char *path) /* I - Path to element */
|
||||
{
|
||||
@ -198,14 +198,14 @@ mxmlFindPath(mxml_node_t *top, /* I - Top node */
|
||||
* 'mxmlWalkNext()' - Walk to the next logical node in the tree.
|
||||
*
|
||||
* The descend argument controls whether the first child is considered
|
||||
* to be the next node. The top node argument constrains the walk to
|
||||
* to be the next node. The top node argument constrains the walk to
|
||||
* the node's children.
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - Next node or NULL */
|
||||
mxml_node_t * /* O - Next node or @code NULL@ */
|
||||
mxmlWalkNext(mxml_node_t *node, /* I - Current node */
|
||||
mxml_node_t *top, /* I - Top node */
|
||||
int descend) /* I - Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST */
|
||||
int descend) /* I - Descend into tree - @code MXML_DESCEND@, @code MXML_NO_DESCEND@, or @code MXML_DESCEND_FIRST@ */
|
||||
{
|
||||
if (!node)
|
||||
return (NULL);
|
||||
@ -236,14 +236,14 @@ mxmlWalkNext(mxml_node_t *node, /* I - Current node */
|
||||
* 'mxmlWalkPrev()' - Walk to the previous logical node in the tree.
|
||||
*
|
||||
* The descend argument controls whether the previous node's last child
|
||||
* is considered to be the previous node. The top node argument constrains
|
||||
* is considered to be the previous node. The top node argument constrains
|
||||
* the walk to the node's children.
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - Previous node or NULL */
|
||||
mxml_node_t * /* O - Previous node or @code NULL@ */
|
||||
mxmlWalkPrev(mxml_node_t *node, /* I - Current node */
|
||||
mxml_node_t *top, /* I - Top node */
|
||||
int descend) /* I - Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST */
|
||||
int descend) /* I - Descend into tree - @code MXML_DESCEND@, @code MXML_NO_DESCEND@, or @code MXML_DESCEND_FIRST@ */
|
||||
{
|
||||
if (!node || node == top)
|
||||
return (NULL);
|
||||
|
44
mxml-set.c
44
mxml-set.c
@ -193,6 +193,50 @@ mxmlSetOpaque(mxml_node_t *node, /* I - Node to set */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlSetOpaquef()' - Set the value of an opaque string node to a formatted string.
|
||||
*
|
||||
* The node is not changed if it (or its first child) is not an opaque node.
|
||||
*
|
||||
* @since Mini-XML 2.11@
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on failure */
|
||||
mxmlSetOpaquef(mxml_node_t *node, /* I - Node to set */
|
||||
const char *format, /* I - Printf-style format string */
|
||||
...) /* I - Additional arguments as needed */
|
||||
{
|
||||
va_list ap; /* Pointer to arguments */
|
||||
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (node && node->type == MXML_ELEMENT &&
|
||||
node->child && node->child->type == MXML_OPAQUE)
|
||||
node = node->child;
|
||||
|
||||
if (!node || node->type != MXML_OPAQUE || !format)
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
* Free any old string value and set the new value...
|
||||
*/
|
||||
|
||||
if (node->value.opaque)
|
||||
free(node->value.opaque);
|
||||
|
||||
va_start(ap, format);
|
||||
|
||||
node->value.opaque = _mxml_strdupf(format, ap);
|
||||
|
||||
va_end(ap);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlSetReal()' - Set the value of a real number node.
|
||||
*
|
||||
|
18
mxml.h
18
mxml.h
@ -211,7 +211,7 @@ extern const char *mxmlEntityGetName(int val);
|
||||
extern int mxmlEntityGetValue(const char *name);
|
||||
extern void mxmlEntityRemoveCallback(mxml_entity_cb_t cb);
|
||||
extern mxml_node_t *mxmlFindElement(mxml_node_t *node, mxml_node_t *top,
|
||||
const char *name, const char *attr,
|
||||
const char *element, const char *attr,
|
||||
const char *value, int descend);
|
||||
extern mxml_node_t *mxmlFindPath(mxml_node_t *node, const char *path);
|
||||
extern const char *mxmlGetCDATA(mxml_node_t *node);
|
||||
@ -250,11 +250,14 @@ extern mxml_node_t *mxmlNewCustom(mxml_node_t *parent, void *data,
|
||||
extern mxml_node_t *mxmlNewElement(mxml_node_t *parent, const char *name);
|
||||
extern mxml_node_t *mxmlNewInteger(mxml_node_t *parent, int integer);
|
||||
extern mxml_node_t *mxmlNewOpaque(mxml_node_t *parent, const char *opaque);
|
||||
extern mxml_node_t *mxmlNewOpaquef(mxml_node_t *parent, const char *format, ...)
|
||||
# ifdef __GNUC__
|
||||
__attribute__ ((__format__ (__printf__, 2, 3)))
|
||||
# endif /* __GNUC__ */
|
||||
;
|
||||
extern mxml_node_t *mxmlNewReal(mxml_node_t *parent, double real);
|
||||
extern mxml_node_t *mxmlNewText(mxml_node_t *parent, int whitespace,
|
||||
const char *string);
|
||||
extern mxml_node_t *mxmlNewTextf(mxml_node_t *parent, int whitespace,
|
||||
const char *format, ...)
|
||||
extern mxml_node_t *mxmlNewText(mxml_node_t *parent, int whitespace, const char *string);
|
||||
extern mxml_node_t *mxmlNewTextf(mxml_node_t *parent, int whitespace, const char *format, ...)
|
||||
# ifdef __GNUC__
|
||||
__attribute__ ((__format__ (__printf__, 3, 4)))
|
||||
# endif /* __GNUC__ */
|
||||
@ -289,6 +292,11 @@ extern int mxmlSetElement(mxml_node_t *node, const char *name);
|
||||
extern void mxmlSetErrorCallback(mxml_error_cb_t cb);
|
||||
extern int mxmlSetInteger(mxml_node_t *node, int integer);
|
||||
extern int mxmlSetOpaque(mxml_node_t *node, const char *opaque);
|
||||
extern int mxmlSetOpaquef(mxml_node_t *node, const char *format, ...)
|
||||
# ifdef __GNUC__
|
||||
__attribute__ ((__format__ (__printf__, 2, 3)))
|
||||
# endif /* __GNUC__ */
|
||||
;
|
||||
extern int mxmlSetReal(mxml_node_t *node, double real);
|
||||
extern int mxmlSetText(mxml_node_t *node, int whitespace,
|
||||
const char *string);
|
||||
|
102
mxmldoc.c
102
mxmldoc.c
@ -181,7 +181,7 @@ static int scan_file(const char *filename, FILE *fp, mxml_node_t *doc);
|
||||
static void sort_node(mxml_node_t *tree, mxml_node_t *func);
|
||||
static void update_comment(mxml_node_t *parent, mxml_node_t *comment);
|
||||
static void usage(const char *option);
|
||||
static void write_description(FILE *out, mxml_node_t *description, const char *element, int summary);
|
||||
static void write_description(FILE *out, int mode, mxml_node_t *description, const char *element, int summary);
|
||||
#ifdef __APPLE__
|
||||
static void write_docset(const char *docset, const char *section, const char *title, const char *author, const char *copyright, const char *docversion, const char *feedname, const char *feedurl, const char *cssfile, const char *headerfile, const char *bodyfile, mmd_t *body, mxml_node_t *doc, const char *footerfile);
|
||||
#endif /* __APPLE__ */
|
||||
@ -3632,6 +3632,7 @@ usage(const char *option) /* I - Unknown option */
|
||||
static void
|
||||
write_description(
|
||||
FILE *out, /* I - Output file */
|
||||
int mode, /* I - Output mode */
|
||||
mxml_node_t *description, /* I - Description node */
|
||||
const char *element, /* I - HTML element, if any */
|
||||
int summary) /* I - Show summary */
|
||||
@ -3775,7 +3776,10 @@ write_description(
|
||||
}
|
||||
else if (*ptr == '\n' && ptr[1] == '\n' && ptr[2] && ptr[2] != '@')
|
||||
{
|
||||
fputs("<br>\n<br>\n", out);
|
||||
if (mode == OUTPUT_EPUB)
|
||||
fputs("<br />\n<br />\n", out);
|
||||
else
|
||||
fputs("<br>\n<br>\n", out);
|
||||
ptr ++;
|
||||
}
|
||||
else
|
||||
@ -4676,7 +4680,7 @@ write_function(FILE *out, /* I - Output file */
|
||||
fprintf(out, "<h%d class=\"%s\">%s<a id=\"%s\">%s</a></h%d>\n", level, level == 3 ? "function" : "method", get_comment_info(description), name, name, level);
|
||||
|
||||
if (description)
|
||||
write_description(out, description, "p", 1);
|
||||
write_description(out, mode, description, "p", 1);
|
||||
|
||||
fputs("<p class=\"code\">\n", out);
|
||||
|
||||
@ -4702,7 +4706,7 @@ write_function(FILE *out, /* I - Output file */
|
||||
|
||||
fprintf(out, "%c%s\n    ", prefix, br);
|
||||
if (type->child)
|
||||
write_element(out, doc, type, OUTPUT_HTML);
|
||||
write_element(out, doc, type, mode);
|
||||
|
||||
fputs(mxmlElementGetAttr(arg, "name"), out);
|
||||
if ((defval = mxmlElementGetAttr(arg, "default")) != NULL)
|
||||
@ -4729,8 +4733,8 @@ write_function(FILE *out, /* I - Output file */
|
||||
adesc = mxmlFindElement(arg, arg, "description", NULL, NULL,
|
||||
MXML_DESCEND_FIRST);
|
||||
|
||||
write_description(out, adesc, "dd", 1);
|
||||
write_description(out, adesc, "dd", 0);
|
||||
write_description(out, mode, adesc, "dd", 1);
|
||||
write_description(out, mode, adesc, "dd", 0);
|
||||
}
|
||||
|
||||
fputs("</dl>\n", out);
|
||||
@ -4747,15 +4751,15 @@ write_function(FILE *out, /* I - Output file */
|
||||
adesc = mxmlFindElement(arg, arg, "description", NULL, NULL,
|
||||
MXML_DESCEND_FIRST);
|
||||
|
||||
write_description(out, adesc, "p", 1);
|
||||
write_description(out, adesc, "p", 0);
|
||||
write_description(out, mode, adesc, "p", 1);
|
||||
write_description(out, mode, adesc, "p", 0);
|
||||
}
|
||||
|
||||
if (description)
|
||||
{
|
||||
for (node = description->child; node; node = node->next)
|
||||
if (node->value.text.string &&
|
||||
(sep = strstr(node->value.text.string, "\n\n")) != NULL)
|
||||
if (node->value.opaque &&
|
||||
(sep = strstr(node->value.opaque, "\n\n")) != NULL)
|
||||
{
|
||||
sep += 2;
|
||||
if (*sep && strncmp(sep, "@since ", 7) &&
|
||||
@ -4767,7 +4771,7 @@ write_function(FILE *out, /* I - Output file */
|
||||
{
|
||||
fprintf(out, "<h%d class=\"discussion\">Discussion</h%d>\n", level + 1,
|
||||
level + 1);
|
||||
write_description(out, description, "p", 0);
|
||||
write_description(out, mode, description, "p", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5089,7 +5093,7 @@ write_html_body(
|
||||
fprintf(out, " <h3 class=\"typedef\"><a id=\"%s\">%s%s</a></h3>\n", name, get_comment_info(description), name);
|
||||
|
||||
if (description)
|
||||
write_description(out, description, "p", 1);
|
||||
write_description(out, mode, description, "p", 1);
|
||||
|
||||
fputs(" <p class=\"code\">\n"
|
||||
"typedef ", out);
|
||||
@ -5218,7 +5222,7 @@ write_html_body(
|
||||
fprintf(out, " <h3 class=\"variable\"><a id=\"%s\">%s%s</a></h3>\n", name, get_comment_info(description), name);
|
||||
|
||||
if (description)
|
||||
write_description(out, description, "p", 1);
|
||||
write_description(out, mode, description, "p", 1);
|
||||
|
||||
fputs(" <p class=\"code\">", out);
|
||||
|
||||
@ -5248,7 +5252,7 @@ write_html_body(
|
||||
fprintf(out, " <h3 class=\"enumeration\"><a id=\"%s\">%s%s</a></h3>\n", name, get_comment_info(description), name);
|
||||
|
||||
if (description)
|
||||
write_description(out, description, "p", 1);
|
||||
write_description(out, mode, description, "p", 1);
|
||||
|
||||
fputs(" <h4 class=\"constants\">Constants</h4>\n"
|
||||
" <dl>\n", out);
|
||||
@ -5264,8 +5268,8 @@ write_html_body(
|
||||
fprintf(out, " <dt>%s %s</dt>\n",
|
||||
mxmlElementGetAttr(arg, "name"), get_comment_info(description));
|
||||
|
||||
write_description(out, description, "dd", 1);
|
||||
write_description(out, description, "dd", 0);
|
||||
write_description(out, mode, description, "dd", 1);
|
||||
write_description(out, mode, description, "dd", 0);
|
||||
}
|
||||
|
||||
fputs("</dl>\n", out);
|
||||
@ -5435,11 +5439,20 @@ write_html_head(FILE *out, /* I - Output file */
|
||||
"}\n"
|
||||
".variable {\n"
|
||||
"}\n"
|
||||
"blockquote {\n"
|
||||
" border: solid thin gray;\n"
|
||||
" box-shadow: 3px 3px 5px rgba(0,0,0,0.5);\n"
|
||||
" padding: 0px 10px;\n"
|
||||
" page-break-inside: avoid;\n"
|
||||
"}\n"
|
||||
"p code, li code, p.code, pre, ul.code li {\n"
|
||||
" background: rgba(127,127,127,0.1);\n"
|
||||
" border: thin dotted gray;\n"
|
||||
" font-family: monospace;\n"
|
||||
" font-size: 90%;\n"
|
||||
" hyphens: manual;\n"
|
||||
" -webkit-hyphens: manual;\n"
|
||||
" page-break-inside: avoid;\n"
|
||||
"}\n"
|
||||
"p.code, pre, ul.code li {\n"
|
||||
" padding: 10px;\n"
|
||||
@ -5681,7 +5694,7 @@ write_man(const char *man_name, /* I - Name of manpage */
|
||||
NULL, MXML_DESCEND_FIRST);
|
||||
printf(".SS %s\n", cname);
|
||||
|
||||
write_description(stdout, description, NULL, 1);
|
||||
write_description(stdout, OUTPUT_MAN, description, NULL, 1);
|
||||
|
||||
printf(".PP\n"
|
||||
".nf\n"
|
||||
@ -5771,7 +5784,7 @@ write_man(const char *man_name, /* I - Name of manpage */
|
||||
puts("};\n"
|
||||
".fi");
|
||||
|
||||
write_description(stdout, description, NULL, 0);
|
||||
write_description(stdout, OUTPUT_MAN, description, NULL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5792,8 +5805,8 @@ write_man(const char *man_name, /* I - Name of manpage */
|
||||
NULL, MXML_DESCEND_FIRST);
|
||||
printf(".SS %s\n", name);
|
||||
|
||||
write_description(stdout, description, NULL, 1);
|
||||
write_description(stdout, description, NULL, 0);
|
||||
write_description(stdout, OUTPUT_MAN, description, NULL, 1);
|
||||
write_description(stdout, OUTPUT_MAN, description, NULL, 0);
|
||||
|
||||
for (arg = mxmlFindElement(scut, scut, "constant", NULL, NULL,
|
||||
MXML_DESCEND_FIRST);
|
||||
@ -5804,7 +5817,7 @@ write_man(const char *man_name, /* I - Name of manpage */
|
||||
description = mxmlFindElement(arg, arg, "description", NULL,
|
||||
NULL, MXML_DESCEND_FIRST);
|
||||
printf(".TP 5\n%s\n.br\n", mxmlElementGetAttr(arg, "name"));
|
||||
write_description(stdout, description, NULL, 1);
|
||||
write_description(stdout, OUTPUT_MAN, description, NULL, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5826,7 +5839,7 @@ write_man(const char *man_name, /* I - Name of manpage */
|
||||
NULL, MXML_DESCEND_FIRST);
|
||||
printf(".SS %s\n", name);
|
||||
|
||||
write_description(stdout, description, NULL, 1);
|
||||
write_description(stdout, OUTPUT_MAN, description, NULL, 1);
|
||||
|
||||
puts(".PP\n"
|
||||
".nf");
|
||||
@ -5866,7 +5879,7 @@ write_man(const char *man_name, /* I - Name of manpage */
|
||||
|
||||
puts(".fi");
|
||||
|
||||
write_description(stdout, description, NULL, 0);
|
||||
write_description(stdout, OUTPUT_MAN, description, NULL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5887,7 +5900,7 @@ write_man(const char *man_name, /* I - Name of manpage */
|
||||
NULL, MXML_DESCEND_FIRST);
|
||||
printf(".SS %s\n", cname);
|
||||
|
||||
write_description(stdout, description, NULL, 1);
|
||||
write_description(stdout, OUTPUT_MAN, description, NULL, 1);
|
||||
|
||||
printf(".PP\n"
|
||||
".nf\n"
|
||||
@ -5956,7 +5969,7 @@ write_man(const char *man_name, /* I - Name of manpage */
|
||||
puts("};\n"
|
||||
".fi");
|
||||
|
||||
write_description(stdout, description, NULL, 0);
|
||||
write_description(stdout, OUTPUT_MAN, description, NULL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5977,7 +5990,7 @@ write_man(const char *man_name, /* I - Name of manpage */
|
||||
NULL, MXML_DESCEND_FIRST);
|
||||
printf(".SS %s\n", name);
|
||||
|
||||
write_description(stdout, description, NULL, 1);
|
||||
write_description(stdout, OUTPUT_MAN, description, NULL, 1);
|
||||
|
||||
fputs(".PP\n"
|
||||
".nf\n"
|
||||
@ -6020,7 +6033,7 @@ write_man(const char *man_name, /* I - Name of manpage */
|
||||
|
||||
puts(".fi");
|
||||
|
||||
write_description(stdout, description, NULL, 0);
|
||||
write_description(stdout, OUTPUT_MAN, description, NULL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6041,7 +6054,7 @@ write_man(const char *man_name, /* I - Name of manpage */
|
||||
NULL, MXML_DESCEND_FIRST);
|
||||
printf(".SS %s\n", name);
|
||||
|
||||
write_description(stdout, description, NULL, 1);
|
||||
write_description(stdout, OUTPUT_MAN, description, NULL, 1);
|
||||
|
||||
printf(".PP\n"
|
||||
".nf\n"
|
||||
@ -6062,7 +6075,7 @@ write_man(const char *man_name, /* I - Name of manpage */
|
||||
puts("};\n"
|
||||
".fi");
|
||||
|
||||
write_description(stdout, description, NULL, 0);
|
||||
write_description(stdout, OUTPUT_MAN, description, NULL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6083,7 +6096,7 @@ write_man(const char *man_name, /* I - Name of manpage */
|
||||
NULL, MXML_DESCEND_FIRST);
|
||||
printf(".SS %s\n", name);
|
||||
|
||||
write_description(stdout, description, NULL, 1);
|
||||
write_description(stdout, OUTPUT_MAN, description, NULL, 1);
|
||||
|
||||
puts(".PP\n"
|
||||
".nf");
|
||||
@ -6097,7 +6110,7 @@ write_man(const char *man_name, /* I - Name of manpage */
|
||||
puts(";\n"
|
||||
".fi");
|
||||
|
||||
write_description(stdout, description, NULL, 0);
|
||||
write_description(stdout, OUTPUT_MAN, description, NULL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6166,7 +6179,7 @@ write_scu(FILE *out, /* I - Output file */
|
||||
fprintf(out, "<h3 class=\"%s\">%s<a id=\"%s\">%s</a></h3>\n", scut->value.element.name, get_comment_info(description), cname, cname);
|
||||
|
||||
if (description)
|
||||
write_description(out, description, "p", 1);
|
||||
write_description(out, mode, description, "p", 1);
|
||||
|
||||
fprintf(out, "<p class=\"code\">%s %s", scut->value.element.name, cname);
|
||||
if ((parent = mxmlElementGetAttr(scut, "parent")) != NULL)
|
||||
@ -6280,8 +6293,8 @@ write_scu(FILE *out, /* I - Output file */
|
||||
fprintf(out, "<dt>%s %s</dt>\n",
|
||||
mxmlElementGetAttr(arg, "name"), get_comment_info(description));
|
||||
|
||||
write_description(out, description, "dd", 1);
|
||||
write_description(out, description, "dd", 0);
|
||||
write_description(out, mode, description, "dd", 1);
|
||||
write_description(out, mode, description, "dd", 0);
|
||||
}
|
||||
|
||||
fputs("</dl>\n", out);
|
||||
@ -6306,6 +6319,9 @@ write_string(FILE *out, /* I - Output file */
|
||||
const char *s, /* I - String to write */
|
||||
int mode) /* I - Output mode */
|
||||
{
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case OUTPUT_DOCSET :
|
||||
@ -6413,7 +6429,7 @@ write_tokens(FILE *out, /* I - Output file */
|
||||
" <Anchor>%s</Anchor>\n"
|
||||
" <TokenIdentifier>//apple_ref/cpp/cl/%s</TokenIdentifier>\n"
|
||||
" <Abstract>", path, cename, cename);
|
||||
write_description(out, description, "", 1);
|
||||
write_description(out, OUTPUT_TOKENS, description, "", 1);
|
||||
fputs(" </Abstract>\n"
|
||||
" </Token>\n", out);
|
||||
|
||||
@ -6467,7 +6483,7 @@ write_tokens(FILE *out, /* I - Output file */
|
||||
|
||||
fputs(")</TokenIdentifier>\n"
|
||||
" <Abstract>", out);
|
||||
write_description(out, description, "", 1);
|
||||
write_description(out, OUTPUT_TOKENS, description, "", 1);
|
||||
fputs(" </Abstract>\n"
|
||||
" <Declaration>", out);
|
||||
|
||||
@ -6536,7 +6552,7 @@ write_tokens(FILE *out, /* I - Output file */
|
||||
" <Anchor>%s</Anchor>\n"
|
||||
" <TokenIdentifier>//apple_ref/c/func/%s</TokenIdentifier>\n"
|
||||
" <Abstract>", path, name, name);
|
||||
write_description(out, description, "", 1);
|
||||
write_description(out, OUTPUT_TOKENS, description, "", 1);
|
||||
fputs(" </Abstract>\n"
|
||||
" <Declaration>", out);
|
||||
|
||||
@ -6602,7 +6618,7 @@ write_tokens(FILE *out, /* I - Output file */
|
||||
" <Anchor>%s</Anchor>\n"
|
||||
" <TokenIdentifier>//apple_ref/c/tdef/%s</TokenIdentifier>\n"
|
||||
" <Abstract>", path, name, name);
|
||||
write_description(out, description, "", 1);
|
||||
write_description(out, OUTPUT_TOKENS, description, "", 1);
|
||||
fputs(" </Abstract>\n"
|
||||
" </Token>\n", out);
|
||||
|
||||
@ -6627,7 +6643,7 @@ write_tokens(FILE *out, /* I - Output file */
|
||||
" <Anchor>%s</Anchor>\n"
|
||||
" <TokenIdentifier>//apple_ref/c/tag/%s</TokenIdentifier>\n"
|
||||
" <Abstract>", path, name, name);
|
||||
write_description(out, description, "", 1);
|
||||
write_description(out, OUTPUT_TOKENS, description, "", 1);
|
||||
fputs(" </Abstract>\n"
|
||||
" </Token>\n", out);
|
||||
|
||||
@ -6652,7 +6668,7 @@ write_tokens(FILE *out, /* I - Output file */
|
||||
" <Anchor>%s</Anchor>\n"
|
||||
" <TokenIdentifier>//apple_ref/c/tag/%s</TokenIdentifier>\n"
|
||||
" <Abstract>", path, name, name);
|
||||
write_description(out, description, "", 1);
|
||||
write_description(out, OUTPUT_TOKENS, description, "", 1);
|
||||
fputs(" </Abstract>\n"
|
||||
" </Token>\n", out);
|
||||
|
||||
@ -6677,7 +6693,7 @@ write_tokens(FILE *out, /* I - Output file */
|
||||
" <Anchor>%s</Anchor>\n"
|
||||
" <TokenIdentifier>//apple_ref/c/data/%s</TokenIdentifier>\n"
|
||||
" <Abstract>", path, name, name);
|
||||
write_description(out, description, "", 1);
|
||||
write_description(out, OUTPUT_TOKENS, description, "", 1);
|
||||
fputs(" </Abstract>\n"
|
||||
" </Token>\n", out);
|
||||
|
||||
@ -6702,7 +6718,7 @@ write_tokens(FILE *out, /* I - Output file */
|
||||
" <Anchor>%s</Anchor>\n"
|
||||
" <TokenIdentifier>//apple_ref/c/tag/%s</TokenIdentifier>\n"
|
||||
" <Abstract>", path, cename, cename);
|
||||
write_description(out, description, "", 1);
|
||||
write_description(out, OUTPUT_TOKENS, description, "", 1);
|
||||
fputs(" </Abstract>\n"
|
||||
" </Token>\n", out);
|
||||
|
||||
@ -6720,7 +6736,7 @@ write_tokens(FILE *out, /* I - Output file */
|
||||
" <Anchor>%s</Anchor>\n"
|
||||
" <TokenIdentifier>//apple_ref/c/econst/%s</TokenIdentifier>\n"
|
||||
" <Abstract>", path, cename, name);
|
||||
write_description(out, description, "", 1);
|
||||
write_description(out, OUTPUT_TOKENS, description, "", 1);
|
||||
fputs(" </Abstract>\n"
|
||||
" </Token>\n", out);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user