diff --git a/CHANGES b/CHANGES index 2ef63fa..34cbcd7 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -CHANGES - 11/30/2005 +CHANGES - 12/02/2005 -------------------- CHANGES IN Mini-XML 2.3 @@ -11,8 +11,8 @@ CHANGES IN Mini-XML 2.3 "@private@", and "@since version@" comments. - Fixed function and enumeraion type bugs in mxmldoc. - Fixed XML schema for mxmldoc. - - The mxmldoc program now supports --title and --intro - options. + - The mxmldoc program now supports --intro, --section, + and --title options. - The mxmlLoad*() functions could leak a node on an error (STR #27) - The mxml_vsnprintf() function could get in an infinite diff --git a/doc/intro.html b/doc/intro.html index 7d6a8c1..76359a2 100644 --- a/doc/intro.html +++ b/doc/intro.html @@ -1,6 +1,6 @@
-This programmers manual describes Mini-XML version 2.2.3, a +
This programmers manual describes Mini-XML version 2.3, a small XML parsing library that you can use to read and write XML and XML-like data files in your application without requiring large non-standard libraries. Mini-XML only requires an ANSI C diff --git a/doc/mxml.html b/doc/mxml.html index c8030f9..0fb9778 100644 --- a/doc/mxml.html +++ b/doc/mxml.html @@ -1,7 +1,7 @@
-This programmers manual describes Mini-XML version 2.2.3, a small XML +
This programmers manual describes Mini-XML version 2.3, a small XML parsing library that you can use to read and write XML and XML-like data files in your application without requiring large non-standard libraries. Mini-XML only requires an ANSI C compatible compiler (GCC @@ -1053,364 +1044,63 @@ mxmlIndexEnum.
mxmlIndexDelete(ind);This chapter describes how to use the mxmldoc(1) utility - that comes with Mini-XML to automatically generate documentation for - your programs.
-The mxmldoc utility scans C and C++ source and header files - and produces an XML file describing the library interface and an XHTML - file providing a human-readable reference to the code. Each source and - header file must conform to some simple code commenting conventions so - that mxmldoc can extract the necessary descriptive text.
-The mxmldoc command requires the name of an XML file to - store the code information; this file is created and updated as - necessary. The XML file is optionally followed by a list of source - files to scan. After scanning any source files on the command-line, -mxmldoc writes XHTML documentation to the standard output, which - can be redirected to the file using the >filename syntax:
-- mxmldoc myfile.xml >myfile.html ENTER - mxmldoc myfile.xml file1.c file2.cxx file3.h >myfile.html ENTER --
If no source files are provided on the command-line, the current - contents of the XML file are converted to XHTML.
-As noted previously, source code must be commented properly for -mxmldoc to generate correct documentation for the code. Single line - comments can use the C++ // comment sequence, however all - multi-line comments must use the C /* ... */ comment sequence.
-All implementations of functions and methods must begin with a - comment header describing what the function does, the possible input - limits (if any), and the possible output values (if any), and any - special information needed, as follows:
-- /* - * 'do_this()' - Compute y = this(x). - * - * Notes: none. - */ - float /* O - Inverse power value, 0.0 <= y <= 1.1 */ - do_this(float x) /* I - Power value (0.0 <= x <= 1.1) */ - { - ... - return (y); - } --
Return/output values are indicated using an "O" prefix, input values - are indicated using the "I" prefix, and values that are both input and - output use the "IO" prefix for the corresponding in-line comment.
-Each variable or member must be declared on a separate line and must - be immediately followed by a comment describing the variable or member, - as follows:
-- int this_variable; /* The current state of this */ - int that_variable; /* The current state of that */ --
Each type must have a comment block immediately before the typedef, - as follows:
-- /* - * This type is for foobar options. - */ - typedef int this_type_t; -- - -
Each class, structure, and union must have a comment block - immediately before the definition, and each member must be documented - in accordance with the function and variable documentation - requirements, as follows:
-- /* - * This structure is for foobar options. - */ - struct this_struct_s - { - int this_member; /* Current state for this */ - int that_member; /* Current state for that */ - }; - - /* - * This class is for barfoo options. - */ - class this_class_c - { - int this_member; /* Current state for this */ - int that_member; /* Current state for that */ - - /* - * 'get_this()' - Get the current state for this. - */ - int /* O - Current state for this */ - get_this() - { - return (this_member); - } - }; --
Each enumeration must have a comment block immediately before the - definition describing what the enumeration is for, and each enumeration - value must have a comment immediately after the value, as follows:
-- /* - * Enumeration of media trays. - */ - enum this_enum_e - { - THIS_TRAY, /* This tray */ - THAT_TRAY /* That tray */ - }; -+ -
Listing 4-1 shows the XML schema file mxmldoc.xsd which is - included with Mini-XML. This schema file can be used to convert the XML - files produced by mxmldoc into other formats.
-
--<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <xsd:annotation> - <xsd:documentation xml:lang="en"> - Mini-XML 2.2 documentation schema for mxmldoc output. - Copyright 2003-2005 by Michael Sweet. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - </xsd:documentation> - </xsd:annotation> - - <!-- basic element definitions --> - <xsd:element name="argument" type="argumentType"/> - <xsd:element name="class" type="classType"/> - <xsd:element name="constant" type="constantType"/> - <xsd:element name="description" type="xsd:string"/> - <xsd:element name="enumeration" type="enumerationType"/> - <xsd:element name="function" type="functionType"/> - <xsd:element name="mxmldoc" type="mxmldocType"/> - <xsd:element name="namespace" type="namespaceType"/> - <xsd:element name="returnvalue" type="returnvalueType"/> - <xsd:element name="seealso" type="identifierList"/> - <xsd:element name="struct" type="structType"/> - <xsd:element name="typedef" type="typedefType"/> - <xsd:element name="type" type="xsd:string"/> - <xsd:element name="union" type="unionType"/> - <xsd:element name="variable" type="variableType"/> - - <!-- descriptions of complex elements --> - <xsd:complexType name="argumentType"> - <xsd:sequence> - <xsd:element ref="type" minOccurs="1" maxOccurs="1"/> - <xsd:element ref="description" minOccurs="0" maxOccurs="1"/> - </xsd:sequence> - <xsd:attribute name="default" type="xsd:string" use="optional"/> - <xsd:attribute name="name" type="identifier" use="required"/> - <xsd:attribute name="direction" type="direction" use="optional" default="I"/> - </xsd:complexType> - - <xsd:complexType name="classType"> - <xsd:sequence> - <xsd:element ref="description" minOccurs="0" maxOccurs="1"/> - <xsd:choice minOccurs="0" maxOccurs="unbounded"> - <xsd:element ref="class"/> -- |
-- <xsd:element ref="enumeration"/> - <xsd:element ref="function"/> - <xsd:element ref="struct"/> - <xsd:element ref="typedef"/> - <xsd:element ref="union"/> - <xsd:element ref="variable"/> - </xsd:choice> - </xsd:sequence> - <xsd:attribute name="name" type="identifier" use="required"/> - <xsd:attribute name="parent" type="xsd:string" use="optional"/> - </xsd:complexType> - - <xsd:complexType name="constantType"> - <xsd:sequence> - <xsd:element ref="description" minOccurs="0" maxOccurs="1"/> - </xsd:sequence> - <xsd:attribute name="name" type="identifier" use="required"/> - </xsd:complexType> - - <xsd:complexType name="enumerationType"> - <xsd:sequence> - <xsd:element ref="description" minOccurs="0" maxOccurs="1"/> - <xsd:element ref="constant" minOccurs="1" maxOccurs="unbounded"/> - </xsd:sequence> - <xsd:attribute name="name" type="identifier" use="required"/> - </xsd:complexType> - - <xsd:complexType name="functionType"> - <xsd:sequence> - <xsd:element ref="returnvalue" minOccurs="0" maxOccurs="1"/> - <xsd:element ref="description" minOccurs="0" maxOccurs="1"/> - <xsd:element ref="argument" minOccurs="1" maxOccurs="unbounded"/> - <xsd:element ref="seealso" minOccurs="0" maxOccurs="1"/> - </xsd:sequence> - <xsd:attribute name="name" type="identifier" use="required"/> - <xsd:attribute name="scope" type="scope" use="optional"/> - </xsd:complexType> - - <xsd:complexType name="mxmldocType"> - <xsd:choice minOccurs="0" maxOccurs="unbounded"> - <xsd:element ref="class"/> - <xsd:element ref="enumeration"/> - <xsd:element ref="function"/> - <xsd:element ref="namespace"/> - <xsd:element ref="struct"/> - <xsd:element ref="typedef"/> - <xsd:element ref="union"/> - <xsd:element ref="variable"/> - </xsd:choice> - </xsd:complexType> - - <xsd:complexType name="namespaceType"> - <xsd:sequence> - <xsd:element ref="description" minOccurs="0" maxOccurs="1"/> - <xsd:choice minOccurs="0" maxOccurs="unbounded"> - <xsd:element ref="class"/> - <xsd:element ref="enumeration"/> - <xsd:element ref="function"/> -- |
-- <xsd:element ref="struct"/> - <xsd:element ref="typedef"/> - <xsd:element ref="union"/> - <xsd:element ref="variable"/> - </xsd:choice> - </xsd:sequence> - <xsd:attribute name="name" type="identifier" use="required"/> - </xsd:complexType> - - <xsd:complexType name="returnvalueType"> - <xsd:sequence> - <xsd:element ref="type" minOccurs="1" maxOccurs="1"/> - <xsd:element ref="description" minOccurs="0" maxOccurs="1"/> - </xsd:sequence> - </xsd:complexType> - - <xsd:complexType name="structType"> - <xsd:sequence> - <xsd:element ref="description" minOccurs="0" maxOccurs="1"/> - <xsd:choice minOccurs="0" maxOccurs="unbounded"> - <xsd:element ref="variable"/> - <xsd:element ref="function"/> - </xsd:choice> - </xsd:sequence> - <xsd:attribute name="name" type="identifier" use="required"/> - </xsd:complexType> - - <xsd:complexType name="typedefType"> - <xsd:sequence> - <xsd:element ref="type" minOccurs="1" maxOccurs="1"/> - <xsd:element ref="description" minOccurs="0" maxOccurs="1"/> - </xsd:sequence> - <xsd:attribute name="name" type="identifier" use="required"/> - </xsd:complexType> - - <xsd:complexType name="unionType"> - <xsd:sequence> - <xsd:element ref="description" minOccurs="0" maxOccurs="1"/> - <xsd:element ref="variable" minOccurs="0" maxOccurs="unbounded"/> - </xsd:sequence> - <xsd:attribute name="name" type="identifier" use="required"/> - </xsd:complexType> - - <xsd:complexType name="variableType"> - <xsd:sequence> - <xsd:element ref="type" minOccurs="1" maxOccurs="1"/> - <xsd:element ref="description" minOccurs="0" maxOccurs="1"/> - </xsd:sequence> - <xsd:attribute name="name" type="identifier" use="required"/> - </xsd:complexType> - - <!-- data types --> - <xsd:simpleType name="direction"> - <xsd:restriction base="xsd:string"> - <xsd:enumeration value="I"/> - <xsd:enumeration value="O"/> - <xsd:enumeration value="IO"/> - </xsd:restriction> -- |
-- </xsd:simpleType> - - <xsd:simpleType name="identifier"> - <xsd:restriction base="xsd:string"> - <xsd:pattern value="[a-zA-Z_(.]([a-zA-Z_(.,)* 0-9])*"/> - </xsd:restriction> - </xsd:simpleType> - - <xsd:simpleType name="identifierList"> - <xsd:list itemType="identifier"/> - </xsd:simpleType> - - <xsd:simpleType name="scope"> - <xsd:restriction base="xsd:string"> - <xsd:enumeration value=""/> - <xsd:enumeration value="private"/> - <xsd:enumeration value="protected"/> - <xsd:enumeration value="public"/> - </xsd:restriction> - </xsd:simpleType> -</xsd:schema> -- |
In general, any C or C++ source code is handled by mxmldoc, + however it was specifically written to handle code with documentation + that is formatted according to the CUPS Configuration Management Plan + which is available at "http://www.cups.org/documentation.php".
+October 18, 2005
+The Mini-XML library and included programs are provided under the + terms of the GNU Library General Public License (LGPL) with the + following exceptions:
+If you link the application to a modified version of Mini-XML, + then the changes to Mini-XML must be provided under the terms of the + LGPL in sections 1, 2, and 4.
+GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1991 Free Software Foundation, Inc.
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
@@ -1784,7 +1474,7 @@ mxmldoc to generate correct documentation for the code. Single line
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
-If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting @@ -1829,9 +1519,18 @@ Ty Coon, President of Vice
That's all there is to it!
The XML node type.
Name | Description |
---|
Name | Description |
---|---|
MXML_CUSTOM | Custom data |
MXML_CUSTOM + + Mini-XML 2.1 | Custom data |
MXML_ELEMENT | XML element with attributes |
MXML_IGNORE | Ignore/throw away node |
MXML_IGNORE + + Mini-XML 2.3 | Ignore/throw away node |
MXML_INTEGER | Integer value |
MXML_OPAQUE | Opaque string |
MXML_REAL | Real value |
MXML_TEXT | Text fragment |
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 @@ -2127,10 +1835,10 @@ mxmlAdd( mxml_node_t * node);
Name | Description |
---|---|
Name | Description |
parent | Parent node |
where | Where to add, MXML_ADD_BEFORE or @@ -2139,12 +1847,12 @@ mxmlAdd( MXML_ADD_TO_PARENT |
node | Node to add |
Nothing.
-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 @@ -2156,19 +1864,19 @@ mxmlDelete( mxml_node_t * node);
Name | Description |
---|---|
Name | Description |
node | Node to delete |
Nothing.
-Get an attribute. This function returns NULL if the node is not an element or the named attribute does not exist.
@@ -2180,20 +1888,20 @@ mxmlElementGetAttr( const char * name);Name | Description |
---|---|
Name | Description |
node | Element node |
name | Name of attribute |
Attribute value or NULL
-Set an attribute. If the named attribute already exists, the value of the attribute is replaced by the new string value. The string value is @@ -2208,44 +1916,36 @@ mxmlElementSetAttr( const char * value);
Name | Description |
---|---|
Name | Description |
node | Element node |
name | Name of attribute |
value | Attribute value |
Nothing.
-Add a callback to convert entities to Unicode.
int -mxmlEntityAddCallback( - int (*cb)(const char *name)); +mxmlEntityAddCallback(void);
Name | Description |
---|---|
(*cb)(const char *name) | Callback function to - add |
None.
0 on success, -1 on failure
-Get the name that corresponds to the character value. If val does not need to be represented by a named entity, NULL is returned.
@@ -2256,19 +1956,19 @@ mxmlEntityGetName( int val);Name | Description |
---|---|
Name | Description |
val | Character value |
Entity name or NULL
-Get the character corresponding to a named entity. The entity name can also be a numeric constant. -1 is returned if the name is not @@ -2280,42 +1980,34 @@ mxmlEntityGetValue( const char * name);
Name | Description |
---|---|
Name | Description |
name | Entity name |
Character value or -1 on error
-Remove a callback.
void -mxmlEntityRemoveCallback( - int (*cb)(const char *name)); +mxmlEntityRemoveCallback(void);
Name | Description |
---|---|
(*cb)(const char *name) | Callback function to - remove |
None.
Nothing.
-Find the named element. The search is constrained by the name, attribute name, and value; any NULL names or values are treated as @@ -2338,10 +2030,10 @@ mxmlFindElement( int descend);
Name | Description |
---|---|
Name | Description |
node | Current node |
top | Top node |
descend | Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST |
Element node or NULL
-Delete an index.
Name | Description |
---|---|
Name | Description |
ind | Index to delete |
Nothing.
-Return the next node in the index. Nodes are returned in the sorted order of the index.
@@ -2389,19 +2081,19 @@ mxmlIndexEnum( mxml_index_t * ind);Name | Description |
---|---|
Name | Description |
ind | Index to enumerate |
Next node or NULL if there is none
-Find the next matching node. You should call mxmlIndexReset() prior to using this function for the first time with a particular set of @@ -2416,21 +2108,21 @@ mxmlIndexFind( const char * value);
Name | Description |
---|---|
Name | Description |
ind | Index to search |
element | Element name to find, if any |
value | Attribute value, if any |
Node or NULL if none found
-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, @@ -2446,21 +2138,21 @@ mxmlIndexNew( const char * attr);
Name | Description |
---|---|
Name | Description |
node | XML node tree |
element | Element to index or NULL for all |
attr | Attribute to index or NULL for none |
New index
-Reset the enumeration/find pointer in the index and return the first node in the index. This function should be called prior to using @@ -2472,19 +2164,19 @@ mxmlIndexReset( mxml_index_t * ind);
Name | Description |
---|---|
Name | Description |
ind | Index to reset |
First node or NULL if there is none
-Load a file descriptor into an XML node tree. The nodes in the specified file are added to the specified top node. If no top node is @@ -2500,26 +2192,23 @@ mxmlIndexReset( mxml_node_t * mxmlLoadFd( mxml_node_t * top, - int fd, - mxml_type_t (*cb)(mxml_node_t *node)); + int fd);
Name | Description |
---|---|
Name | Description |
top | Top node |
fd | File descriptor to read from |
(*cb)(mxml_node_t *node) | Callback function or - MXML_NO_CALLBACK |
First node or NULL if the file could not be read.
-Load a file into an XML node tree. The nodes in the specified file are added to the specified top node. If no top node is provided, the @@ -2535,26 +2224,23 @@ mxmlLoadFd( mxml_node_t * mxmlLoadFile( mxml_node_t * top, - FILE * fp, - mxml_type_t (*cb)(mxml_node_t *node)); + FILE * fp);
Name | Description |
---|---|
Name | Description |
top | Top node |
fp | File to read from |
(*cb)(mxml_node_t *node) | Callback function or - MXML_NO_CALLBACK |
First node or NULL if the file could not be read.
-Load a string into an XML node tree. The nodes in the specified string are added to the specified top node. If no top node is provided, @@ -2570,26 +2256,25 @@ mxmlLoadFile( mxml_node_t * mxmlLoadString( mxml_node_t * top, - const char * s, - mxml_type_t (*cb)(mxml_node_t *node)); + const char * s);
Name | Description |
---|---|
Name | Description |
top | Top node |
s | String to load |
(*cb)(mxml_node_t *node) | Callback function or - MXML_NO_CALLBACK |
First node or NULL if the string has errors.
-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 @@ -2604,20 +2289,22 @@ mxmlNewCDATA( const char * data);
Name | Description |
---|---|
Name | Description |
parent | Parent node or MXML_NO_PARENT |
data | Data string |
New node
-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 @@ -2629,26 +2316,23 @@ mxmlNewCDATA( mxml_node_t * mxmlNewCustom( mxml_node_t * parent, - void * data, - void (*destroy)(void *)); + void * data);
Name | Description |
---|---|
Name | Description |
parent | Parent node or MXML_NO_PARENT |
data | Pointer to data |
(*destroy)(void *) | Function to destroy data | -
New node
-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 @@ -2661,20 +2345,20 @@ mxmlNewElement( const char * name);
Name | Description |
---|---|
Name | Description |
parent | Parent node or MXML_NO_PARENT |
name | Name of element |
New node
-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 @@ -2687,20 +2371,20 @@ mxmlNewInteger( int integer);
Name | Description |
---|---|
Name | Description |
parent | Parent node or MXML_NO_PARENT |
integer | Integer value |
New node
-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 @@ -2714,20 +2398,20 @@ mxmlNewOpaque( const char * opaque);
Name | Description |
---|---|
Name | Description |
parent | Parent node or MXML_NO_PARENT |
opaque | Opaque string |
New node
-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 @@ -2741,20 +2425,20 @@ mxmlNewReal( double real);
Name | Description |
---|---|
Name | Description |
parent | Parent node or MXML_NO_PARENT |
real | Real number value |
New node
-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 @@ -2771,22 +2455,22 @@ mxmlNewText( const char * string);
Name | Description |
---|---|
Name | Description |
parent | Parent node or MXML_NO_PARENT |
whitespace | 1 = leading whitespace, 0 = no whitespace |
string | String |
New node
-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 @@ -2804,10 +2488,10 @@ mxmlNewTextf( ...);
Name | Description |
---|---|
Name | Description |
parent | Parent node or MXML_NO_PARENT |
whitespace | 1 = leading whitespace, 0 = no @@ -2815,12 +2499,12 @@ mxmlNewTextf( |
format | Printf-style frmat string |
... | Additional args as needed |
New node
-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 @@ -2832,19 +2516,20 @@ mxmlRemove( mxml_node_t * node);
Name | Description |
---|---|
Name | Description |
node | Node to remove |
Nothing.
-Save an XML node tree to an allocated string. This function returns a pointer to a string containing the textual representation of the XML @@ -2859,25 +2544,22 @@ mxmlRemove(
char * mxmlSaveAllocString( - mxml_node_t * node, - const char * (*cb)(mxml_node_t *node, int ws)); + mxml_node_t * node);
Name | Description |
---|---|
Name | Description |
node | Node to write |
(*cb)(mxml_node_t *node, int ws) | Whitespace - callback or MXML_NO_CALLBACK |
Allocated string or NULL
-Save an XML tree to a file descriptor. The callback argument specifies a function that returns a whitespace string or NULL before @@ -2889,26 +2571,23 @@ mxmlSaveAllocString( int mxmlSaveFd( mxml_node_t * node, - int fd, - const char * (*cb)(mxml_node_t *node, int ws)); + int fd);
Name | Description |
---|---|
Name | Description |
node | Node to write |
fd | File descriptor to write to |
(*cb)(mxml_node_t *node, int ws) | Whitespace - callback or MXML_NO_CALLBACK |
0 on success, -1 on error.
-Save an XML tree to a file. The callback argument specifies a function that returns a whitespace string or NULL before and after each @@ -2920,26 +2599,23 @@ mxmlSaveFd( int mxmlSaveFile( mxml_node_t * node, - FILE * fp, - const char * (*cb)(mxml_node_t *node, int ws)); + FILE * fp);
Name | Description |
---|---|
Name | Description |
node | Node to write |
fp | File to write to |
(*cb)(mxml_node_t *node, int ws) | Whitespace - callback or MXML_NO_CALLBACK |
0 on success, -1 on error.
-Save an XML node tree to a string. This function returns the total number of bytes that would be required for the string but only copies @@ -2954,27 +2630,26 @@ int mxmlSaveString( mxml_node_t * node, char * buffer, - int bufsize, - const char * (*cb)(mxml_node_t *node, int ws)); + int bufsize);
Name | Description |
---|---|
Name | Description |
node | Node to write |
buffer | String buffer |
bufsize | Size of string buffer |
(*cb)(mxml_node_t *node, int ws) | Whitespace - callback or MXML_NO_CALLBACK |
Size of string
-Set the element name of a CDATA node. The node is not changed if it is not a CDATA element node.
@@ -2986,20 +2661,22 @@ mxmlSetCDATA( const char * data);Name | Description |
---|---|
Name | Description |
node | Node to set |
data | New data string |
0 on success, -1 on failure
-Set the data and destructor of a custom data node. The node is not changed if it is not a custom node.
@@ -3008,25 +2685,24 @@ mxmlSetCDATA( int mxmlSetCustom( mxml_node_t * node, - void * data, - void (*destroy)(void *)); + void * data);Name | Description |
---|---|
Name | Description |
node | Node to set |
data | New data pointer |
(*destroy)(void *) | New destructor function |
0 on success, -1 on failure
-Set the handling functions for custom data. The load function accepts a node pointer and a data string and must return 0 on success and @@ -3036,24 +2712,24 @@ mxmlSetCustom(
void mxmlSetCustomHandlers( - mxml_custom_load_cb_t load, - mxml_custom_save_cb_t save); + mxml_custom_load_cb_t load, + mxml_custom_save_cb_t save);
Name | Description |
---|---|
Name | Description |
load | Load function |
save | Save function |
Nothing.
-Set the name of an element node. The node is not changed if it is not an element node.
@@ -3065,43 +2741,35 @@ mxmlSetElement( const char * name);Name | Description |
---|---|
Name | Description |
node | Node to set |
name | New name string |
0 on success, -1 on failure
-Set the error message callback.
void -mxmlSetErrorCallback( - void (*cb)(const char *)); +mxmlSetErrorCallback(void);
Name | Description |
---|---|
(*cb)(const char *) | Error callback function | -
None.
Nothing.
-Set the value of an integer node. The node is not changed if it is not an integer node.
@@ -3113,20 +2781,20 @@ mxmlSetInteger( int integer);Name | Description |
---|---|
Name | Description |
node | Node to set |
integer | Integer value |
0 on success, -1 on failure
-Set the value of an opaque node. The node is not changed if it is not an opaque node.
@@ -3138,20 +2806,20 @@ mxmlSetOpaque( const char * opaque);Name | Description |
---|---|
Name | Description |
node | Node to set |
opaque | Opaque string |
0 on success, -1 on failure
-Set the value of a real number node. The node is not changed if it is not a real number node.
@@ -3163,20 +2831,20 @@ mxmlSetReal( double real);Name | Description |
---|---|
Name | Description |
node | Node to set |
real | Real number value |
0 on success, -1 on failure
-Set the value of a text node. The node is not changed if it is not a text node.
@@ -3189,22 +2857,22 @@ mxmlSetText( const char * string);Name | Description |
---|---|
Name | Description |
node | Node to set |
whitespace | 1 = leading whitespace, 0 = no whitespace |
string | String |
0 on success, -1 on failure
-Set the value of a text node to a formatted string. The node is not changed if it is not a text node.
@@ -3218,10 +2886,10 @@ mxmlSetTextf( ...);Name | Description |
---|---|
Name | Description |
node | Node to set |
whitespace | 1 = leading whitespace, 0 = no @@ -3229,12 +2897,12 @@ mxmlSetTextf( |
format | Printf-style format string |
... | Additional arguments as needed |
0 on success, -1 on failure
-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 @@ -3248,22 +2916,22 @@ mxmlWalkNext( int descend);
Name | Description |
---|---|
Name | Description |
node | Current node |
top | Top node |
descend | Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST |
Next node or NULL
-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 @@ -3278,35 +2946,37 @@ mxmlWalkPrev( int descend);
Name | Description |
---|---|
Name | Description |
node | Current node |
top | Top node |
descend | Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST |
Previous node or NULL
-An XML element attribute value.
+Data types...
struct mxml_attr_s @@ -3316,18 +2986,18 @@ struct mxml_attr_s };
Name | Description |
---|
Name | Description |
---|---|
name | Attribute name |
value | Attribute value |
An XML custom value.
Name | Description |
---|
Name | Description |
---|---|
data | Pointer to (allocated) custom data |
An XML element value.
++struct mxml_element_s +{ + mxml_attr_t * attrs; + char * name; + int num_attrs; +}; ++
Name | Description |
---|---|
attrs | Attributes |
name | Name of element |
num_attrs | Number of attributes |
An XML node index.
Name | Description |
---|
Name | Description |
---|---|
alloc_nodes | Allocated nodes in index |
attr | Attribute used for indexing or NULL |
nodes | Node array |
num_nodes | Number of nodes in index |
An XML node.
Name | Description |
---|
Name | Description |
---|---|
child | First child node |
last_child | Last child node |
type | Node type |
value | Node value |
An XML text value.
Name | Description |
---|
Name | Description |
---|---|
string | Fragment string |
whitespace | Leading whitespace? |
An XML element value.
--struct mxml_value_s -{ - mxml_attr_t * attrs; - char * name; - int num_attrs; -}; --
Name | Description |
---|---|
attrs | Attributes |
name | Name of element |
num_attrs | Number of attributes |
An XML element attribute value.
+Data types...
typedef struct mxml_attr_s mxml_attr_t;-
Custom data load callback function
++typedef int (*mxml_custom_load_cb_t)(mxml_node_t *, const char *); ++ + +
Custom data save callback function
++typedef char * (*mxml_custom_save_cb_t)(mxml_node_t *); ++ + +
An XML custom value.
An XML element value.
-typedef struct mxml_value_s mxml_element_t; +typedef struct mxml_element_s mxml_element_t;-
An XML node index.
An XML node.
An XML text value.
An XML node value.
An XML node value.
Name | Description |
---|
Name | Description |
---|---|
custom | Custom data |
custom + + Mini-XML 2.1 | Custom data |
element | Element |
integer | Integer number |
opaque | Opaque string |
real | Real number |
text | Text fragment |
This chapter describes how to use the mxmldoc(1) -utility that comes with Mini-XML to automatically generate -documentation for your programs.
- -The mxmldoc utility scans C and C++ source and -header files and produces an XML file describing the library -interface and an XHTML file providing a human-readable reference -to the code. Each source and header file must conform to some -simple code commenting conventions so that mxmldoc can -extract the necessary descriptive text.
- -The mxmldoc command requires the name of an XML file -to store the code information; this file is created and updated -as necessary. The XML file is optionally followed by a list of -source files to scan. After scanning any source files on the -command-line, mxmldoc writes XHTML documentation to the -standard output, which can be redirected to the file using the ->filename syntax:
- -- mxmldoc myfile.xml >myfile.html ENTER - mxmldoc myfile.xml file1.c file2.cxx file3.h >myfile.html ENTER -- -
If no source files are provided on the command-line, the -current contents of the XML file are converted to XHTML.
- -As noted previously, source code must be commented properly -for mxmldoc to generate correct documentation for the -code. Single line comments can use the C++ // comment -sequence, however all multi-line comments must use the C /* -... */ comment sequence.
- -All implementations of functions and methods must begin with -a comment header describing what the function does, the possible -input limits (if any), and the possible output values (if any), -and any special information needed, as follows:
- -- /* - * 'do_this()' - Compute y = this(x). - * - * Notes: none. - */ - - float /* O - Inverse power value, 0.0 <= y <= 1.1 */ - do_this(float x) /* I - Power value (0.0 <= x <= 1.1) */ - { - ... - return (y); - } -- -
Return/output values are indicated using an "O" prefix, input -values are indicated using the "I" prefix, and values that are -both input and output use the "IO" prefix for the corresponding -in-line comment.
- -Each variable or member must be declared on a separate line -and must be immediately followed by a comment describing the -variable or member, as follows:
- -- int this_variable; /* The current state of this */ - int that_variable; /* The current state of that */ -- -
Each type must have a comment block immediately before the -typedef, as follows:
- -- /* - * This type is for foobar options. - */ - typedef int this_type_t; -- - -
Each class, structure, and union must have a comment block -immediately before the definition, and each member must be documented -in accordance with the function and variable documentation -requirements, as follows:
- -- /* - * This structure is for foobar options. - */ - struct this_struct_s - { - int this_member; /* Current state for this */ - int that_member; /* Current state for that */ - }; - - /* - * This class is for barfoo options. - */ - class this_class_c - { - int this_member; /* Current state for this */ - int that_member; /* Current state for that */ - - /* - * 'get_this()' - Get the current state for this. - */ - int /* O - Current state for this */ - get_this() - { - return (this_member); - } - }; -- -
Each enumeration must have a comment block immediately before -the definition describing what the enumeration is for, and each -enumeration value must have a comment immediately after the -value, as follows:
- -- /* - * Enumeration of media trays. - */ - enum this_enum_e - { - THIS_TRAY, /* This tray */ - THAT_TRAY /* That tray */ - }; -- -
Listing 4-1 shows the XML schema file mxmldoc.xsd -which is included with Mini-XML. This schema file can be used to -convert the XML files produced by mxmldoc into other -formats.
- -
--<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <xsd:annotation> - <xsd:documentation xml:lang="en"> - Mini-XML 2.2 documentation schema for mxmldoc output. - Copyright 2003-2005 by Michael Sweet. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - </xsd:documentation> - </xsd:annotation> - - <!-- basic element definitions --> - <xsd:element name="argument" type="argumentType"/> - <xsd:element name="class" type="classType"/> - <xsd:element name="constant" type="constantType"/> - <xsd:element name="description" type="xsd:string"/> - <xsd:element name="enumeration" type="enumerationType"/> - <xsd:element name="function" type="functionType"/> - <xsd:element name="mxmldoc" type="mxmldocType"/> - <xsd:element name="namespace" type="namespaceType"/> - <xsd:element name="returnvalue" type="returnvalueType"/> - <xsd:element name="seealso" type="identifierList"/> - <xsd:element name="struct" type="structType"/> - <xsd:element name="typedef" type="typedefType"/> - <xsd:element name="type" type="xsd:string"/> - <xsd:element name="union" type="unionType"/> - <xsd:element name="variable" type="variableType"/> - - <!-- descriptions of complex elements --> - <xsd:complexType name="argumentType"> - <xsd:sequence> - <xsd:element ref="type" minOccurs="1" maxOccurs="1"/> - <xsd:element ref="description" minOccurs="0" maxOccurs="1"/> - </xsd:sequence> - <xsd:attribute name="default" type="xsd:string" use="optional"/> - <xsd:attribute name="name" type="identifier" use="required"/> - <xsd:attribute name="direction" type="direction" use="optional" default="I"/> - </xsd:complexType> - - <xsd:complexType name="classType"> - <xsd:sequence> - <xsd:element ref="description" minOccurs="0" maxOccurs="1"/> - <xsd:choice minOccurs="0" maxOccurs="unbounded"> - <xsd:element ref="class"/> -- |
-- <xsd:element ref="enumeration"/> - <xsd:element ref="function"/> - <xsd:element ref="struct"/> - <xsd:element ref="typedef"/> - <xsd:element ref="union"/> - <xsd:element ref="variable"/> - </xsd:choice> - </xsd:sequence> - <xsd:attribute name="name" type="identifier" use="required"/> - <xsd:attribute name="parent" type="xsd:string" use="optional"/> - </xsd:complexType> - - <xsd:complexType name="constantType"> - <xsd:sequence> - <xsd:element ref="description" minOccurs="0" maxOccurs="1"/> - </xsd:sequence> - <xsd:attribute name="name" type="identifier" use="required"/> - </xsd:complexType> - - <xsd:complexType name="enumerationType"> - <xsd:sequence> - <xsd:element ref="description" minOccurs="0" maxOccurs="1"/> - <xsd:element ref="constant" minOccurs="1" maxOccurs="unbounded"/> - </xsd:sequence> - <xsd:attribute name="name" type="identifier" use="required"/> - </xsd:complexType> - - <xsd:complexType name="functionType"> - <xsd:sequence> - <xsd:element ref="returnvalue" minOccurs="0" maxOccurs="1"/> - <xsd:element ref="description" minOccurs="0" maxOccurs="1"/> - <xsd:element ref="argument" minOccurs="1" maxOccurs="unbounded"/> - <xsd:element ref="seealso" minOccurs="0" maxOccurs="1"/> - </xsd:sequence> - <xsd:attribute name="name" type="identifier" use="required"/> - <xsd:attribute name="scope" type="scope" use="optional"/> - </xsd:complexType> - - <xsd:complexType name="mxmldocType"> - <xsd:choice minOccurs="0" maxOccurs="unbounded"> - <xsd:element ref="class"/> - <xsd:element ref="enumeration"/> - <xsd:element ref="function"/> - <xsd:element ref="namespace"/> - <xsd:element ref="struct"/> - <xsd:element ref="typedef"/> - <xsd:element ref="union"/> - <xsd:element ref="variable"/> - </xsd:choice> - </xsd:complexType> - - <xsd:complexType name="namespaceType"> - <xsd:sequence> - <xsd:element ref="description" minOccurs="0" maxOccurs="1"/> - <xsd:choice minOccurs="0" maxOccurs="unbounded"> - <xsd:element ref="class"/> - <xsd:element ref="enumeration"/> - <xsd:element ref="function"/> -- |
-- <xsd:element ref="struct"/> - <xsd:element ref="typedef"/> - <xsd:element ref="union"/> - <xsd:element ref="variable"/> - </xsd:choice> - </xsd:sequence> - <xsd:attribute name="name" type="identifier" use="required"/> - </xsd:complexType> - - <xsd:complexType name="returnvalueType"> - <xsd:sequence> - <xsd:element ref="type" minOccurs="1" maxOccurs="1"/> - <xsd:element ref="description" minOccurs="0" maxOccurs="1"/> - </xsd:sequence> - </xsd:complexType> - - <xsd:complexType name="structType"> - <xsd:sequence> - <xsd:element ref="description" minOccurs="0" maxOccurs="1"/> - <xsd:choice minOccurs="0" maxOccurs="unbounded"> - <xsd:element ref="variable"/> - <xsd:element ref="function"/> - </xsd:choice> - </xsd:sequence> - <xsd:attribute name="name" type="identifier" use="required"/> - </xsd:complexType> - - <xsd:complexType name="typedefType"> - <xsd:sequence> - <xsd:element ref="type" minOccurs="1" maxOccurs="1"/> - <xsd:element ref="description" minOccurs="0" maxOccurs="1"/> - </xsd:sequence> - <xsd:attribute name="name" type="identifier" use="required"/> - </xsd:complexType> - - <xsd:complexType name="unionType"> - <xsd:sequence> - <xsd:element ref="description" minOccurs="0" maxOccurs="1"/> - <xsd:element ref="variable" minOccurs="0" maxOccurs="unbounded"/> - </xsd:sequence> - <xsd:attribute name="name" type="identifier" use="required"/> - </xsd:complexType> - - <xsd:complexType name="variableType"> - <xsd:sequence> - <xsd:element ref="type" minOccurs="1" maxOccurs="1"/> - <xsd:element ref="description" minOccurs="0" maxOccurs="1"/> - </xsd:sequence> - <xsd:attribute name="name" type="identifier" use="required"/> - </xsd:complexType> - - <!-- data types --> - <xsd:simpleType name="direction"> - <xsd:restriction base="xsd:string"> - <xsd:enumeration value="I"/> - <xsd:enumeration value="O"/> - <xsd:enumeration value="IO"/> - </xsd:restriction> -- |
-- </xsd:simpleType> - - <xsd:simpleType name="identifier"> - <xsd:restriction base="xsd:string"> - <xsd:pattern value="[a-zA-Z_(.]([a-zA-Z_(.,)* 0-9])*"/> - </xsd:restriction> - </xsd:simpleType> - - <xsd:simpleType name="identifierList"> - <xsd:list itemType="identifier"/> - </xsd:simpleType> - - <xsd:simpleType name="scope"> - <xsd:restriction base="xsd:string"> - <xsd:enumeration value=""/> - <xsd:enumeration value="private"/> - <xsd:enumeration value="protected"/> - <xsd:enumeration value="public"/> - </xsd:restriction> - </xsd:simpleType> -</xsd:schema> -- |
In general, any C or C++ source code is handled by +mxmldoc, however it was specifically written to handle +code with documentation that is formatted according to the CUPS +Configuration Management Plan which is available at +"http://www.cups.org/documentation.php". +