├── ANNOUNCEMENT ├── CHANGES ├── COPYING ├── Makefile.in ├── README ├── TODO ├── config.h.in ├── configure ├── configure.in ├── doc ├── 0.gif ├── 1.gif ├── 2.gif ├── 3.gif ├── 4.gif ├── 5.gif ├── 6.gif ├── 7.gif ├── 8.gif ├── 9.gif ├── A.gif ├── B.gif ├── C.gif ├── D.gif ├── E.gif ├── F.gif ├── advanced.html ├── basics.html ├── chapters.xcf.gz ├── docset.css ├── docset.header ├── docset.intro ├── footer.man ├── hires │ ├── 0.gif │ ├── 1.gif │ ├── 2.gif │ ├── 3.gif │ ├── 4.gif │ ├── 5.gif │ ├── 6.gif │ ├── 7.gif │ ├── 8.gif │ ├── 9.gif │ ├── A.gif │ ├── B.gif │ ├── C.gif │ ├── D.gif │ ├── E.gif │ ├── F.gif │ └── logo.gif ├── install.html ├── intro.html ├── intro.man ├── license.html ├── logo.gif ├── logo.xcf.gz ├── makedocs.sh ├── mxml-cover.jpg ├── mxml-cover.sla ├── mxml.book ├── mxml.html ├── mxmldoc.html ├── mxmldoc.man ├── mxmldoc.xsd ├── reference.heading ├── reference.html ├── relnotes.html ├── schema.html └── title.html ├── install-sh ├── makesrcdist ├── mvalidate.c ├── mxml-attr.c ├── mxml-entity.c ├── mxml-file.c ├── mxml-get.c ├── mxml-index.c ├── mxml-node.c ├── mxml-private.c ├── mxml-private.h ├── mxml-search.c ├── mxml-set.c ├── mxml-string.c ├── mxml.h ├── mxml.list.in ├── mxml.pc.in ├── mxml.spec ├── mxml.xml ├── mxmldoc.c ├── test.xml ├── test ├── class.cxx ├── dotest.sh ├── enum.cxx ├── function.cxx ├── functype.cxx ├── struct.cxx └── type.cxx ├── testmxml.c ├── vcnet ├── config.h ├── mxml.sln ├── mxml1.def ├── mxml1.vcproj ├── mxmldoc.vcproj └── testmxml.vcproj └── www ├── .htaccess ├── 0.gif ├── 1.gif ├── 2.gif ├── 3.gif ├── 4.gif ├── A.gif ├── B.gif ├── C.gif ├── D.gif ├── account.php ├── articles.php ├── comment.php ├── data ├── .htaccess ├── make-form.php ├── makedb ├── mxml.sql └── software.md5 ├── docfiles ├── .htaccess ├── 0.gif ├── 1.gif ├── 2.gif ├── 3.gif ├── 4.gif ├── A.gif ├── B.gif ├── C.gif ├── D.gif ├── advanced.html ├── basics.html ├── index.html ├── install.html ├── intro.html ├── license.html ├── mxmldoc.html ├── reference.html ├── relnotes.html ├── schema.html └── search.index ├── documentation.php ├── forums.php ├── images ├── .htaccess ├── black.gif ├── favicon.xcf.gz ├── graph.gif ├── logo-large.gif ├── logo.gif └── private.gif ├── index.php ├── login.php ├── mxml.html ├── mxmldoc.xsd ├── org.minixml.atom ├── org.minixml.xar ├── phplib ├── .htaccess ├── auth.php ├── common.php ├── db.php ├── globals.php ├── html.php ├── mirrors.php ├── poll.php └── str.php ├── poll.php ├── software.php ├── str.php ├── strfiles └── .htaccess ├── style.css └── swfiles └── .htaccess /ANNOUNCEMENT: -------------------------------------------------------------------------------- 1 | Mini-XML 2.8 is now available for download from: 2 | 3 | http://www.msweet.org/downloads.php/Mini-XML 4 | 5 | Mini-XML 2.8 fixes some minor platform and XML issues. Changes include: 6 | 7 | - Now call docsetutil using xcrun on OS X (Bug #458) 8 | - mxmldoc did not escape special HTML characters inside @code foo@ 9 | comments. 10 | - Fixed a memory leak in mxmlElementDeleteAttr (Bug #452) 11 | - Added MXML_MAJOR/MINOR_VERSION definitions to mxml.h (Bug $461) 12 | - Fixed a bug reading UTF-16 characters from a file (Bug #454) 13 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | README - 2014-01-04 2 | ------------------- 3 | 4 | 5 | INTRODUCTION 6 | 7 | This README file describes the Mini-XML library version 2.8. 8 | 9 | Mini-XML is a small XML parsing library that you can use to read XML and 10 | XML-like data files in your application without requiring large non-standard 11 | libraries. Mini-XML only requires an ANSI C compatible compiler (GCC works, 12 | as do most vendors' ANSI C compilers) and a "make" program. 13 | 14 | Mini-XML provides the following functionality: 15 | 16 | - Reading of UTF-8 and UTF-16 and writing of UTF-8 encoded XML files and 17 | strings. 18 | - Data is stored in a linked-list tree structure, preserving the XML 19 | data hierarchy. 20 | - Supports arbitrary element names, attributes, and attribute values 21 | with no preset limits, just available memory. 22 | - Supports integer, real, opaque ("cdata"), and text data types in 23 | "leaf" nodes. 24 | - Functions for creating and managing trees of data. 25 | - "Find" and "walk" functions for easily locating and navigating trees 26 | of data. 27 | 28 | Mini-XML doesn't do validation or other types of processing on the data 29 | based upon schema files or other sources of definition information. 30 | 31 | 32 | BUILDING Mini-XML 33 | 34 | Mini-XML comes with an autoconf-based configure script; just type the 35 | following command to get things going: 36 | 37 | ./configure 38 | 39 | The default install prefix is /usr/local, which can be overridden using the 40 | --prefix option: 41 | 42 | ./configure --prefix=/foo 43 | 44 | Other configure options can be found using the --help option: 45 | 46 | ./configure --help 47 | 48 | Once you have configured the software, type "make" to do the build and run 49 | the test program to verify that things are working, as follows: 50 | 51 | make 52 | 53 | If you are using Mini-XML under Microsoft Windows with Visual C++, use the 54 | included project files in the "vcnet" subdirectory to build the library 55 | instead. 56 | 57 | 58 | INSTALLING Mini-XML 59 | 60 | The "install" target will install Mini-XML in the lib and include 61 | directories: 62 | 63 | make install 64 | 65 | Once you have installed it, use the "-lmxml" option to link your application 66 | against it. 67 | 68 | 69 | DOCUMENTATION 70 | 71 | The documentation is available in the "doc" subdirectory in the files 72 | "mxml.html" (HTML) and "mxml.pdf" (PDF). You can also look at the 73 | "testmxml.c" and "mxmldoc.c" source files for examples of using Mini-XML. 74 | 75 | Mini-XML provides a single header file which you include: 76 | 77 | #include 78 | 79 | Nodes are defined by the "mxml_node_t" structure; the "type" member defines 80 | the node type (element, integer, opaque, real, or text) which determines 81 | which value you want to look at in the "value" union. New nodes can be 82 | created using the "mxmlNewElement()", "mxmlNewInteger()", "mxmlNewOpaque()", 83 | "mxmlNewReal()", and "mxmlNewText()" functions. Only elements can have 84 | child nodes, and the top node must be an element, usually "?xml". 85 | 86 | You load an XML file using the "mxmlLoadFile()" function: 87 | 88 | FILE *fp; 89 | mxml_node_t *tree; 90 | 91 | fp = fopen("filename.xml", "r"); 92 | tree = mxmlLoadFile(NULL, fp, MXML_NO_CALLBACK); 93 | fclose(fp); 94 | 95 | Similarly, you save an XML file using the "mxmlSaveFile()" function: 96 | 97 | FILE *fp; 98 | mxml_node_t *tree; 99 | 100 | fp = fopen("filename.xml", "w"); 101 | mxmlSaveFile(tree, fp, MXML_NO_CALLBACK); 102 | fclose(fp); 103 | 104 | The "mxmlLoadString()", "mxmlSaveAllocString()", and "mxmlSaveString()" 105 | functions load XML node trees from and save XML node trees to strings: 106 | 107 | char buffer[8192]; 108 | char *ptr; 109 | mxml_node_t *tree; 110 | 111 | ... 112 | tree = mxmlLoadString(NULL, buffer, MXML_NO_CALLBACK); 113 | 114 | ... 115 | mxmlSaveString(tree, buffer, sizeof(buffer), MXML_NO_CALLBACK); 116 | 117 | ... 118 | ptr = mxmlSaveAllocString(tree, MXML_NO_CALLBACK); 119 | 120 | You can find a named element/node using the "mxmlFindElement()" function: 121 | 122 | mxml_node_t *node = mxmlFindElement(tree, tree, "name", "attr", 123 | "value", MXML_DESCEND); 124 | 125 | The "name", "attr", and "value" arguments can be passed as NULL to act as 126 | wildcards, e.g.: 127 | 128 | /* Find the first "a" element */ 129 | node = mxmlFindElement(tree, tree, "a", NULL, NULL, MXML_DESCEND); 130 | 131 | /* Find the first "a" element with "href" attribute */ 132 | node = mxmlFindElement(tree, tree, "a", "href", NULL, MXML_DESCEND); 133 | 134 | /* Find the first "a" element with "href" to a URL */ 135 | node = mxmlFindElement(tree, tree, "a", "href", 136 | "http://www.minixml.org/", 137 | MXML_DESCEND); 138 | 139 | /* Find the first element with a "src" attribute*/ 140 | node = mxmlFindElement(tree, tree, NULL, "src", NULL, MXML_DESCEND); 141 | 142 | /* Find the first element with a "src" = "foo.jpg" */ 143 | node = mxmlFindElement(tree, tree, NULL, "src", "foo.jpg", 144 | MXML_DESCEND); 145 | 146 | You can also iterate with the same function: 147 | 148 | mxml_node_t *node; 149 | 150 | for (node = mxmlFindElement(tree, tree, "name", NULL, NULL, 151 | MXML_DESCEND); 152 | node != NULL; 153 | node = mxmlFindElement(node, tree, "name", NULL, NULL, 154 | MXML_DESCEND)) 155 | { 156 | ... do something ... 157 | } 158 | 159 | The "mxmlFindPath()" function finds the (first) value node under a specific 160 | element using a "path": 161 | 162 | mxml_node_t *value = mxmlFindPath(tree, "path/to/*/foo/bar"); 163 | 164 | The "mxmlGetInteger()", "mxmlGetOpaque()", "mxmlGetReal()", and 165 | "mxmlGetText()" functions retrieve the value from a node: 166 | 167 | mxml_node_t *node; 168 | 169 | int intvalue = mxmlGetInteger(node); 170 | 171 | const char *opaquevalue = mxmlGetOpaque(node); 172 | 173 | double realvalue = mxmlGetReal(node); 174 | 175 | int whitespacevalue; 176 | const char *textvalue = mxmlGetText(node, &whitespacevalue); 177 | 178 | Finally, once you are done with the XML data, use the "mxmlDelete()" 179 | function to recursively free the memory that is used for a particular node 180 | or the entire tree: 181 | 182 | mxmlDelete(tree); 183 | 184 | 185 | GETTING HELP AND REPORTING PROBLEMS 186 | 187 | The Mini-XML project page provides access to a discussion forum and bug 188 | reporting page: 189 | 190 | http://www.msweet.org/projects.php/Mini-XML 191 | 192 | 193 | LEGAL STUFF 194 | 195 | The Mini-XML library is Copyright 2003-2014 by Michael Sweet. License terms 196 | are described in the file "COPYING". 197 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | TODO - 2011-12-20 2 | ----------------- 3 | 4 | - Add C++ class/struct. 5 | -- Make this the core implementation which the C API accesses? 6 | -- Class would allow for subclassing, is that necessary? 7 | - Binary XML support??? 8 | -------------------------------------------------------------------------------- /config.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * "$Id$" 3 | * 4 | * Configuration file for Mini-XML, a small XML-like file parsing library. 5 | * 6 | * Copyright 2003-2014 by Michael R Sweet. 7 | * 8 | * These coded instructions, statements, and computer programs are the 9 | * property of Michael R Sweet and are protected by Federal copyright 10 | * law. Distribution and use rights are outlined in the file "COPYING" 11 | * which should have been included with this file. If this file is 12 | * missing or damaged, see the license at: 13 | * 14 | * http://www.msweet.org/projects.php/Mini-XML 15 | */ 16 | 17 | /* 18 | * Include necessary headers... 19 | */ 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | 28 | /* 29 | * Version number... 30 | */ 31 | 32 | #define MXML_VERSION "" 33 | 34 | 35 | /* 36 | * Inline function support... 37 | */ 38 | 39 | #define inline 40 | 41 | 42 | /* 43 | * Long long support... 44 | */ 45 | 46 | #undef HAVE_LONG_LONG 47 | 48 | 49 | /* 50 | * Do we have the snprintf() and vsnprintf() functions? 51 | */ 52 | 53 | #undef HAVE_SNPRINTF 54 | #undef HAVE_VSNPRINTF 55 | 56 | 57 | /* 58 | * Do we have the strXXX() functions? 59 | */ 60 | 61 | #undef HAVE_STRDUP 62 | 63 | 64 | /* 65 | * Do we have threading support? 66 | */ 67 | 68 | #undef HAVE_PTHREAD_H 69 | 70 | 71 | /* 72 | * Define prototypes for string functions as needed... 73 | */ 74 | 75 | # ifndef HAVE_STRDUP 76 | extern char *_mxml_strdup(const char *); 77 | # define strdup _mxml_strdup 78 | # endif /* !HAVE_STRDUP */ 79 | 80 | extern char *_mxml_strdupf(const char *, ...); 81 | extern char *_mxml_vstrdupf(const char *, va_list); 82 | 83 | # ifndef HAVE_SNPRINTF 84 | extern int _mxml_snprintf(char *, size_t, const char *, ...); 85 | # define snprintf _mxml_snprintf 86 | # endif /* !HAVE_SNPRINTF */ 87 | 88 | # ifndef HAVE_VSNPRINTF 89 | extern int _mxml_vsnprintf(char *, size_t, const char *, va_list); 90 | # define vsnprintf _mxml_vsnprintf 91 | # endif /* !HAVE_VSNPRINTF */ 92 | 93 | /* 94 | * End of "$Id$". 95 | */ 96 | -------------------------------------------------------------------------------- /doc/0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/0.gif -------------------------------------------------------------------------------- /doc/1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/1.gif -------------------------------------------------------------------------------- /doc/2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/2.gif -------------------------------------------------------------------------------- /doc/3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/3.gif -------------------------------------------------------------------------------- /doc/4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/4.gif -------------------------------------------------------------------------------- /doc/5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/5.gif -------------------------------------------------------------------------------- /doc/6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/6.gif -------------------------------------------------------------------------------- /doc/7.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/7.gif -------------------------------------------------------------------------------- /doc/8.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/8.gif -------------------------------------------------------------------------------- /doc/9.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/9.gif -------------------------------------------------------------------------------- /doc/A.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/A.gif -------------------------------------------------------------------------------- /doc/B.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/B.gif -------------------------------------------------------------------------------- /doc/C.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/C.gif -------------------------------------------------------------------------------- /doc/D.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/D.gif -------------------------------------------------------------------------------- /doc/E.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/E.gif -------------------------------------------------------------------------------- /doc/F.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/F.gif -------------------------------------------------------------------------------- /doc/chapters.xcf.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/chapters.xcf.gz -------------------------------------------------------------------------------- /doc/docset.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: white; 3 | color: black; 4 | font-family: "lucida grande", geneva, helvetica, arial, sans-serif; 5 | } 6 | 7 | h1, h2, h3, h4, h5, h6, p, td, th { 8 | font-family: "lucida grande", geneva, helvetica, arial, sans-serif; 9 | } 10 | 11 | kbd { 12 | color: #006600; 13 | font-family: monaco, courier, monospace; 14 | font-weight: bold; 15 | } 16 | 17 | pre { 18 | font-family: monaco, courier, monospace; 19 | } 20 | 21 | pre.example { 22 | background: white; 23 | border: dotted thin #999999; 24 | margin-left: 36pt; 25 | padding: 10px; 26 | } 27 | 28 | pre.example em { 29 | color: #3f0000; 30 | font-family: "lucida grande", geneva, helvetica, arial, sans-serif; 31 | } 32 | 33 | div.summary table { 34 | border: solid thin #999999; 35 | border-collapse: collapse; 36 | border-spacing: 0; 37 | margin: 10px; 38 | width: 33%; 39 | } 40 | 41 | div.summary table td, div.summary table th { 42 | background: white; 43 | border: solid thin #999999; 44 | border-spacing: 0; 45 | padding: 5px; 46 | text-align: left; 47 | vertical-align: top; 48 | } 49 | 50 | div.summary table thead th { 51 | background: #f0f0f0; 52 | } 53 | 54 | div.body h1 { 55 | margin: 0; 56 | } 57 | div.body h2 { 58 | margin-top: 1.5em; 59 | } 60 | div.body h3, div.body h4, div.body h5 { 61 | margin-bottom: 0.5em; 62 | margin-top: 1.5em; 63 | } 64 | .class, .enumeration, .function, .struct, .typedef, .union { 65 | border-bottom: solid thin #999999; 66 | margin-bottom: 0; 67 | margin-top: 2em; 68 | } 69 | .description { 70 | margin-top: 0.5em; 71 | } 72 | code, p.code, pre, ul.code li { 73 | font-family: monaco, courier, monospace; 74 | font-size: 90%; 75 | } 76 | ul.code, ul.contents, ul.subcontents { 77 | list-style-type: none; 78 | margin: 0; 79 | padding-left: 0; 80 | } 81 | ul.code li { 82 | margin: 0; 83 | } 84 | ul.contents > li { 85 | margin-top: 1em; 86 | } 87 | ul.contents li ul.code, ul.contents li ul.subcontents { 88 | padding-left: 2em; 89 | } 90 | div.body dl { 91 | margin-left: 0; 92 | margin-top: 0; 93 | } 94 | div.body dt { 95 | font-style: italic; 96 | margin-left: 0; 97 | margin-top: 0; 98 | } 99 | div.body dd { 100 | margin-bottom: 0.5em; 101 | } 102 | span.info { 103 | background: black; 104 | border: thin solid black; 105 | color: white; 106 | font-size: 80%; 107 | font-style: italic; 108 | font-weight: bold; 109 | white-space: nowrap; 110 | } 111 | h2 span.info, h3 span.info, h4 span.info { 112 | float: right; 113 | font-size: 100%; 114 | } 115 | -------------------------------------------------------------------------------- /doc/docset.header: -------------------------------------------------------------------------------- 1 |

Mini-XML API Reference

2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
Headermxml.h
Library-lmxml
17 | -------------------------------------------------------------------------------- /doc/docset.intro: -------------------------------------------------------------------------------- 1 |

Introduction

2 | 3 |

Mini-XML is a small XML parsing library that you can use to read XML and 4 | XML-like data files in your application without requiring large non-standard 5 | libraries. Mini-XML only requires an ANSI C compatible compiler (GCC works, 6 | as do most vendors' ANSI C compilers) and a "make" program.

7 | 8 |

Mini-XML provides the following functionality:

9 | 10 |
    11 | 12 |
  • Reading of UTF-8 and UTF-16 and writing of UTF-8 encoded XML files 13 | and strings.
  • 14 | 15 |
  • Data is stored in a linked-list tree structure, preserving the XML 16 | data hierarchy.
  • 17 | 18 |
  • Supports arbitrary element names, attributes, and attribute values 19 | with no preset limits, just available memory.
  • 20 | 21 |
  • Supports integer, real, opaque ("CDATA"), and text data types in 22 | "leaf" nodes.
  • 23 | 24 |
  • Functions for creating, indexing, and managing trees of data.
  • 25 | 26 |
  • "Find" and "walk" functions for easily locating and navigating trees 27 | of data.
  • 28 | 29 |
30 | 31 |

Mini-XML doesn't do validation or other types of processing on the data based 32 | upon schema files or other sources of definition information, nor does it 33 | support character entities other than those required by the XML 34 | specification.

35 | 36 |

Using Mini-XML

37 | 38 |

Mini-XML provides a single header file which you include:

39 | 40 |
 41 | #include <mxml.h>
 42 | 
43 | 44 |

Nodes are defined by the "mxml_node_t" structure; 45 | the "type" member defines the node type (element, integer, opaque, real, or 46 | text) which determines which value you want to look at in the "value" union. 47 | New nodes can be created using the 48 | "mxmlNewElement()", 49 | "mxmlNewInteger()", 50 | "mxmlNewOpaque()", 51 | "mxmlNewReal()", and 52 | "mxmlNewText()" functions. Only elements can have 53 | child nodes, and the top node must be an element, usually "?xml".

54 | 55 |

You load an XML file using the "mxmlLoadFile()" function:

56 | 57 |
 58 | FILE *fp;
 59 | mxml_node_t *tree;
 60 | 
 61 | fp = fopen("filename.xml", "r");
 62 | tree = mxmlLoadFile(NULL, fp, MXML_NO_CALLBACK);
 63 | fclose(fp);
 64 | 
65 | 66 |

Similarly, you save an XML file using the 67 | "mxmlSaveFile()" function: 68 | 69 |

 70 | FILE *fp;
 71 | mxml_node_t *tree;
 72 | 
 73 | fp = fopen("filename.xml", "w");
 74 | mxmlSaveFile(tree, fp, MXML_NO_CALLBACK);
 75 | fclose(fp);
 76 | 
77 | 78 |

The "mxmlLoadString()", 79 | "mxmlSaveAllocString()", and 80 | "mxmlSaveString()" functions load XML node trees 81 | from and save XML node trees to strings:

82 | 83 |
 84 | char buffer[8192];
 85 | char *ptr;
 86 | mxml_node_t *tree;
 87 | 
 88 | ...
 89 | tree = mxmlLoadString(NULL, buffer, MXML_NO_CALLBACK);
 90 | 
 91 | ...
 92 | mxmlSaveString(tree, buffer, sizeof(buffer),
 93 | 	       MXML_NO_CALLBACK);
 94 | 
 95 | ...
 96 | ptr = mxmlSaveAllocString(tree, MXML_NO_CALLBACK);
 97 | 
98 | 99 |

You can find a named element/node using the 100 | "mxmlFindElement()" function:

101 | 102 |
103 | mxml_node_t *node = mxmlFindElement(tree, tree, "name",
104 | 				    "attr", "value",
105 | 				    MXML_DESCEND);
106 | 
107 | 108 |

The "name", "attr", and "value" arguments can be passed as 109 | NULL to act as wildcards, e.g.:

110 | 111 |
112 | /* Find the first "a" element */
113 | node = mxmlFindElement(tree, tree, "a", NULL, NULL,
114 | 		       MXML_DESCEND);
115 | 
116 | /* Find the first "a" element with "href" attribute */
117 | node = mxmlFindElement(tree, tree, "a", "href", NULL,
118 | 		       MXML_DESCEND);
119 | 
120 | /* Find the first "a" element with "href" to a URL */
121 | node = mxmlFindElement(tree, tree, "a", "href",
122 | 		       "http://www.easysw.com/~mike/mxml/",
123 | 		       MXML_DESCEND);
124 | 
125 | /* Find the first element with a "src" attribute*/
126 | node = mxmlFindElement(tree, tree, NULL, "src", NULL,
127 | 		       MXML_DESCEND);
128 | 
129 | /* Find the first element with a "src" = "foo.jpg" */
130 | node = mxmlFindElement(tree, tree, NULL, "src",
131 | 		       "foo.jpg", MXML_DESCEND);
132 | 
133 | 134 |

You can also iterate with the same function:

135 | 136 |
137 | mxml_node_t *node;
138 | 
139 | for (node = mxmlFindElement(tree, tree, "name", NULL,
140 | 			    NULL, MXML_DESCEND);
141 |      node != NULL;
142 |      node = mxmlFindElement(node, tree, "name", NULL,
143 | 			    NULL, MXML_DESCEND))
144 | {
145 |   ... do something ...
146 | }
147 | 
148 | 149 |

The "mxmlFindPath()" function finds the (first) value node under a specific 150 | element using a "path":

151 | 152 |
153 | mxml_node_t *value = mxmlFindPath(tree, "path/to/*/foo/bar");
154 | 
155 | 156 |

The "mxmlGetInteger()", "mxmlGetOpaque()", "mxmlGetReal()", and 157 | "mxmlGetText()" functions retrieve the value from a node:

158 | 159 |
160 | mxml_node_t *node;
161 | 
162 | int intvalue = mxmlGetInteger(node);
163 | 
164 | const char *opaquevalue = mxmlGetOpaque(node);
165 | 
166 | double realvalue = mxmlGetReal(node);
167 | 
168 | int whitespacevalue;
169 | const char *textvalue = mxmlGetText(node, &whitespacevalue);
170 | 
171 | 172 |

Finally, once you are done with the XML data, use the 173 | "mxmlDelete()" function to recursively free the 174 | memory that is used for a particular node or the entire tree:

175 | 176 |
177 | mxmlDelete(tree);
178 | 
179 | -------------------------------------------------------------------------------- /doc/footer.man: -------------------------------------------------------------------------------- 1 | .SH SEE ALSO 2 | mxmldoc(1), Mini-XML Programmers Manual, http://www.minixml.org/ 3 | .SH COPYRIGHT 4 | Copyright 2003-2011 by Michael Sweet. 5 | -------------------------------------------------------------------------------- /doc/hires/0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/hires/0.gif -------------------------------------------------------------------------------- /doc/hires/1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/hires/1.gif -------------------------------------------------------------------------------- /doc/hires/2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/hires/2.gif -------------------------------------------------------------------------------- /doc/hires/3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/hires/3.gif -------------------------------------------------------------------------------- /doc/hires/4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/hires/4.gif -------------------------------------------------------------------------------- /doc/hires/5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/hires/5.gif -------------------------------------------------------------------------------- /doc/hires/6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/hires/6.gif -------------------------------------------------------------------------------- /doc/hires/7.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/hires/7.gif -------------------------------------------------------------------------------- /doc/hires/8.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/hires/8.gif -------------------------------------------------------------------------------- /doc/hires/9.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/hires/9.gif -------------------------------------------------------------------------------- /doc/hires/A.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/hires/A.gif -------------------------------------------------------------------------------- /doc/hires/B.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/hires/B.gif -------------------------------------------------------------------------------- /doc/hires/C.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/hires/C.gif -------------------------------------------------------------------------------- /doc/hires/D.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/hires/D.gif -------------------------------------------------------------------------------- /doc/hires/E.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/hires/E.gif -------------------------------------------------------------------------------- /doc/hires/F.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/hires/F.gif -------------------------------------------------------------------------------- /doc/hires/logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/hires/logo.gif -------------------------------------------------------------------------------- /doc/install.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

1Building, 6 | Installing, and Packaging Mini-XML

7 | 8 |

This chapter describes how to build, install, and package 9 | Mini-XML on your system from the source archive. You will need an 10 | ANSI/ISO-C compatible compiler to build Mini-XML - GCC works, as 11 | do most vendors' C compilers. If you are building Mini-XML on 12 | Windows, we recommend using the Visual C++ environment with the 13 | supplied solution file. For other operating systems, you'll need a 14 | POSIX-compatible shell and make program in addition to 15 | the C compiler.

16 | 17 |

Compiling Mini-XML

18 | 19 |

Mini-XML comes with both an autoconf-based configure script 20 | and a Visual C++ solution that can be used to compile the library 21 | and associated tools.

22 | 23 |

Compiling with Visual C++

24 | 25 |

Open the mxml.sln solution in the vcnet 26 | folder. Choose the desired build configuration, "Debug" (the 27 | default) or "Release", and then choose Build Solution 28 | from the Build menu.

29 | 30 |

Compiling with Command-Line Tools

31 | 32 |

Type the following command to configure the Mini-XML source 33 | code for your system:

34 | 35 |
 36 |     ./configure ENTER
 37 | 
38 | 39 |

The default install prefix is /usr/local, which 40 | can be overridden using the --prefix option:

41 | 42 |
 43 |     ./configure --prefix=/foo ENTER
 44 | 
45 | 46 |

Other configure options can be found using the 47 | --help option:

48 | 49 |
 50 |     ./configure --help ENTER
 51 | 
52 | 53 |

Once you have configured the software, use the 54 | make(1) program to do the build and run the test 55 | program to verify that things are working, as follows:

56 | 57 |
 58 |     make ENTER
 59 | 
60 | 61 | 62 |

Installing Mini-XML

63 | 64 |

If you are using Visual C++, copy the mxml.lib and 65 | and mxml.h files to the Visual C++ lib and 66 | include directories, respectively.

67 | 68 |

Otherwise, use the make command with the 69 | install target to install Mini-XML in the configured 70 | directories:

71 | 72 |
 73 |     make install ENTER
 74 | 
75 | 76 | 77 |

Creating Mini-XML Packages

78 | 79 |

Mini-XML includes two files that can be used to create binary 80 | packages. The first file is mxml.spec which is used 81 | by the rpmbuild(8) software to create Red Hat Package 82 | Manager ("RPM") packages which are commonly used on Linux. Since 83 | rpmbuild wants to compile the software on its own, you 84 | can provide it with the Mini-XML tar file to build the 85 | package:

86 | 87 |
 88 |     rpmbuild -ta mxml-version.tar.gz ENTER
 89 | 
90 | 91 |

The second file is mxml.list which is used by the 92 | epm(1) program to create software packages in a variety 93 | of formats. The epm program is available from the 94 | following URL:

95 | 96 |
 97 |     http://www.epmhome.org/
 98 | 
99 | 100 |

Use the make command with the epm target 101 | to create portable and native packages for your system:

102 | 103 |
104 |     make epm ENTER
105 | 
106 | 107 |

The packages are stored in a subdirectory named 108 | dist for your convenience. The portable packages 109 | utilize scripts and tar files to install the software on the 110 | target system. After extracting the package archive, use the 111 | mxml.install script to install the software.

112 | 113 |

The native packages will be in the local OS's native format: 114 | RPM for Red Hat Linux, DPKG for Debian Linux, PKG for Solaris, 115 | and so forth. Use the corresponding commands to install the 116 | native packages.

117 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /doc/intro.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Mini-XML Programmers Manual, Version 2.8 4 | 5 | 6 | 7 | 8 | 9 | 10 |

0Introduction

12 | 13 |

This programmers manual describes Mini-XML version 2.8, a small 14 | XML parsing library that you can use to read and write XML data 15 | files in your C and C++ applications.

16 | 17 |

Mini-XML was initially developed for the Gutenprint project to replace 19 | the rather large and unwieldy libxml2 library with 20 | something substantially smaller and easier-to-use. It all began one 21 | morning in June of 2003 when Robert posted the following sentence to 22 | the developer's list:

23 | 24 |
It's bad enough that we require libxml2, but rolling 25 | our own XML parser is a bit more than we can handle.
26 | 27 |

I then replied with:

28 | 29 |
Given the limited scope of what you use in XML, it 30 | should be trivial to code a mini-XML API in a few hundred lines of 31 | code.
32 | 33 |

I took my own challenge and coded furiously for two days to 34 | produced the initial public release of Mini-XML, total lines of 35 | code: 696. Robert promptly integrated Mini-XML into Gutenprint 36 | and removed libxml2.

37 | 38 |

Thanks to lots of feedback and support from various 39 | developers, Mini-XML has evolved since then to provide a more 40 | complete XML implementation and now stands at a whopping 3,792 41 | lines of code, compared to 140,410 lines of code for libxml2 42 | version 2.9.1.

43 | 44 |

Aside from Gutenprint, Mini-XML is used for the 45 | following projects/software applications:

46 | 47 | 55 | 56 |

Please file a bug on msweet.org if you would like your project added or 57 | removed from this list, or if you have any comments/quotes you would like me to 58 | publish about your experiences with Mini-XML.

59 | 60 | 61 |

Organization of This Document

62 | 63 |

This manual is organized into the following chapters and 64 | appendices:

65 | 66 | 102 | 103 | 104 |

Notation Conventions

105 | 106 |

Various font and syntax conventions are used in this guide. 107 | Examples and their meanings and uses are explained below:

108 | 109 |
110 | 111 |
mxmldoc
112 | mxmldoc(1)
113 | 114 |
The names of commands; the first mention of a command 115 | or function in a chapter is followed by a manual page 116 | section number.

117 | 118 |
/var
119 | /etc/hosts
120 | 121 |
File and directory names.

122 | 123 |
Request ID is Printer-123
124 | 125 |
Screen output.

126 | 127 |
lp -d printer filename ENTER
128 | 129 |
Literal user input; special keys like 130 | ENTER are in ALL CAPS.

131 | 132 |
12.3
133 | 134 |
Numbers in the text are written using the period (.) 135 | to indicate the decimal point.

136 | 137 |
138 | 139 | 140 |

Abbreviations

141 | 142 |

The following abbreviations are used throughout this 143 | manual:

144 | 145 |
146 | 147 |
Gb
148 |
Gigabytes, or 1073741824 bytes

149 | 150 |
kb
151 |
Kilobytes, or 1024 bytes

152 | 153 |
Mb
154 |
Megabytes, or 1048576 bytes

155 | 156 |
UTF-8, UTF-16
157 |
Unicode Transformation Format, 8-bit or 16-bit

158 | 159 |
W3C
160 |
World Wide Web Consortium

161 | 162 |
XML
163 |
Extensible Markup Language

164 | 165 |
166 | 167 | 168 |

Other References

169 | 170 |
171 | 172 |
The Unicode Standard, Version 4.0, Addison-Wesley, 173 | ISBN 0-321-18578-1
174 | 175 |
The definition of the Unicode character set which is 176 | used for XML.

177 | 178 |
Extensible 180 | Markup Language (XML) 1.0 (Third Edition)
181 | 182 |
The XML specification from the World Wide Web 183 | Consortium (W3C)

184 | 185 |
186 | 187 | 188 |

Legal Stuff

189 | 190 |

The Mini-XML library is copyright 2003-2014 by Michael R Sweet. License terms 191 | are described in Appendix A - Mini-XML License.

192 | 193 | 194 | 195 | -------------------------------------------------------------------------------- /doc/intro.man: -------------------------------------------------------------------------------- 1 | .SH INCLUDE FILE 2 | #include 3 | .SH LIBRARY 4 | \-lmxml 5 | .SH DESCRIPTION 6 | Mini-XML is a small XML parsing library that you can use to 7 | read XML and XML-like data files in your application without 8 | requiring large non-standard libraries. Mini-XML only 9 | requires an ANSI C compatible compiler (GCC works, as do 10 | most vendors' ANSI C compilers) and a "make" program. 11 | .PP 12 | Mini-XML provides the following functionality: 13 | .IP \(bu 4 14 | Reading of UTF-8 and UTF-16 and writing of UTF-8 encoded XML files and strings. 15 | .IP \(bu 4 16 | Data is stored in a linked-list tree structure, 17 | preserving the XML data hierarchy. 18 | .IP \(bu 4 19 | Supports arbitrary element names, attributes, and attribute 20 | values with no preset limits, just available memory. 21 | .IP \(bu 4 22 | Supports integer, real, opaque ("CDATA"), and text data types in 23 | "leaf" nodes. 24 | .IP \(bu 4 25 | Functions for creating, indexing, and managing trees of data. 26 | .IP \(bu 4 27 | "Find" and "walk" functions for easily locating and navigating 28 | trees of data. 29 | .PP 30 | Mini-XML doesn't do validation or other types of processing 31 | on the data based upon schema files or other sources of 32 | definition information, nor does it support character 33 | entities other than those required by the XML 34 | specification. 35 | .SH USING MINI-XML 36 | Mini-XML provides a single header file which you include: 37 | .nf 38 | 39 | #include 40 | .fi 41 | .PP 42 | Nodes are defined by the "mxml_node_t" structure; the "type" 43 | member defines the node type (element, integer, opaque, 44 | real, or text) which determines which value you want to look 45 | at in the "value" union. New nodes can be created using the 46 | "mxmlNewElement()", "mxmlNewInteger()", "mxmlNewOpaque()", 47 | "mxmlNewReal()", and "mxmlNewText()" functions. Only 48 | elements can have child nodes, and the top node must be an 49 | element, usually "?xml". 50 | .PP 51 | You load an XML file using the "mxmlLoadFile()" function: 52 | .nf 53 | 54 | FILE *fp; 55 | mxml_node_t *tree; 56 | 57 | fp = fopen("filename.xml", "r"); 58 | tree = mxmlLoadFile(NULL, fp, MXML_NO_CALLBACK); 59 | fclose(fp); 60 | .fi 61 | .PP 62 | Similarly, you save an XML file using the "mxmlSaveFile()" 63 | function: 64 | .nf 65 | 66 | FILE *fp; 67 | mxml_node_t *tree; 68 | 69 | fp = fopen("filename.xml", "w"); 70 | mxmlSaveFile(tree, fp, MXML_NO_CALLBACK); 71 | fclose(fp); 72 | .fi 73 | .PP 74 | The "mxmlLoadString()", "mxmlSaveAllocString()", and 75 | "mxmlSaveString()" functions load XML node trees from and save 76 | XML node trees to strings: 77 | .nf 78 | 79 | char buffer[8192]; 80 | char *ptr; 81 | mxml_node_t *tree; 82 | 83 | ... 84 | tree = mxmlLoadString(NULL, buffer, MXML_NO_CALLBACK); 85 | 86 | ... 87 | mxmlSaveString(tree, buffer, sizeof(buffer), 88 | MXML_NO_CALLBACK); 89 | 90 | ... 91 | ptr = mxmlSaveAllocString(tree, MXML_NO_CALLBACK); 92 | .fi 93 | .PP 94 | You can find a named element/node using the "mxmlFindElement()" 95 | function: 96 | .nf 97 | 98 | mxml_node_t *node = mxmlFindElement(tree, tree, "name", 99 | "attr", "value", 100 | MXML_DESCEND); 101 | .fi 102 | .PP 103 | The "name", "attr", and "value" arguments can be passed as 104 | NULL to act as wildcards, e.g.: 105 | .nf 106 | 107 | /* Find the first "a" element */ 108 | node = mxmlFindElement(tree, tree, "a", NULL, NULL, 109 | MXML_DESCEND); 110 | 111 | /* Find the first "a" element with "href" attribute */ 112 | node = mxmlFindElement(tree, tree, "a", "href", NULL, 113 | MXML_DESCEND); 114 | 115 | /* Find the first "a" element with "href" to a URL */ 116 | node = mxmlFindElement(tree, tree, "a", "href", 117 | "http://www.easysw.com/~mike/mxml/", 118 | MXML_DESCEND); 119 | 120 | /* Find the first element with a "src" attribute*/ 121 | node = mxmlFindElement(tree, tree, NULL, "src", NULL, 122 | MXML_DESCEND); 123 | 124 | /* Find the first element with a "src" = "foo.jpg" */ 125 | node = mxmlFindElement(tree, tree, NULL, "src", 126 | "foo.jpg", MXML_DESCEND); 127 | .fi 128 | .PP 129 | You can also iterate with the same function: 130 | .nf 131 | 132 | mxml_node_t *node; 133 | 134 | for (node = mxmlFindElement(tree, tree, "name", NULL, 135 | NULL, MXML_DESCEND); 136 | node != NULL; 137 | node = mxmlFindElement(node, tree, "name", NULL, 138 | NULL, MXML_DESCEND)) 139 | { 140 | ... do something ... 141 | } 142 | .fi 143 | .PP 144 | To find the value of a specific node in the tree, use the "mxmlFindPath()" 145 | function: 146 | .nf 147 | 148 | mxml_node_t *value = mxmlFindPath(tree, "path/to/*/foo/bar"); 149 | .fi 150 | .PP 151 | The "mxmlGetInteger()", "mxmlGetOpaque()", "mxmlGetReal()", and "mxmlGetText()" 152 | functions retrieve the value from a node: 153 | .nf 154 | 155 | mxml_node_t *node; 156 | 157 | int intvalue = mxmlGetInteger(node); 158 | 159 | const char *opaquevalue = mxmlGetOpaque(node); 160 | 161 | double realvalue = mxmlGetReal(node); 162 | 163 | int whitespacevalue; 164 | const char *textvalue = mxmlGetText(node, &whitespacevalue); 165 | .fi 166 | .PP 167 | Finally, once you are done with the XML data, use the 168 | "mxmlDelete()" function to recursively free the memory that 169 | is used for a particular node or the entire tree: 170 | .nf 171 | 172 | mxmlDelete(tree); 173 | .fi 174 | -------------------------------------------------------------------------------- /doc/logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/logo.gif -------------------------------------------------------------------------------- /doc/logo.xcf.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/logo.xcf.gz -------------------------------------------------------------------------------- /doc/makedocs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # "$Id$" 4 | # 5 | # Script to make documentation... 6 | # 7 | # Copyright 2003-2010 by Michael R Sweet. 8 | # 9 | # These coded instructions, statements, and computer programs are the 10 | # property of Michael R Sweet and are protected by Federal copyright 11 | # law. Distribution and use rights are outlined in the file "COPYING" 12 | # which should have been included with this file. If this file is 13 | # missing or damaged, see the license at: 14 | # 15 | # http://www.minixml.org/ 16 | # 17 | 18 | htmldoc --verbose --path "hires;." --batch mxml.book -f mxml.pdf 19 | 20 | htmldoc --verbose --batch mxml.book --no-title -f mxml.html 21 | 22 | rm -rf mxml.d 23 | mkdir mxml.d 24 | htmldoc --verbose --batch mxml.book --no-title -t html -d mxml.d 25 | 26 | # 27 | # End of "$Id$". 28 | # 29 | -------------------------------------------------------------------------------- /doc/mxml-cover.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/doc/mxml-cover.jpg -------------------------------------------------------------------------------- /doc/mxml.book: -------------------------------------------------------------------------------- 1 | #HTMLDOC 1.8.27.1 2 | -t pdf14 -f "mxml.pdf" --book --toclevels 3 --no-numbered --toctitle "Table of Contents" --title --titleimage "title.html" --linkstyle plain --size 4.25x6.875in --left 0.750in --right 0.50in --top 0.50in --bottom 0.50in --header .t. --header1 ... --footer h.1 --nup 1 --tocheader .t. --tocfooter ..i --duplex --portrait --color --no-pscommands --no-xrxcomments --compression=9 --jpeg=95 --fontsize 9.0 --fontspacing 1.2 --headingfont Helvetica --bodyfont Helvetica --headfootsize 8.0 --headfootfont Helvetica-Oblique --charset iso-8859-1 --links --embedfonts --pagemode outline --pagelayout single --firstpage c1 --pageeffect none --pageduration 10 --effectduration 1.0 --no-encryption --permissions all --owner-password "" --user-password "" --browserwidth 300 --no-strict --no-overflow 3 | intro.html 4 | install.html 5 | basics.html 6 | advanced.html 7 | mxmldoc.html 8 | license.html 9 | relnotes.html 10 | reference.html 11 | schema.html 12 | -------------------------------------------------------------------------------- /doc/mxmldoc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

4Using the mxmldoc 6 | Utility

7 | 8 |

This chapter describes how to use mxmldoc(1) program to 9 | automatically generate documentation from C and C++ source 10 | files.

11 | 12 | 13 |

The Basics

14 | 15 |

Originally developed to generate the Mini-XML and CUPS API 16 | documentation, mxmldoc is now a general-purpose utility 17 | which scans C and C++ source files to produce HTML and man page 18 | documentation along with an XML file representing the functions, 19 | types, and definitions in those source files. Unlike popular 20 | documentation generators like Doxygen or Javadoc, mxmldoc 21 | uses in-line comments rather than comment headers, allowing for more 22 | "natural" code documentation.

23 | 24 |

By default, mxmldoc produces HTML documentation. For 25 | example, the following command will scan all of the C source and 26 | header files in the current directory and produce a HTML 27 | documentation file called filename.html:

28 | 29 |
 30 |     mxmldoc *.h *.c >filename.html ENTER
 31 | 
32 | 33 |

You can also specify an XML file to create which contains all of 34 | the information from the source files. For example, the following 35 | command creates an XML file called filename.xml in 36 | addition to the HTML file:

37 | 38 |
 39 |     mxmldoc filename.xml *.h *.c >filename.html ENTER
 40 | 
41 | 42 |

The --no-output option disables the normal HTML 43 | output:

44 | 45 |
 46 |     mxmldoc --no-output filename.xml *.h *.c ENTER
 47 | 
48 | 49 |

You can then run mxmldoc again with the XML file alone 50 | to generate the HTML documentation:

51 | 52 |
 53 |     mxmldoc filename.xml >filename.html ENTER
 54 | 
55 | 56 |

Creating Man Pages

57 | 58 |

The --man filename option tells mxmldoc to 59 | create a man page instead of HTML documentation, for example:

60 | 61 |
 62 |     mxmldoc --man filename filename.xml \
 63 |         >filename.man ENTER
 64 | 
 65 |     mxmldoc --man filename *.h *.c \
 66 |         >filename.man ENTER
 67 | 
68 | 69 |

Creating Xcode Documentation Sets

70 | 71 |

The --docset directory.docset option tells mxmldoc to 72 | create an Xcode documentation set containing the HTML documentation, for 73 | example:

74 | 75 |
 76 |     mxmldoc --docset foo.docset *.h *.c foo.xml ENTER
 77 | 
78 | 79 |

Xcode documentation sets can only be built on Mac OS X with Xcode 3.0 or 80 | higher installed.

81 | 82 | 83 |

Commenting Your Code

84 | 85 |

As noted previously, mxmldoc looks for in-line comments 86 | to describe the functions, types, and constants in your code. 87 | Mxmldoc will document all public names it finds in your 88 | source files - any names starting with the underscore character (_) 89 | or names that are documented with the @private@ directive are treated as private 91 | and are not documented.

92 | 93 |

Comments appearing directly before a function or type definition 94 | are used to document that function or type. Comments appearing after 95 | argument, definition, return type, or variable declarations are used 96 | to document that argument, definition, return type, or variable. For 97 | example, the following code excerpt defines a key/value structure 98 | and a function that creates a new instance of that structure:

99 | 100 |
101 |     /* A key/value pair. This is used with the
102 |        dictionary structure. */
103 | 
104 |     struct keyval
105 |     {
106 |       char *key; /* Key string */
107 |       char *val; /* Value string */
108 |     };
109 | 
110 |     /* Create a new key/value pair. */
111 | 
112 |     struct keyval * /* New key/value pair */
113 |     new_keyval(
114 |         const char *key, /* Key string */
115 | 	const char *val) /* Value string */
116 |     {
117 |       ...
118 |     }
119 | 
120 | 121 |

Mxmldoc also knows to remove extra asterisks (*) from 122 | the comment string, so the comment string:

123 | 124 |
125 |     /*
126 |      * Compute the value of PI.
127 |      *
128 |      * The function connects to an Internet server
129 |      * that streams audio of mathematical monks
130 |      * chanting the first 100 digits of PI.
131 |      */
132 | 
133 | 134 |

will be shown as:

135 | 136 |
137 |     Compute the value of PI.
138 | 
139 |     The function connects to an Internet server
140 |     that streams audio of mathematical monks
141 |     chanting the first 100 digits of PI.
142 | 
143 | 144 |

Comments can also include the 145 | following special @name ...@ directive strings:

146 | 147 |
    148 | 149 |
  • @deprecated@ - flags the item as deprecated to 150 | discourage its use
  • 151 | 152 |
  • @private@ - flags the item as private so it 153 | will not be included in the documentation
  • 154 | 155 |
  • @since ...@ - flags the item as new since a 156 | particular release. The text following the @since 157 | up to the closing @ is highlighted in the generated 158 | documentation, e.g. @since Mini-XML 2.7@.
  • 159 | 160 |
161 | 162 | 163 | 164 |

Titles, Sections, and Introductions

165 | 166 |

Mxmldoc also provides options to set the title, section, 167 | and introduction text for the generated documentation. The 168 | --title text option specifies the title for the 169 | documentation. The title string is usually put in quotes:

170 | 171 |
172 |     mxmldoc filename.xml \
173 |         --title "My Famous Documentation" \
174 |         >filename.html ENTER
175 | 
176 | 177 |

The --section name option specifies the section for 178 | the documentation. For HTML documentation, the name is placed in 179 | a HTML comment such as:

180 | 181 |
182 |     <!-- SECTION: name -->
183 | 
184 | 185 |

For man pages, the section name is usually just a number ("3"), 186 | or a number followed by a vendor name ("3acme"). The section name is 187 | used in the .TH directive in the man page:

188 | 189 |
190 |     .TH mylibrary 3acme "My Title" ...
191 | 
192 | 193 |

The default section name for man page output is "3". There is no 194 | default section name for HTML output.

195 | 196 |

Finally, the --intro filename option specifies a file to 197 | embed after the title and section but before the generated 198 | documentation. For HTML documentation, the file must consist of 199 | valid HTML without the usual DOCTYPE, html, and 200 | body elements. For man page documentation, the file must 201 | consist of valid nroff(1) text.

202 | 203 | 204 | 205 | -------------------------------------------------------------------------------- /doc/mxmldoc.man: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" "$Id$" 3 | .\" 4 | .\" mxmldoc man page for mini-XML, a small XML-like file parsing library. 5 | .\" 6 | .\" Copyright 2003-2009 by Michael Sweet. 7 | .\" 8 | .\" This program is free software; you can redistribute it and/or 9 | .\" modify it under the terms of the GNU Library General Public 10 | .\" License as published by the Free Software Foundation; either 11 | .\" version 2, or (at your option) any later version. 12 | .\" 13 | .\" This program is distributed in the hope that it will be useful, 14 | .\" but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | .\" GNU General Public License for more details. 17 | .\" 18 | .TH mxmldoc 1 "Mini-XML" "4 May 2009" "Michael Sweet" 19 | .SH NAME 20 | mxmldoc \- mini-xml documentation generator 21 | .SH SYNOPSIS 22 | .B mxmldoc 23 | \-\-no-output [ 24 | .I filename.xml 25 | ] 26 | .I source file(s) 27 | ] 28 | .br 29 | .B mxmldoc 30 | [ \-\-footer 31 | .I footerfile 32 | ] [ \-\-header 33 | .I headerfile 34 | ] [ \-\-intro 35 | .I introfile 36 | ] [ \-\-section 37 | .I section 38 | ] [ \-\-title 39 | .I title 40 | ] [ 41 | .I filename.xml 42 | ] [ 43 | .I source file(s) 44 | ] > 45 | .I filename.html 46 | .br 47 | .B mxmldoc 48 | \-\-docset 49 | .I directory.docset 50 | [ \-\-docversion 51 | .I version 52 | ] [ \-\-feedname 53 | .I name 54 | ] [ \-\-feedurl 55 | .I url 56 | ] [ \-\-footer 57 | .I footerfile 58 | ] [ \-\-header 59 | .I headerfile 60 | ] [ \-\-intro 61 | .I introfile 62 | ] [ \-\-section 63 | .I section 64 | ] [ \-\-title 65 | .I title 66 | ] [ 67 | .I filename.xml 68 | ] [ 69 | .I source file(s) 70 | ] 71 | .br 72 | .B mxmldoc 73 | \-\-tokens 74 | .I path 75 | [ 76 | .I filename.xml 77 | ] [ 78 | .I source file(s) 79 | ] > tokens.xml 80 | .br 81 | .B mxmldoc 82 | \-\-framed 83 | .I basename 84 | [ \-\-footer 85 | .I footerfile 86 | ] [ \-\-header 87 | .I headerfile 88 | ] [ \-\-intro 89 | .I introfile 90 | ] [ \-\-section 91 | .I section 92 | ] [ \-\-title 93 | .I title 94 | ] [ 95 | .I filename.xml 96 | ] [ 97 | .I source file(s) 98 | ] 99 | .br 100 | .B mxmldoc 101 | [ \-\-footer 102 | .I footerfile 103 | ] [ \-\-header 104 | .I headerfile 105 | ] [ \-\-intro 106 | .I introfile 107 | ] \-\-man 108 | .I manpage 109 | [ \-\-section 110 | .I section 111 | ] [ \-\-title 112 | .I title 113 | ] [ 114 | .I filename.xml 115 | ] [ 116 | .I source file(s) 117 | ] > 118 | .I filename.man 119 | .SH DESCRIPTION 120 | \fImxmldoc\fR scans the specified C and C++ source files to produce 121 | an XML representation of globally accessible classes, constants, 122 | enumerations, functions, structures, typedefs, unions, and variables 123 | - the XML file is updated as necessary. By default, a HTML 124 | representation of the XML file is written to the standard output. 125 | Use the \fI\-\-no-output\fR option to disable the HTML output. 126 | .PP 127 | Man page source can be generated using the \fI\-\-man\fR option. 128 | .PP 129 | If no source files are specified then the current XML file is 130 | converted to the standard output. 131 | .PP 132 | In general, any C or C++ source code is handled by \fImxmldoc\fR, 133 | however it was specifically written to handle code with 134 | documentation that is formatted according to the CUPS Developer 135 | Guide which is available at "http://www.cups.org/documentation.php". 136 | .SH OPTIONS 137 | .TP 5 138 | \-\-docset directory.docset 139 | .br 140 | Creates an Xcode documentation set in the specified directory. 141 | .TP 5 142 | \-\-docversion version 143 | .br 144 | Specifies the version number for the Xcode documentation set. 145 | .TP 5 146 | \-\-feedname name 147 | .br 148 | Specifies the Xcode documentation set feed name, typically the project or 149 | company name. 150 | .TP 5 151 | \-\-feedurl url 152 | .br 153 | Specifies the Xcode documentation set feed URL which must point to an ATOM file 154 | linking to updates. 155 | .TP 5 156 | \-\-footer footerfile 157 | .br 158 | Inserts the specified file at the bottom of the output documentation. 159 | .TP 5 160 | \-\-framed basename 161 | .br 162 | Creates HTML documentation using frames - one for the table-of-contents and 163 | one for the body. 164 | .TP 5 165 | \-\-header headerfile 166 | .br 167 | Inserts the specified file at the top of the output documentation. 168 | .TP 5 169 | \-\-intro introfile 170 | .br 171 | Inserts the specified file before the table of contents. 172 | .TP 5 173 | \-\-man manpage 174 | .br 175 | Generated a man page instead of HTML documentation. 176 | .TP 5 177 | \-\-no-output 178 | .br 179 | Disables generation of documentation on the standard output. 180 | .TP 5 181 | \-\-section section 182 | .br 183 | Sets the section/keywords in the output documentation. 184 | .TP 5 185 | \-\-title title 186 | .br 187 | Sets the title of the output documentation. 188 | .TP 5 189 | \-\-tokens 190 | .br 191 | Generates a Tokens.xml file for use with the Xcode documentation tools. 192 | .SH SEE ALSO 193 | mxml(3), Mini-XML Programmers Manual, http://www.minixml.org/ 194 | .SH COPYRIGHT 195 | Copyright 2003-2009 by Michael Sweet. 196 | .\" 197 | .\" End of "$Id$". 198 | .\" 199 | -------------------------------------------------------------------------------- /doc/mxmldoc.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Mini-XML 2.8 documentation schema for mxmldoc output. 6 | Copyright 2003-2014 by Michael Sweet. 7 | 8 | This program is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Library General Public 10 | License as published by the Free Software Foundation; either 11 | version 2, or (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | -------------------------------------------------------------------------------- /doc/reference.heading: -------------------------------------------------------------------------------- 1 |

CLibrary 3 | Reference

4 | 5 | -------------------------------------------------------------------------------- /doc/schema.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

DXML Schema

6 | 7 |

This appendix provides the XML schema that is used for the XML 8 | files produced by mxmldoc. This schema is available on-line 9 | at:

10 | 11 |
 12 |     http://www.msweet.org/schema/mxmldoc.xsd
 13 | 
14 | 15 |

mxmldoc.xsd

16 | 17 |

 18 | <?xml version="1.0"?>
 19 | <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 20 |   <xsd:annotation>
 21 |     <xsd:documentation xml:lang="en">
 22 |       Mini-XML 2.8 documentation schema for mxmldoc output.
 23 |       Copyright 2003-2014 by Michael Sweet.
 24 |     </xsd:documentation>
 25 |   </xsd:annotation>
 26 | 
 27 |   <!-- basic element definitions -->
 28 |   <xsd:element name="argument" type="argumentType"/>
 29 |   <xsd:element name="class" type="classType"/>
 30 |   <xsd:element name="constant" type="constantType"/>
 31 |   <xsd:element name="description" type="xsd:string"/>
 32 |   <xsd:element name="enumeration" type="enumerationType"/>
 33 |   <xsd:element name="function" type="functionType"/>
 34 |   <xsd:element name="mxmldoc" type="mxmldocType"/>
 35 |   <xsd:element name="namespace" type="namespaceType"/>
 36 |   <xsd:element name="returnvalue" type="returnvalueType"/>
 37 |   <xsd:element name="seealso" type="identifierList"/>
 38 |   <xsd:element name="struct" type="structType"/>
 39 |   <xsd:element name="typedef" type="typedefType"/>
 40 |   <xsd:element name="type" type="xsd:string"/>
 41 |   <xsd:element name="union" type="unionType"/>
 42 |   <xsd:element name="variable" type="variableType"/>
 43 | 
 44 |   <!-- descriptions of complex elements -->
 45 |   <xsd:complexType name="argumentType">
 46 |     <xsd:sequence>
 47 |       <xsd:element ref="type" minOccurs="1" maxOccurs="1"/>
 48 |       <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
 49 |     </xsd:sequence>
 50 |     <xsd:attribute name="default" type="xsd:string" use="optional"/>
 51 |     <xsd:attribute name="name" type="identifier" use="required"/>
 52 |     <xsd:attribute name="direction" type="direction" use="optional"
 53 |      default="I"/>
 54 |   </xsd:complexType>
 55 | 
 56 |   <xsd:complexType name="classType">
 57 |     <xsd:sequence>
 58 |       <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
 59 |       <xsd:choice minOccurs="0" maxOccurs="unbounded">
 60 | 	<xsd:element ref="class"/>
 61 | 	<xsd:element ref="enumeration"/>
 62 | 	<xsd:element ref="function"/>
 63 | 	<xsd:element ref="struct"/>
 64 | 	<xsd:element ref="typedef"/>
 65 | 	<xsd:element ref="union"/>
 66 | 	<xsd:element ref="variable"/>
 67 |       </xsd:choice>
 68 |     </xsd:sequence>
 69 |     <xsd:attribute name="name" type="identifier" use="required"/>
 70 |     <xsd:attribute name="parent" type="xsd:string" use="optional"/>
 71 |   </xsd:complexType>
 72 | 
 73 |   <xsd:complexType name="constantType">
 74 |     <xsd:sequence>
 75 |       <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
 76 |     </xsd:sequence>
 77 |     <xsd:attribute name="name" type="identifier" use="required"/>
 78 |   </xsd:complexType>
 79 | 
 80 |   <xsd:complexType name="enumerationType">
 81 |     <xsd:sequence>
 82 |       <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
 83 |       <xsd:element ref="constant" minOccurs="1" maxOccurs="unbounded"/>
 84 |     </xsd:sequence>
 85 |     <xsd:attribute name="name" type="identifier" use="required"/>
 86 |   </xsd:complexType>
 87 | 
 88 |   <xsd:complexType name="functionType">
 89 |     <xsd:sequence>
 90 |       <xsd:element ref="returnvalue" minOccurs="0" maxOccurs="1"/>
 91 |       <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
 92 |       <xsd:element ref="argument" minOccurs="1" maxOccurs="unbounded"/>
 93 |       <xsd:element ref="seealso" minOccurs="0" maxOccurs="1"/>
 94 |     </xsd:sequence>
 95 |     <xsd:attribute name="name" type="identifier" use="required"/>
 96 |     <xsd:attribute name="scope" type="scope" use="optional"/>
 97 |   </xsd:complexType>
 98 | 
 99 |   <xsd:complexType name="mxmldocType">
100 |     <xsd:choice minOccurs="0" maxOccurs="unbounded">
101 |       <xsd:element ref="class"/>
102 |       <xsd:element ref="enumeration"/>
103 |       <xsd:element ref="function"/>
104 |       <xsd:element ref="namespace"/>
105 |       <xsd:element ref="struct"/>
106 |       <xsd:element ref="typedef"/>
107 |       <xsd:element ref="union"/>
108 |       <xsd:element ref="variable"/>
109 |     </xsd:choice>
110 |   </xsd:complexType>
111 | 
112 |   <xsd:complexType name="namespaceType">
113 |     <xsd:sequence>
114 |       <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
115 |       <xsd:choice minOccurs="0" maxOccurs="unbounded">
116 | 	<xsd:element ref="class"/>
117 | 	<xsd:element ref="enumeration"/>
118 | 	<xsd:element ref="function"/>
119 | 	<xsd:element ref="struct"/>
120 | 	<xsd:element ref="typedef"/>
121 | 	<xsd:element ref="union"/>
122 | 	<xsd:element ref="variable"/>
123 |       </xsd:choice>
124 |     </xsd:sequence>
125 |     <xsd:attribute name="name" type="identifier" use="required"/>
126 |   </xsd:complexType>
127 | 
128 |   <xsd:complexType name="returnvalueType">
129 |     <xsd:sequence>
130 |       <xsd:element ref="type" minOccurs="1" maxOccurs="1"/>
131 |       <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
132 |     </xsd:sequence>
133 |   </xsd:complexType>
134 | 
135 |   <xsd:complexType name="structType">
136 |     <xsd:sequence>
137 |       <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
138 |       <xsd:choice minOccurs="0" maxOccurs="unbounded">
139 | 	<xsd:element ref="variable"/>
140 | 	<xsd:element ref="function"/>
141 |       </xsd:choice>
142 |     </xsd:sequence>
143 |     <xsd:attribute name="name" type="identifier" use="required"/>
144 |   </xsd:complexType>
145 | 
146 |   <xsd:complexType name="typedefType">
147 |     <xsd:sequence>
148 |       <xsd:element ref="type" minOccurs="1" maxOccurs="1"/>
149 |       <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
150 |     </xsd:sequence>
151 |     <xsd:attribute name="name" type="identifier" use="required"/>
152 |   </xsd:complexType>
153 | 
154 |   <xsd:complexType name="unionType">
155 |     <xsd:sequence>
156 |       <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
157 |       <xsd:element ref="variable" minOccurs="0" maxOccurs="unbounded"/>
158 |     </xsd:sequence>
159 |     <xsd:attribute name="name" type="identifier" use="required"/>
160 |   </xsd:complexType>
161 | 
162 |   <xsd:complexType name="variableType">
163 |     <xsd:sequence>
164 |       <xsd:element ref="type" minOccurs="1" maxOccurs="1"/>
165 |       <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
166 |     </xsd:sequence>
167 |     <xsd:attribute name="name" type="identifier" use="required"/>
168 |   </xsd:complexType>
169 | 
170 |   <!-- data types -->
171 |   <xsd:simpleType name="direction">
172 |     <xsd:restriction base="xsd:string">
173 |       <xsd:enumeration value="I"/>
174 |       <xsd:enumeration value="O"/>
175 |       <xsd:enumeration value="IO"/>
176 |     </xsd:restriction>
177 |   </xsd:simpleType>
178 | 
179 |   <xsd:simpleType name="identifier">
180 |     <xsd:restriction base="xsd:string">
181 |       <xsd:pattern value="[a-zA-Z_(.]([a-zA-Z_(.,)* 0-9])*"/>
182 |     </xsd:restriction>
183 |   </xsd:simpleType>
184 | 
185 |   <xsd:simpleType name="identifierList">
186 |     <xsd:list itemType="identifier"/>
187 |   </xsd:simpleType>
188 | 
189 |   <xsd:simpleType name="scope">
190 |     <xsd:restriction base="xsd:string">
191 |       <xsd:enumeration value=""/>
192 |       <xsd:enumeration value="private"/>
193 |       <xsd:enumeration value="protected"/>
194 |       <xsd:enumeration value="public"/>
195 |     </xsd:restriction>
196 |   </xsd:simpleType>
197 | </xsd:schema>
198 | 
199 | 200 | 201 | 202 | -------------------------------------------------------------------------------- /doc/title.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Mini-XML Programmers Manual 5 | 6 | 7 | 8 | 9 | 10 | 11 | 19 |
12 | 13 |

Mini-XML Programmers Manual
14 | Version 2.8

15 | 16 |

MICHAEL R. SWEET

17 | 18 |
20 | 21 | 22 |

Mini-XML Programmers Manual, Version 2.7

23 | 24 |

Copyright © 2003-2014 by Michael R. Sweet

25 | 26 |

Permission is granted to copy, distribute and/or modify 27 | this document under the terms of the GNU Library General Public 28 | License, Version 2. A copy of this license is included in Appendix A - Mini-XML License.

30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /install-sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # install - install a program, script, or datafile 4 | # This comes from X11R5 (mit/util/scripts/install.sh). 5 | # 6 | # Copyright 1991 by the Massachusetts Institute of Technology 7 | # 8 | # Permission to use, copy, modify, distribute, and sell this software and its 9 | # documentation for any purpose is hereby granted without fee, provided that 10 | # the above copyright notice appear in all copies and that both that 11 | # copyright notice and this permission notice appear in supporting 12 | # documentation, and that the name of M.I.T. not be used in advertising or 13 | # publicity pertaining to distribution of the software without specific, 14 | # written prior permission. M.I.T. makes no representations about the 15 | # suitability of this software for any purpose. It is provided "as is" 16 | # without express or implied warranty. 17 | # 18 | # Calling this script install-sh is preferred over install.sh, to prevent 19 | # `make' implicit rules from creating a file called install from it 20 | # when there is no Makefile. 21 | # 22 | # This script is compatible with the BSD install script, but was written 23 | # from scratch. It can only install one file at a time, a restriction 24 | # shared with many OS's install programs. 25 | 26 | 27 | # set DOITPROG to echo to test this script 28 | 29 | # Don't use :- since 4.3BSD and earlier shells don't like it. 30 | doit="${DOITPROG-}" 31 | 32 | 33 | # put in absolute paths if you don't have them in your path; or use env. vars. 34 | 35 | mvprog="${MVPROG-mv}" 36 | cpprog="${CPPROG-cp}" 37 | chmodprog="${CHMODPROG-chmod}" 38 | chownprog="${CHOWNPROG-chown}" 39 | chgrpprog="${CHGRPPROG-chgrp}" 40 | stripprog="${STRIPPROG-strip}" 41 | rmprog="${RMPROG-rm}" 42 | mkdirprog="${MKDIRPROG-mkdir}" 43 | 44 | transformbasename="" 45 | transform_arg="" 46 | instcmd="$mvprog" 47 | chmodcmd="$chmodprog 0755" 48 | chowncmd="" 49 | chgrpcmd="" 50 | stripcmd="" 51 | rmcmd="$rmprog -f" 52 | mvcmd="$mvprog" 53 | src="" 54 | dst="" 55 | dir_arg="" 56 | 57 | while [ x"$1" != x ]; do 58 | case $1 in 59 | -c) instcmd="$cpprog" 60 | shift 61 | continue;; 62 | 63 | -d) dir_arg=true 64 | shift 65 | continue;; 66 | 67 | -m) chmodcmd="$chmodprog $2" 68 | shift 69 | shift 70 | continue;; 71 | 72 | -o) chowncmd="$chownprog $2" 73 | shift 74 | shift 75 | continue;; 76 | 77 | -g) chgrpcmd="$chgrpprog $2" 78 | shift 79 | shift 80 | continue;; 81 | 82 | -s) stripcmd="$stripprog" 83 | shift 84 | continue;; 85 | 86 | -t=*) transformarg=`echo $1 | sed 's/-t=//'` 87 | shift 88 | continue;; 89 | 90 | -b=*) transformbasename=`echo $1 | sed 's/-b=//'` 91 | shift 92 | continue;; 93 | 94 | *) if [ x"$src" = x ] 95 | then 96 | src=$1 97 | else 98 | # this colon is to work around a 386BSD /bin/sh bug 99 | : 100 | dst=$1 101 | fi 102 | shift 103 | continue;; 104 | esac 105 | done 106 | 107 | if [ x"$src" = x ] 108 | then 109 | echo "install: no input file specified" 110 | exit 1 111 | else 112 | : 113 | fi 114 | 115 | if [ x"$dir_arg" != x ]; then 116 | dst=$src 117 | src="" 118 | 119 | if [ -d $dst ]; then 120 | instcmd=: 121 | chmodcmd="" 122 | else 123 | instcmd=$mkdirprog 124 | fi 125 | else 126 | 127 | # Waiting for this to be detected by the "$instcmd $src $dsttmp" command 128 | # might cause directories to be created, which would be especially bad 129 | # if $src (and thus $dsttmp) contains '*'. 130 | 131 | if [ -f $src -o -d $src ] 132 | then 133 | : 134 | else 135 | echo "install: $src does not exist" 136 | exit 1 137 | fi 138 | 139 | if [ x"$dst" = x ] 140 | then 141 | echo "install: no destination specified" 142 | exit 1 143 | else 144 | : 145 | fi 146 | 147 | # If destination is a directory, append the input filename; if your system 148 | # does not like double slashes in filenames, you may need to add some logic 149 | 150 | if [ -d $dst ] 151 | then 152 | dst="$dst"/`basename $src` 153 | else 154 | : 155 | fi 156 | fi 157 | 158 | ## this sed command emulates the dirname command 159 | dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` 160 | 161 | # Make sure that the destination directory exists. 162 | # this part is taken from Noah Friedman's mkinstalldirs script 163 | 164 | # Skip lots of stat calls in the usual case. 165 | if [ ! -d "$dstdir" ]; then 166 | defaultIFS=' 167 | ' 168 | IFS="${IFS-${defaultIFS}}" 169 | 170 | oIFS="${IFS}" 171 | # Some sh's can't handle IFS=/ for some reason. 172 | IFS='%' 173 | set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` 174 | IFS="${oIFS}" 175 | 176 | pathcomp='' 177 | 178 | while [ $# -ne 0 ] ; do 179 | pathcomp="${pathcomp}${1}" 180 | shift 181 | 182 | if [ ! -d "${pathcomp}" ] ; 183 | then 184 | $mkdirprog "${pathcomp}" 185 | else 186 | : 187 | fi 188 | 189 | pathcomp="${pathcomp}/" 190 | done 191 | fi 192 | 193 | if [ x"$dir_arg" != x ] 194 | then 195 | $doit $instcmd $dst && 196 | 197 | if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && 198 | if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && 199 | if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && 200 | if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi 201 | else 202 | 203 | # If we're going to rename the final executable, determine the name now. 204 | 205 | if [ x"$transformarg" = x ] 206 | then 207 | dstfile=`basename $dst` 208 | else 209 | dstfile=`basename $dst $transformbasename | 210 | sed $transformarg`$transformbasename 211 | fi 212 | 213 | # don't allow the sed command to completely eliminate the filename 214 | 215 | if [ x"$dstfile" = x ] 216 | then 217 | dstfile=`basename $dst` 218 | else 219 | : 220 | fi 221 | 222 | # Make a temp file name in the proper directory. 223 | 224 | dsttmp=$dstdir/#inst.$$# 225 | 226 | # Move or copy the file name to the temp name 227 | 228 | $doit $instcmd $src $dsttmp && 229 | 230 | trap "rm -f ${dsttmp}" 0 && 231 | 232 | # and set any options; do chmod last to preserve setuid bits 233 | 234 | # If any of these fail, we abort the whole thing. If we want to 235 | # ignore errors from any of these, just make sure not to ignore 236 | # errors from the above "$doit $instcmd $src $dsttmp" command. 237 | 238 | if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi && 239 | if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && 240 | if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && 241 | if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi && 242 | 243 | # Now rename the file to the real destination. 244 | 245 | $doit $rmcmd -f $dstdir/$dstfile && 246 | $doit $mvcmd $dsttmp $dstdir/$dstfile 247 | 248 | fi && 249 | 250 | 251 | exit 0 252 | -------------------------------------------------------------------------------- /makesrcdist: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # "$Id$" 4 | # 5 | # makesrcdist - make a source distribution of mxml. 6 | # 7 | 8 | echo "Getting distribution..." 9 | 10 | if test $# = 0; then 11 | echo -n "Version number for distribution? " 12 | read version 13 | else 14 | version=$1 15 | fi 16 | 17 | cd /tmp 18 | 19 | if test $version = snapshot; then 20 | url="https://svn.msweet.org/mxml/trunk" 21 | else 22 | url="svn+ssh://msweet.org/var/svn/mxml/tags/release-$version" 23 | 24 | svn copy svn+ssh://msweet.org/var/svn/mxml/trunk "$url" \ 25 | -m "Tag $version" || exit 1 26 | fi 27 | 28 | rm -rf mxml-$version 29 | svn export $url mxml-$version 30 | cd mxml-$version 31 | 32 | echo "Removing Subversion files and directories..." 33 | 34 | rm -f makesrcdist TODO mvalidate.c 35 | rm -rf www 36 | rm -rf doc/mxml-cover* doc/hires 37 | cd .. 38 | 39 | echo "Making .tar.gz distribution..." 40 | 41 | tar czf mxml-$version.tar.gz mxml-$version 42 | 43 | echo "Removing distribution directory..." 44 | 45 | rm -rf mxml-$version 46 | 47 | echo "Done!" 48 | 49 | # 50 | # End of "$Id$". 51 | # 52 | -------------------------------------------------------------------------------- /mvalidate.c: -------------------------------------------------------------------------------- 1 | /* 2 | * "$Id$" 3 | * 4 | * XML Schema validation program for Mini-XML, a small XML-like file 5 | * parsing library. 6 | * 7 | * Copyright 2003-2014 by Michael R Sweet. 8 | * 9 | * These coded instructions, statements, and computer programs are the 10 | * property of Michael R Sweet and are protected by Federal copyright 11 | * law. Distribution and use rights are outlined in the file "COPYING" 12 | * which should have been included with this file. If this file is 13 | * missing or damaged, see the license at: 14 | * 15 | * http://www.msweet.org/projects.php/Mini-XML 16 | */ 17 | 18 | /* 19 | * Include necessary headers... 20 | */ 21 | 22 | #include "config.h" 23 | #include "mxml.h" 24 | 25 | 26 | /* 27 | * 'main()' - Main entry for schema validation program. 28 | */ 29 | 30 | int /* O - Exit status */ 31 | main(int argc, /* I - Number of command-line args */ 32 | char *argv[]) /* I - Command-line args */ 33 | { 34 | return (0); 35 | } 36 | 37 | 38 | /* 39 | * End of "$Id$". 40 | */ 41 | -------------------------------------------------------------------------------- /mxml-attr.c: -------------------------------------------------------------------------------- 1 | /* 2 | * "$Id$" 3 | * 4 | * Attribute support code for Mini-XML, a small XML-like file parsing library. 5 | * 6 | * Copyright 2003-2014 by Michael R Sweet. 7 | * 8 | * These coded instructions, statements, and computer programs are the 9 | * property of Michael R Sweet and are protected by Federal copyright 10 | * law. Distribution and use rights are outlined in the file "COPYING" 11 | * which should have been included with this file. If this file is 12 | * missing or damaged, see the license at: 13 | * 14 | * http://www.msweet.org/projects.php/Mini-XML 15 | */ 16 | 17 | /* 18 | * Include necessary headers... 19 | */ 20 | 21 | #include "config.h" 22 | #include "mxml.h" 23 | 24 | 25 | /* 26 | * Local functions... 27 | */ 28 | 29 | static int mxml_set_attr(mxml_node_t *node, const char *name, 30 | char *value); 31 | 32 | 33 | /* 34 | * 'mxmlElementDeleteAttr()' - Delete an attribute. 35 | * 36 | * @since Mini-XML 2.4@ 37 | */ 38 | 39 | void 40 | mxmlElementDeleteAttr(mxml_node_t *node,/* I - Element */ 41 | const char *name)/* I - Attribute name */ 42 | { 43 | int i; /* Looping var */ 44 | mxml_attr_t *attr; /* Cirrent attribute */ 45 | 46 | 47 | #ifdef DEBUG 48 | fprintf(stderr, "mxmlElementDeleteAttr(node=%p, name=\"%s\")\n", 49 | node, name ? name : "(null)"); 50 | #endif /* DEBUG */ 51 | 52 | /* 53 | * Range check input... 54 | */ 55 | 56 | if (!node || node->type != MXML_ELEMENT || !name) 57 | return; 58 | 59 | /* 60 | * Look for the attribute... 61 | */ 62 | 63 | for (i = node->value.element.num_attrs, attr = node->value.element.attrs; 64 | i > 0; 65 | i --, attr ++) 66 | { 67 | #ifdef DEBUG 68 | printf(" %s=\"%s\"\n", attr->name, attr->value); 69 | #endif /* DEBUG */ 70 | 71 | if (!strcmp(attr->name, name)) 72 | { 73 | /* 74 | * Delete this attribute... 75 | */ 76 | 77 | free(attr->name); 78 | free(attr->value); 79 | 80 | i --; 81 | if (i > 0) 82 | memmove(attr, attr + 1, i * sizeof(mxml_attr_t)); 83 | 84 | node->value.element.num_attrs --; 85 | 86 | if (node->value.element.num_attrs == 0) 87 | free(node->value.element.attrs); 88 | return; 89 | } 90 | } 91 | } 92 | 93 | 94 | /* 95 | * 'mxmlElementGetAttr()' - Get an attribute. 96 | * 97 | * This function returns NULL if the node is not an element or the 98 | * named attribute does not exist. 99 | */ 100 | 101 | const char * /* O - Attribute value or NULL */ 102 | mxmlElementGetAttr(mxml_node_t *node, /* I - Element node */ 103 | const char *name) /* I - Name of attribute */ 104 | { 105 | int i; /* Looping var */ 106 | mxml_attr_t *attr; /* Cirrent attribute */ 107 | 108 | 109 | #ifdef DEBUG 110 | fprintf(stderr, "mxmlElementGetAttr(node=%p, name=\"%s\")\n", 111 | node, name ? name : "(null)"); 112 | #endif /* DEBUG */ 113 | 114 | /* 115 | * Range check input... 116 | */ 117 | 118 | if (!node || node->type != MXML_ELEMENT || !name) 119 | return (NULL); 120 | 121 | /* 122 | * Look for the attribute... 123 | */ 124 | 125 | for (i = node->value.element.num_attrs, attr = node->value.element.attrs; 126 | i > 0; 127 | i --, attr ++) 128 | { 129 | #ifdef DEBUG 130 | printf(" %s=\"%s\"\n", attr->name, attr->value); 131 | #endif /* DEBUG */ 132 | 133 | if (!strcmp(attr->name, name)) 134 | { 135 | #ifdef DEBUG 136 | printf(" Returning \"%s\"!\n", attr->value); 137 | #endif /* DEBUG */ 138 | return (attr->value); 139 | } 140 | } 141 | 142 | /* 143 | * Didn't find attribute, so return NULL... 144 | */ 145 | 146 | #ifdef DEBUG 147 | puts(" Returning NULL!\n"); 148 | #endif /* DEBUG */ 149 | 150 | return (NULL); 151 | } 152 | 153 | 154 | /* 155 | * 'mxmlElementSetAttr()' - Set an attribute. 156 | * 157 | * If the named attribute already exists, the value of the attribute 158 | * is replaced by the new string value. The string value is copied 159 | * into the element node. This function does nothing if the node is 160 | * not an element. 161 | */ 162 | 163 | void 164 | mxmlElementSetAttr(mxml_node_t *node, /* I - Element node */ 165 | const char *name, /* I - Name of attribute */ 166 | const char *value) /* I - Attribute value */ 167 | { 168 | char *valuec; /* Copy of value */ 169 | 170 | 171 | #ifdef DEBUG 172 | fprintf(stderr, "mxmlElementSetAttr(node=%p, name=\"%s\", value=\"%s\")\n", 173 | node, name ? name : "(null)", value ? value : "(null)"); 174 | #endif /* DEBUG */ 175 | 176 | /* 177 | * Range check input... 178 | */ 179 | 180 | if (!node || node->type != MXML_ELEMENT || !name) 181 | return; 182 | 183 | if (value) 184 | valuec = strdup(value); 185 | else 186 | valuec = NULL; 187 | 188 | if (mxml_set_attr(node, name, valuec)) 189 | free(valuec); 190 | } 191 | 192 | 193 | /* 194 | * 'mxmlElementSetAttrf()' - Set an attribute with a formatted value. 195 | * 196 | * If the named attribute already exists, the value of the attribute 197 | * is replaced by the new formatted string. The formatted string value is 198 | * copied into the element node. This function does nothing if the node 199 | * is not an element. 200 | * 201 | * @since Mini-XML 2.3@ 202 | */ 203 | 204 | void 205 | mxmlElementSetAttrf(mxml_node_t *node, /* I - Element node */ 206 | const char *name, /* I - Name of attribute */ 207 | const char *format,/* I - Printf-style attribute value */ 208 | ...) /* I - Additional arguments as needed */ 209 | { 210 | va_list ap; /* Argument pointer */ 211 | char *value; /* Value */ 212 | 213 | 214 | #ifdef DEBUG 215 | fprintf(stderr, 216 | "mxmlElementSetAttrf(node=%p, name=\"%s\", format=\"%s\", ...)\n", 217 | node, name ? name : "(null)", format ? format : "(null)"); 218 | #endif /* DEBUG */ 219 | 220 | /* 221 | * Range check input... 222 | */ 223 | 224 | if (!node || node->type != MXML_ELEMENT || !name || !format) 225 | return; 226 | 227 | /* 228 | * Format the value... 229 | */ 230 | 231 | va_start(ap, format); 232 | value = _mxml_vstrdupf(format, ap); 233 | va_end(ap); 234 | 235 | if (!value) 236 | mxml_error("Unable to allocate memory for attribute '%s' in element %s!", 237 | name, node->value.element.name); 238 | else if (mxml_set_attr(node, name, value)) 239 | free(value); 240 | } 241 | 242 | 243 | /* 244 | * 'mxml_set_attr()' - Set or add an attribute name/value pair. 245 | */ 246 | 247 | static int /* O - 0 on success, -1 on failure */ 248 | mxml_set_attr(mxml_node_t *node, /* I - Element node */ 249 | const char *name, /* I - Attribute name */ 250 | char *value) /* I - Attribute value */ 251 | { 252 | int i; /* Looping var */ 253 | mxml_attr_t *attr; /* New attribute */ 254 | 255 | 256 | /* 257 | * Look for the attribute... 258 | */ 259 | 260 | for (i = node->value.element.num_attrs, attr = node->value.element.attrs; 261 | i > 0; 262 | i --, attr ++) 263 | if (!strcmp(attr->name, name)) 264 | { 265 | /* 266 | * Free the old value as needed... 267 | */ 268 | 269 | if (attr->value) 270 | free(attr->value); 271 | 272 | attr->value = value; 273 | 274 | return (0); 275 | } 276 | 277 | /* 278 | * Add a new attribute... 279 | */ 280 | 281 | if (node->value.element.num_attrs == 0) 282 | attr = malloc(sizeof(mxml_attr_t)); 283 | else 284 | attr = realloc(node->value.element.attrs, 285 | (node->value.element.num_attrs + 1) * sizeof(mxml_attr_t)); 286 | 287 | if (!attr) 288 | { 289 | mxml_error("Unable to allocate memory for attribute '%s' in element %s!", 290 | name, node->value.element.name); 291 | return (-1); 292 | } 293 | 294 | node->value.element.attrs = attr; 295 | attr += node->value.element.num_attrs; 296 | 297 | if ((attr->name = strdup(name)) == NULL) 298 | { 299 | mxml_error("Unable to allocate memory for attribute '%s' in element %s!", 300 | name, node->value.element.name); 301 | return (-1); 302 | } 303 | 304 | attr->value = value; 305 | 306 | node->value.element.num_attrs ++; 307 | 308 | return (0); 309 | } 310 | 311 | 312 | /* 313 | * End of "$Id$". 314 | */ 315 | -------------------------------------------------------------------------------- /mxml-private.c: -------------------------------------------------------------------------------- 1 | /* 2 | * "$Id$" 3 | * 4 | * Private functions for Mini-XML, a small XML-like file parsing library. 5 | * 6 | * Copyright 2003-2014 by Michael R Sweet. 7 | * 8 | * These coded instructions, statements, and computer programs are the 9 | * property of Michael R Sweet and are protected by Federal copyright 10 | * law. Distribution and use rights are outlined in the file "COPYING" 11 | * which should have been included with this file. If this file is 12 | * missing or damaged, see the license at: 13 | * 14 | * http://www.msweet.org/projects.php/Mini-XML 15 | */ 16 | 17 | /* 18 | * Include necessary headers... 19 | */ 20 | 21 | #include "mxml-private.h" 22 | 23 | 24 | /* 25 | * Some crazy people think that unloading a shared object is a good or safe 26 | * thing to do. Unfortunately, most objects are simply *not* safe to unload 27 | * and bad things *will* happen. 28 | * 29 | * The following mess of conditional code allows us to provide a destructor 30 | * function in Mini-XML for our thread-global storage so that it can possibly 31 | * be unloaded safely, although since there is no standard way to do so I 32 | * can't even provide any guarantees that you can do it safely on all platforms. 33 | * 34 | * This code currently supports AIX, HP-UX, Linux, Mac OS X, Solaris, and 35 | * Windows. It might work on the BSDs and IRIX, but I haven't tested that. 36 | */ 37 | 38 | #if defined(__sun) || defined(_AIX) 39 | # pragma fini(_mxml_fini) 40 | # define _MXML_FINI _mxml_fini 41 | #elif defined(__hpux) 42 | # pragma FINI _mxml_fini 43 | # define _MXML_FINI _mxml_fini 44 | #elif defined(__GNUC__) /* Linux and Mac OS X */ 45 | # define _MXML_FINI __attribute((destructor)) _mxml_fini 46 | #else 47 | # define _MXML_FINI _fini 48 | #endif /* __sun */ 49 | 50 | 51 | /* 52 | * 'mxml_error()' - Display an error message. 53 | */ 54 | 55 | void 56 | mxml_error(const char *format, /* I - Printf-style format string */ 57 | ...) /* I - Additional arguments as needed */ 58 | { 59 | va_list ap; /* Pointer to arguments */ 60 | char s[1024]; /* Message string */ 61 | _mxml_global_t *global = _mxml_global(); 62 | /* Global data */ 63 | 64 | 65 | /* 66 | * Range check input... 67 | */ 68 | 69 | if (!format) 70 | return; 71 | 72 | /* 73 | * Format the error message string... 74 | */ 75 | 76 | va_start(ap, format); 77 | 78 | vsnprintf(s, sizeof(s), format, ap); 79 | 80 | va_end(ap); 81 | 82 | /* 83 | * And then display the error message... 84 | */ 85 | 86 | if (global->error_cb) 87 | (*global->error_cb)(s); 88 | else 89 | fprintf(stderr, "mxml: %s\n", s); 90 | } 91 | 92 | 93 | /* 94 | * 'mxml_ignore_cb()' - Default callback for ignored values. 95 | */ 96 | 97 | mxml_type_t /* O - Node type */ 98 | mxml_ignore_cb(mxml_node_t *node) /* I - Current node */ 99 | { 100 | (void)node; 101 | 102 | return (MXML_IGNORE); 103 | } 104 | 105 | 106 | /* 107 | * 'mxml_integer_cb()' - Default callback for integer values. 108 | */ 109 | 110 | mxml_type_t /* O - Node type */ 111 | mxml_integer_cb(mxml_node_t *node) /* I - Current node */ 112 | { 113 | (void)node; 114 | 115 | return (MXML_INTEGER); 116 | } 117 | 118 | 119 | /* 120 | * 'mxml_opaque_cb()' - Default callback for opaque values. 121 | */ 122 | 123 | mxml_type_t /* O - Node type */ 124 | mxml_opaque_cb(mxml_node_t *node) /* I - Current node */ 125 | { 126 | (void)node; 127 | 128 | return (MXML_OPAQUE); 129 | } 130 | 131 | 132 | /* 133 | * 'mxml_real_cb()' - Default callback for real number values. 134 | */ 135 | 136 | mxml_type_t /* O - Node type */ 137 | mxml_real_cb(mxml_node_t *node) /* I - Current node */ 138 | { 139 | (void)node; 140 | 141 | return (MXML_REAL); 142 | } 143 | 144 | 145 | #ifdef HAVE_PTHREAD_H /**** POSIX threading ****/ 146 | # include 147 | 148 | static pthread_key_t _mxml_key = -1; /* Thread local storage key */ 149 | static pthread_once_t _mxml_key_once = PTHREAD_ONCE_INIT; 150 | /* One-time initialization object */ 151 | static void _mxml_init(void); 152 | static void _mxml_destructor(void *g); 153 | 154 | 155 | /* 156 | * '_mxml_destructor()' - Free memory used for globals... 157 | */ 158 | 159 | static void 160 | _mxml_destructor(void *g) /* I - Global data */ 161 | { 162 | free(g); 163 | } 164 | 165 | 166 | /* 167 | * '_mxml_fini()' - Clean up when unloaded. 168 | */ 169 | 170 | static void 171 | _MXML_FINI(void) 172 | { 173 | _mxml_global_t *global; /* Global data */ 174 | 175 | 176 | if (_mxml_key != -1) 177 | { 178 | if ((global = (_mxml_global_t *)pthread_getspecific(_mxml_key)) != NULL) 179 | _mxml_destructor(global); 180 | 181 | pthread_key_delete(_mxml_key); 182 | _mxml_key = -1; 183 | } 184 | } 185 | 186 | 187 | /* 188 | * '_mxml_global()' - Get global data. 189 | */ 190 | 191 | _mxml_global_t * /* O - Global data */ 192 | _mxml_global(void) 193 | { 194 | _mxml_global_t *global; /* Global data */ 195 | 196 | 197 | pthread_once(&_mxml_key_once, _mxml_init); 198 | 199 | if ((global = (_mxml_global_t *)pthread_getspecific(_mxml_key)) == NULL) 200 | { 201 | global = (_mxml_global_t *)calloc(1, sizeof(_mxml_global_t)); 202 | pthread_setspecific(_mxml_key, global); 203 | 204 | global->num_entity_cbs = 1; 205 | global->entity_cbs[0] = _mxml_entity_cb; 206 | global->wrap = 72; 207 | } 208 | 209 | return (global); 210 | } 211 | 212 | 213 | /* 214 | * '_mxml_init()' - Initialize global data... 215 | */ 216 | 217 | static void 218 | _mxml_init(void) 219 | { 220 | pthread_key_create(&_mxml_key, _mxml_destructor); 221 | } 222 | 223 | 224 | #elif defined(WIN32) && defined(MXML1_EXPORTS) /**** WIN32 threading ****/ 225 | # include 226 | 227 | static DWORD _mxml_tls_index; /* Index for global storage */ 228 | 229 | 230 | /* 231 | * 'DllMain()' - Main entry for library. 232 | */ 233 | 234 | BOOL WINAPI /* O - Success/failure */ 235 | DllMain(HINSTANCE hinst, /* I - DLL module handle */ 236 | DWORD reason, /* I - Reason */ 237 | LPVOID reserved) /* I - Unused */ 238 | { 239 | _mxml_global_t *global; /* Global data */ 240 | 241 | 242 | (void)hinst; 243 | (void)reserved; 244 | 245 | switch (reason) 246 | { 247 | case DLL_PROCESS_ATTACH : /* Called on library initialization */ 248 | if ((_mxml_tls_index = TlsAlloc()) == TLS_OUT_OF_INDEXES) 249 | return (FALSE); 250 | break; 251 | 252 | case DLL_THREAD_DETACH : /* Called when a thread terminates */ 253 | if ((global = (_mxml_global_t *)TlsGetValue(_mxml_tls_index)) != NULL) 254 | free(global); 255 | break; 256 | 257 | case DLL_PROCESS_DETACH : /* Called when library is unloaded */ 258 | if ((global = (_mxml_global_t *)TlsGetValue(_mxml_tls_index)) != NULL) 259 | free(global); 260 | 261 | TlsFree(_mxml_tls_index); 262 | break; 263 | 264 | default: 265 | break; 266 | } 267 | 268 | return (TRUE); 269 | } 270 | 271 | 272 | /* 273 | * '_mxml_global()' - Get global data. 274 | */ 275 | 276 | _mxml_global_t * /* O - Global data */ 277 | _mxml_global(void) 278 | { 279 | _mxml_global_t *global; /* Global data */ 280 | 281 | 282 | if ((global = (_mxml_global_t *)TlsGetValue(_mxml_tls_index)) == NULL) 283 | { 284 | global = (_mxml_global_t *)calloc(1, sizeof(_mxml_global_t)); 285 | 286 | global->num_entity_cbs = 1; 287 | global->entity_cbs[0] = _mxml_entity_cb; 288 | global->wrap = 72; 289 | 290 | TlsSetValue(_mxml_tls_index, (LPVOID)global); 291 | } 292 | 293 | return (global); 294 | } 295 | 296 | 297 | #else /**** No threading ****/ 298 | /* 299 | * '_mxml_global()' - Get global data. 300 | */ 301 | 302 | _mxml_global_t * /* O - Global data */ 303 | _mxml_global(void) 304 | { 305 | static _mxml_global_t global = /* Global data */ 306 | { 307 | NULL, /* error_cb */ 308 | 1, /* num_entity_cbs */ 309 | { _mxml_entity_cb }, /* entity_cbs */ 310 | 72, /* wrap */ 311 | NULL, /* custom_load_cb */ 312 | NULL /* custom_save_cb */ 313 | }; 314 | 315 | 316 | return (&global); 317 | } 318 | #endif /* HAVE_PTHREAD_H */ 319 | 320 | 321 | /* 322 | * End of "$Id$". 323 | */ 324 | -------------------------------------------------------------------------------- /mxml-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * "$Id$" 3 | * 4 | * Private definitions for Mini-XML, a small XML-like file parsing library. 5 | * 6 | * Copyright 2003-2014 by Michael R Sweet. 7 | * 8 | * These coded instructions, statements, and computer programs are the 9 | * property of Michael R Sweet and are protected by Federal copyright 10 | * law. Distribution and use rights are outlined in the file "COPYING" 11 | * which should have been included with this file. If this file is 12 | * missing or damaged, see the license at: 13 | * 14 | * http://www.msweet.org/projects.php/Mini-XML 15 | */ 16 | 17 | /* 18 | * Include necessary headers... 19 | */ 20 | 21 | #include "config.h" 22 | #include "mxml.h" 23 | 24 | 25 | /* 26 | * Global, per-thread data... 27 | */ 28 | 29 | typedef struct _mxml_global_s 30 | { 31 | void (*error_cb)(const char *); 32 | int num_entity_cbs; 33 | int (*entity_cbs[100])(const char *name); 34 | int wrap; 35 | mxml_custom_load_cb_t custom_load_cb; 36 | mxml_custom_save_cb_t custom_save_cb; 37 | } _mxml_global_t; 38 | 39 | 40 | /* 41 | * Functions... 42 | */ 43 | 44 | extern _mxml_global_t *_mxml_global(void); 45 | extern int _mxml_entity_cb(const char *name); 46 | 47 | 48 | /* 49 | * End of "$Id$". 50 | */ 51 | -------------------------------------------------------------------------------- /mxml-search.c: -------------------------------------------------------------------------------- 1 | /* 2 | * "$Id$" 3 | * 4 | * Search/navigation functions for Mini-XML, a small XML-like file 5 | * parsing library. 6 | * 7 | * Copyright 2003-2014 by Michael R Sweet. 8 | * 9 | * These coded instructions, statements, and computer programs are the 10 | * property of Michael R Sweet and are protected by Federal copyright 11 | * law. Distribution and use rights are outlined in the file "COPYING" 12 | * which should have been included with this file. If this file is 13 | * missing or damaged, see the license at: 14 | * 15 | * http://www.msweet.org/projects.php/Mini-XML 16 | */ 17 | 18 | /* 19 | * Include necessary headers... 20 | */ 21 | 22 | #include "config.h" 23 | #include "mxml.h" 24 | 25 | 26 | /* 27 | * 'mxmlFindElement()' - Find the named element. 28 | * 29 | * The search is constrained by the name, attribute name, and value; any 30 | * NULL names or values are treated as wildcards, so different kinds of 31 | * searches can be implemented by looking for all elements of a given name 32 | * or all elements with a specific attribute. The descend argument determines 33 | * whether the search descends into child nodes; normally you will use 34 | * MXML_DESCEND_FIRST for the initial search and MXML_NO_DESCEND to find 35 | * additional direct descendents of the node. The top node argument 36 | * constrains the search to a particular node's children. 37 | */ 38 | 39 | mxml_node_t * /* O - Element node or NULL */ 40 | mxmlFindElement(mxml_node_t *node, /* I - Current node */ 41 | mxml_node_t *top, /* I - Top node */ 42 | const char *name, /* I - Element name or NULL for any */ 43 | const char *attr, /* I - Attribute name, or NULL for none */ 44 | const char *value, /* I - Attribute value, or NULL for any */ 45 | int descend) /* I - Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST */ 46 | { 47 | const char *temp; /* Current attribute value */ 48 | 49 | 50 | /* 51 | * Range check input... 52 | */ 53 | 54 | if (!node || !top || (!attr && value)) 55 | return (NULL); 56 | 57 | /* 58 | * Start with the next node... 59 | */ 60 | 61 | node = mxmlWalkNext(node, top, descend); 62 | 63 | /* 64 | * Loop until we find a matching element... 65 | */ 66 | 67 | while (node != NULL) 68 | { 69 | /* 70 | * See if this node matches... 71 | */ 72 | 73 | if (node->type == MXML_ELEMENT && 74 | node->value.element.name && 75 | (!name || !strcmp(node->value.element.name, name))) 76 | { 77 | /* 78 | * See if we need to check for an attribute... 79 | */ 80 | 81 | if (!attr) 82 | return (node); /* No attribute search, return it... */ 83 | 84 | /* 85 | * Check for the attribute... 86 | */ 87 | 88 | if ((temp = mxmlElementGetAttr(node, attr)) != NULL) 89 | { 90 | /* 91 | * OK, we have the attribute, does it match? 92 | */ 93 | 94 | if (!value || !strcmp(value, temp)) 95 | return (node); /* Yes, return it... */ 96 | } 97 | } 98 | 99 | /* 100 | * No match, move on to the next node... 101 | */ 102 | 103 | if (descend == MXML_DESCEND) 104 | node = mxmlWalkNext(node, top, MXML_DESCEND); 105 | else 106 | node = node->next; 107 | } 108 | 109 | return (NULL); 110 | } 111 | 112 | 113 | /* 114 | * 'mxmlFindPath()' - Find a node with the given path. 115 | * 116 | * The "path" is a slash-separated list of element names. The name "*" is 117 | * considered a wildcard for one or more levels of elements. For example, 118 | * "foo/one/two", "bar/two/one", "*\/one", and so forth. 119 | * 120 | * The first child node of the found node is returned if the given node has 121 | * children and the first child is a value node. 122 | * 123 | * @since Mini-XML 2.7@ 124 | */ 125 | 126 | mxml_node_t * /* O - Found node or NULL */ 127 | mxmlFindPath(mxml_node_t *top, /* I - Top node */ 128 | const char *path) /* I - Path to element */ 129 | { 130 | mxml_node_t *node; /* Current node */ 131 | char element[256]; /* Current element name */ 132 | const char *pathsep; /* Separator in path */ 133 | int descend; /* mxmlFindElement option */ 134 | 135 | 136 | /* 137 | * Range check input... 138 | */ 139 | 140 | if (!top || !path || !*path) 141 | return (NULL); 142 | 143 | /* 144 | * Search each element in the path... 145 | */ 146 | 147 | node = top; 148 | while (*path) 149 | { 150 | /* 151 | * Handle wildcards... 152 | */ 153 | 154 | if (!strncmp(path, "*/", 2)) 155 | { 156 | path += 2; 157 | descend = MXML_DESCEND; 158 | } 159 | else 160 | descend = MXML_DESCEND_FIRST; 161 | 162 | /* 163 | * Get the next element in the path... 164 | */ 165 | 166 | if ((pathsep = strchr(path, '/')) == NULL) 167 | pathsep = path + strlen(path); 168 | 169 | if (pathsep == path || (pathsep - path) >= sizeof(element)) 170 | return (NULL); 171 | 172 | memcpy(element, path, pathsep - path); 173 | element[pathsep - path] = '\0'; 174 | 175 | if (*pathsep) 176 | path = pathsep + 1; 177 | else 178 | path = pathsep; 179 | 180 | /* 181 | * Search for the element... 182 | */ 183 | 184 | if ((node = mxmlFindElement(node, node, element, NULL, NULL, 185 | descend)) == NULL) 186 | return (NULL); 187 | } 188 | 189 | /* 190 | * If we get this far, return the node or its first child... 191 | */ 192 | 193 | if (node->child && node->child->type != MXML_ELEMENT) 194 | return (node->child); 195 | else 196 | return (node); 197 | } 198 | 199 | 200 | /* 201 | * 'mxmlWalkNext()' - Walk to the next logical node in the tree. 202 | * 203 | * The descend argument controls whether the first child is considered 204 | * to be the next node. The top node argument constrains the walk to 205 | * the node's children. 206 | */ 207 | 208 | mxml_node_t * /* O - Next node or NULL */ 209 | mxmlWalkNext(mxml_node_t *node, /* I - Current node */ 210 | mxml_node_t *top, /* I - Top node */ 211 | int descend) /* I - Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST */ 212 | { 213 | if (!node) 214 | return (NULL); 215 | else if (node->child && descend) 216 | return (node->child); 217 | else if (node == top) 218 | return (NULL); 219 | else if (node->next) 220 | return (node->next); 221 | else if (node->parent && node->parent != top) 222 | { 223 | node = node->parent; 224 | 225 | while (!node->next) 226 | if (node->parent == top || !node->parent) 227 | return (NULL); 228 | else 229 | node = node->parent; 230 | 231 | return (node->next); 232 | } 233 | else 234 | return (NULL); 235 | } 236 | 237 | 238 | /* 239 | * 'mxmlWalkPrev()' - Walk to the previous logical node in the tree. 240 | * 241 | * The descend argument controls whether the previous node's last child 242 | * is considered to be the previous node. The top node argument constrains 243 | * the walk to the node's children. 244 | */ 245 | 246 | mxml_node_t * /* O - Previous node or NULL */ 247 | mxmlWalkPrev(mxml_node_t *node, /* I - Current node */ 248 | mxml_node_t *top, /* I - Top node */ 249 | int descend) /* I - Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST */ 250 | { 251 | if (!node || node == top) 252 | return (NULL); 253 | else if (node->prev) 254 | { 255 | if (node->prev->last_child && descend) 256 | { 257 | /* 258 | * Find the last child under the previous node... 259 | */ 260 | 261 | node = node->prev->last_child; 262 | 263 | while (node->last_child) 264 | node = node->last_child; 265 | 266 | return (node); 267 | } 268 | else 269 | return (node->prev); 270 | } 271 | else if (node->parent != top) 272 | return (node->parent); 273 | else 274 | return (NULL); 275 | } 276 | 277 | 278 | /* 279 | * End of "$Id$". 280 | */ 281 | -------------------------------------------------------------------------------- /mxml-set.c: -------------------------------------------------------------------------------- 1 | /* 2 | * "$Id$" 3 | * 4 | * Node set functions for Mini-XML, a small XML-like file parsing library. 5 | * 6 | * Copyright 2003-2014 by Michael R Sweet. 7 | * 8 | * These coded instructions, statements, and computer programs are the 9 | * property of Michael R Sweet and are protected by Federal copyright 10 | * law. Distribution and use rights are outlined in the file "COPYING" 11 | * which should have been included with this file. If this file is 12 | * missing or damaged, see the license at: 13 | * 14 | * http://www.msweet.org/projects.php/Mini-XML 15 | */ 16 | 17 | /* 18 | * Include necessary headers... 19 | */ 20 | 21 | #include "config.h" 22 | #include "mxml.h" 23 | 24 | 25 | /* 26 | * 'mxmlSetCDATA()' - Set the element name of a CDATA node. 27 | * 28 | * The node is not changed if it (or its first child) is not a CDATA element node. 29 | * 30 | * @since Mini-XML 2.3@ 31 | */ 32 | 33 | int /* O - 0 on success, -1 on failure */ 34 | mxmlSetCDATA(mxml_node_t *node, /* I - Node to set */ 35 | const char *data) /* I - New data string */ 36 | { 37 | /* 38 | * Range check input... 39 | */ 40 | 41 | if (node && node->type == MXML_ELEMENT && 42 | strncmp(node->value.element.name, "![CDATA[", 8) && 43 | node->child && node->child->type == MXML_ELEMENT && 44 | !strncmp(node->child->value.element.name, "![CDATA[", 8)) 45 | node = node->child; 46 | 47 | if (!node || node->type != MXML_ELEMENT || !data || 48 | strncmp(node->value.element.name, "![CDATA[", 8)) 49 | return (-1); 50 | 51 | /* 52 | * Free any old element value and set the new value... 53 | */ 54 | 55 | if (node->value.element.name) 56 | free(node->value.element.name); 57 | 58 | node->value.element.name = _mxml_strdupf("![CDATA[%s]]", data); 59 | 60 | return (0); 61 | } 62 | 63 | 64 | /* 65 | * 'mxmlSetCustom()' - Set the data and destructor of a custom data node. 66 | * 67 | * The node is not changed if it (or its first child) is not a custom node. 68 | * 69 | * @since Mini-XML 2.1@ 70 | */ 71 | 72 | int /* O - 0 on success, -1 on failure */ 73 | mxmlSetCustom( 74 | mxml_node_t *node, /* I - Node to set */ 75 | void *data, /* I - New data pointer */ 76 | mxml_custom_destroy_cb_t destroy) /* I - New destructor function */ 77 | { 78 | /* 79 | * Range check input... 80 | */ 81 | 82 | if (node && node->type == MXML_ELEMENT && 83 | node->child && node->child->type == MXML_CUSTOM) 84 | node = node->child; 85 | 86 | if (!node || node->type != MXML_CUSTOM) 87 | return (-1); 88 | 89 | /* 90 | * Free any old element value and set the new value... 91 | */ 92 | 93 | if (node->value.custom.data && node->value.custom.destroy) 94 | (*(node->value.custom.destroy))(node->value.custom.data); 95 | 96 | node->value.custom.data = data; 97 | node->value.custom.destroy = destroy; 98 | 99 | return (0); 100 | } 101 | 102 | 103 | /* 104 | * 'mxmlSetElement()' - Set the name of an element node. 105 | * 106 | * The node is not changed if it is not an element node. 107 | */ 108 | 109 | int /* O - 0 on success, -1 on failure */ 110 | mxmlSetElement(mxml_node_t *node, /* I - Node to set */ 111 | const char *name) /* I - New name string */ 112 | { 113 | /* 114 | * Range check input... 115 | */ 116 | 117 | if (!node || node->type != MXML_ELEMENT || !name) 118 | return (-1); 119 | 120 | /* 121 | * Free any old element value and set the new value... 122 | */ 123 | 124 | if (node->value.element.name) 125 | free(node->value.element.name); 126 | 127 | node->value.element.name = strdup(name); 128 | 129 | return (0); 130 | } 131 | 132 | 133 | /* 134 | * 'mxmlSetInteger()' - Set the value of an integer node. 135 | * 136 | * The node is not changed if it (or its first child) is not an integer node. 137 | */ 138 | 139 | int /* O - 0 on success, -1 on failure */ 140 | mxmlSetInteger(mxml_node_t *node, /* I - Node to set */ 141 | int integer) /* I - Integer value */ 142 | { 143 | /* 144 | * Range check input... 145 | */ 146 | 147 | if (node && node->type == MXML_ELEMENT && 148 | node->child && node->child->type == MXML_INTEGER) 149 | node = node->child; 150 | 151 | if (!node || node->type != MXML_INTEGER) 152 | return (-1); 153 | 154 | /* 155 | * Set the new value and return... 156 | */ 157 | 158 | node->value.integer = integer; 159 | 160 | return (0); 161 | } 162 | 163 | 164 | /* 165 | * 'mxmlSetOpaque()' - Set the value of an opaque node. 166 | * 167 | * The node is not changed if it (or its first child) is not an opaque node. 168 | */ 169 | 170 | int /* O - 0 on success, -1 on failure */ 171 | mxmlSetOpaque(mxml_node_t *node, /* I - Node to set */ 172 | const char *opaque) /* I - Opaque string */ 173 | { 174 | /* 175 | * Range check input... 176 | */ 177 | 178 | if (node && node->type == MXML_ELEMENT && 179 | node->child && node->child->type == MXML_OPAQUE) 180 | node = node->child; 181 | 182 | if (!node || node->type != MXML_OPAQUE || !opaque) 183 | return (-1); 184 | 185 | /* 186 | * Free any old opaque value and set the new value... 187 | */ 188 | 189 | if (node->value.opaque) 190 | free(node->value.opaque); 191 | 192 | node->value.opaque = strdup(opaque); 193 | 194 | return (0); 195 | } 196 | 197 | 198 | /* 199 | * 'mxmlSetReal()' - Set the value of a real number node. 200 | * 201 | * The node is not changed if it (or its first child) is not a real number node. 202 | */ 203 | 204 | int /* O - 0 on success, -1 on failure */ 205 | mxmlSetReal(mxml_node_t *node, /* I - Node to set */ 206 | double real) /* I - Real number value */ 207 | { 208 | /* 209 | * Range check input... 210 | */ 211 | 212 | if (node && node->type == MXML_ELEMENT && 213 | node->child && node->child->type == MXML_REAL) 214 | node = node->child; 215 | 216 | if (!node || node->type != MXML_REAL) 217 | return (-1); 218 | 219 | /* 220 | * Set the new value and return... 221 | */ 222 | 223 | node->value.real = real; 224 | 225 | return (0); 226 | } 227 | 228 | 229 | /* 230 | * 'mxmlSetText()' - Set the value of a text node. 231 | * 232 | * The node is not changed if it (or its first child) is not a text node. 233 | */ 234 | 235 | int /* O - 0 on success, -1 on failure */ 236 | mxmlSetText(mxml_node_t *node, /* I - Node to set */ 237 | int whitespace, /* I - 1 = leading whitespace, 0 = no whitespace */ 238 | const char *string) /* I - String */ 239 | { 240 | /* 241 | * Range check input... 242 | */ 243 | 244 | if (node && node->type == MXML_ELEMENT && 245 | node->child && node->child->type == MXML_TEXT) 246 | node = node->child; 247 | 248 | if (!node || node->type != MXML_TEXT || !string) 249 | return (-1); 250 | 251 | /* 252 | * Free any old string value and set the new value... 253 | */ 254 | 255 | if (node->value.text.string) 256 | free(node->value.text.string); 257 | 258 | node->value.text.whitespace = whitespace; 259 | node->value.text.string = strdup(string); 260 | 261 | return (0); 262 | } 263 | 264 | 265 | /* 266 | * 'mxmlSetTextf()' - Set the value of a text node to a formatted string. 267 | * 268 | * The node is not changed if it (or its first child) is not a text node. 269 | */ 270 | 271 | int /* O - 0 on success, -1 on failure */ 272 | mxmlSetTextf(mxml_node_t *node, /* I - Node to set */ 273 | int whitespace, /* I - 1 = leading whitespace, 0 = no whitespace */ 274 | const char *format, /* I - Printf-style format string */ 275 | ...) /* I - Additional arguments as needed */ 276 | { 277 | va_list ap; /* Pointer to arguments */ 278 | 279 | 280 | /* 281 | * Range check input... 282 | */ 283 | 284 | if (node && node->type == MXML_ELEMENT && 285 | node->child && node->child->type == MXML_TEXT) 286 | node = node->child; 287 | 288 | if (!node || node->type != MXML_TEXT || !format) 289 | return (-1); 290 | 291 | /* 292 | * Free any old string value and set the new value... 293 | */ 294 | 295 | if (node->value.text.string) 296 | free(node->value.text.string); 297 | 298 | va_start(ap, format); 299 | 300 | node->value.text.whitespace = whitespace; 301 | node->value.text.string = _mxml_strdupf(format, ap); 302 | 303 | va_end(ap); 304 | 305 | return (0); 306 | } 307 | 308 | 309 | /* 310 | * 'mxmlSetUserData()' - Set the user data pointer for a node. 311 | * 312 | * @since Mini-XML 2.7@ 313 | */ 314 | 315 | int /* O - 0 on success, -1 on failure */ 316 | mxmlSetUserData(mxml_node_t *node, /* I - Node to set */ 317 | void *data) /* I - User data pointer */ 318 | { 319 | /* 320 | * Range check input... 321 | */ 322 | 323 | if (!node) 324 | return (-1); 325 | 326 | /* 327 | * Set the user data pointer and return... 328 | */ 329 | 330 | node->user_data = data; 331 | return (0); 332 | } 333 | 334 | 335 | /* 336 | * End of "$Id$". 337 | */ 338 | -------------------------------------------------------------------------------- /mxml.list.in: -------------------------------------------------------------------------------- 1 | # 2 | # "$Id$" 3 | # 4 | # EPM software list file for Mini-XML, a small XML library. 5 | # 6 | # Copyright 2003-2014 by Michael Sweet. 7 | # 8 | # This program is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU Library General Public 10 | # License as published by the Free Software Foundation; either 11 | # version 2, or (at your option) any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | 19 | # Directories... 20 | $prefix=@prefix@ 21 | $exec_prefix=@exec_prefix@ 22 | $bindir=@bindir@ 23 | $datarootdir=@datarootdir@ 24 | $docdir=@docdir@ 25 | $includedir=@includedir@ 26 | $libdir=@libdir@ 27 | $mandir=@mandir@ 28 | $srcdir=@srcdir@ 29 | 30 | $PICFLAG=@PICFLAG@ 31 | 32 | # Product information 33 | %product mxml 34 | %copyright 2003-2014 by Michael Sweet 35 | %vendor Michael Sweet 36 | %license ${srcdir}/COPYING 37 | %readme ${srcdir}/README 38 | %version @VERSION@ 39 | 40 | %description < 28 | Vendor: Michael Sweet 29 | 30 | # Use buildroot so as not to disturb the version already installed 31 | BuildRoot: /var/tmp/%{name}-root 32 | 33 | %description 34 | Mini-XML is a small XML parsing library that you can use to read 35 | XML and XML-like data files in your application without 36 | requiring large non-standard libraries. Mini-XML provides the 37 | following functionality: 38 | 39 | - Reading of UTF-8 and UTF-16 and writing of UTF-8 encoded 40 | XML files and strings. 41 | - Data is stored in a linked-list tree structure, preserving 42 | the XML data hierarchy. 43 | - Supports arbitrary element names, attributes, and 44 | attribute values with no preset limits, just available 45 | memory. 46 | - Supports integer, real, opaque ("cdata"), and text data 47 | types in "leaf" nodes. 48 | - Functions for creating and managing trees of data. 49 | - "Find" and "walk" functions for easily locating and 50 | navigating trees of data. 51 | 52 | Mini-XML doesn't do validation or other types of processing on 53 | the data based upon schema files or other sources of definition 54 | information, nor does it support character entities other than 55 | those required by the XML specification. 56 | 57 | %prep 58 | %setup 59 | 60 | %build 61 | CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_OPT_FLAGS" ./configure --enable-shared --prefix=/usr 62 | 63 | # If we got this far, all prerequisite libraries must be here. 64 | make 65 | 66 | %install 67 | # Make sure the RPM_BUILD_ROOT directory exists. 68 | rm -rf $RPM_BUILD_ROOT 69 | 70 | make BUILDROOT=$RPM_BUILD_ROOT install 71 | 72 | %clean 73 | rm -rf $RPM_BUILD_ROOT 74 | 75 | %files 76 | %defattr(-,root,root) 77 | 78 | %dir /usr/bin 79 | /usr/bin/* 80 | %dir /usr/include 81 | /usr/include/mxml.h 82 | %dir /usr/lib 83 | /usr/lib/* 84 | %dir /usr/lib/pkgconfig 85 | /usr/lib/pkgconfig/mxml.pc 86 | %dir /usr/share/doc/mxml 87 | /usr/share/doc/mxml/* 88 | %dir /usr/share/man/man1 89 | /usr/share/man/man1/* 90 | %dir /usr/share/man/man3 91 | /usr/share/man/man3/* 92 | 93 | # 94 | # End of "$Id$". 95 | # 96 | -------------------------------------------------------------------------------- /test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 24 | 123 25 | Now is the time for all good men to come to the aid of their 26 | country. 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /test/class.cxx: -------------------------------------------------------------------------------- 1 | class foo_c : public bar_c // Foo class derived from bar 2 | { 3 | float foo; /* Real number */ 4 | int bar; /* Integer */ 5 | 6 | public: 7 | 8 | foo_c(float f, int b); 9 | ~foo_c(); 10 | 11 | // 'get_bar()' - Get the value of bar. 12 | int // O - Value of bar 13 | get_bar() 14 | { 15 | return (bar); 16 | } 17 | 18 | // 'get_foo()' - Get the value of foo. 19 | float // O - Value of foo 20 | get_foo() 21 | { 22 | return (foo); 23 | } 24 | 25 | // 'set_bar()' - Set the value of bar. 26 | void 27 | set_bar(int b) // I - Value of bar 28 | { 29 | bar = b; 30 | } 31 | 32 | // 'set_foo()' - Set the value of foo. 33 | void 34 | set_foo(float f) // I - Value of foo 35 | { 36 | foo = f; 37 | } 38 | 39 | // 'set_foobar()' - Set foo and optionally bar (should show default args). 40 | void 41 | set_foobar(float f, // I - Value of foo 42 | int b = 0) // I - Value of bar 43 | { 44 | foo = f; 45 | bar = b; 46 | } 47 | 48 | protected: 49 | 50 | static int global; /* Global integer */ 51 | 52 | // 'get_global()' - Get the global integer. 53 | int // O - Integer 54 | get_global() 55 | { 56 | return (global); 57 | } 58 | 59 | private: 60 | 61 | int barfoo; // Another private integer 62 | 63 | public: 64 | 65 | // 'get_barfoo()' - Get the barfoo value. 66 | int // O - Barfoo value 67 | get_barfoo() 68 | { 69 | return (barfoo); 70 | } 71 | } 72 | 73 | // 'foo_c::foo_c()' - Create a foo_c class. 74 | foo_c::foo_c(float f, // I - Value of foo 75 | int b) // I - Value of bar 76 | { 77 | foo = f; 78 | bar = b; 79 | } 80 | 81 | // 'foo_c::~foo_c()' - Destroy a foo_c class. 82 | foo_c::~foo_c() 83 | { 84 | } 85 | -------------------------------------------------------------------------------- /test/dotest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | (cd ..; make mxmldoc-static) 3 | 4 | files="" 5 | mode="" 6 | 7 | while test $# -gt 0; do 8 | arg="$1" 9 | shift 10 | 11 | case "$arg" in 12 | -f) framed="--framed framed" ;; 13 | -g) mode="gdb" ;; 14 | -v) mode="valgrind" ;; 15 | *.h | *.c | *.cxx) files="$files $arg" ;; 16 | *) 17 | echo "Usage: ./dotest.sh [-f] [-g] [-v] [files]" 18 | exit 1 19 | ;; 20 | esac 21 | done 22 | 23 | if test "$files" = ""; then 24 | files=*.cxx 25 | fi 26 | 27 | rm -f test.xml 28 | 29 | case "$mode" in 30 | gdb) 31 | echo "break malloc_error_break" >.gdbcmds 32 | echo "set env DYLD_INSERT_LIBRARIES /usr/lib/libgmalloc.dylib" >>.gdbcmds 33 | echo "run $framed test.xml $files >test.html 2>test.log" >>.gdbcmds 34 | gdb -x .gdbcmds ../mxmldoc-static 35 | ;; 36 | 37 | valgrind) 38 | valgrind --log-fd=3 --leak-check=yes \ 39 | ../mxmldoc-static $framed test.xml $files \ 40 | >test.html 2>test.log 3>test.valgrind 41 | ;; 42 | 43 | *) 44 | ../mxmldoc-static $framed test.xml $files >test.html 2>test.log 45 | ;; 46 | esac 47 | 48 | -------------------------------------------------------------------------------- /test/enum.cxx: -------------------------------------------------------------------------------- 1 | typedef enum foo_enum_e /* Sample enumeration type */ 2 | { 3 | FOO_ONE, /* One fish */ 4 | FOO_TWO, /* Two fish */ 5 | FOO_RED, /* Red fish */ 6 | FOO_BLUE, /* Blue fish */ 7 | FOO_PRIVATE /* Private fish @private@ */ 8 | } foo_enum_t; 9 | 10 | typedef enum foo_enum2_e /* Sample enumeration type #2 */ 11 | { 12 | FOO2_ONE, /* One fish #2 */ 13 | FOO2_TWO, /* Two fish #2 */ 14 | FOO2_RED, /* Red fish #2 */ 15 | FOO2_BLUE, /* Blue fish #2 */ 16 | FOO2_PRIVATE /* Private fish #2 @private@ */ 17 | } foo_enum2_t; 18 | -------------------------------------------------------------------------------- /test/function.cxx: -------------------------------------------------------------------------------- 1 | /* 2 | * 'foo_void_function()' - Do foo with bar. 3 | * 4 | * Use the @link foo_float_function@ or @link foo_int_function@ functions 5 | * instead. Pass @code NULL@ for "three" then there is no string to print. 6 | * 7 | * @deprecated@ 8 | */ 9 | 10 | void 11 | foo_void_function(int one, /* I - Integer */ 12 | float *two, /* O - Real number */ 13 | const char *three) /* I - String */ 14 | { 15 | if (one) 16 | { 17 | puts("Hello, World!"); 18 | } 19 | else 20 | puts(three); 21 | 22 | *two = 2.0f; 23 | } 24 | 25 | 26 | /* 27 | * 'foo_float_function()' - Do foo with bar. 28 | * 29 | * @since 1.2@ 30 | */ 31 | 32 | float /* O - Real number */ 33 | foo_float_function(int one, /* I - Integer */ 34 | const char *two) /* I - String */ 35 | { 36 | if (one) 37 | { 38 | puts("Hello, World!"); 39 | } 40 | else 41 | puts(two); 42 | 43 | return (2.0f); 44 | } 45 | 46 | 47 | /* 48 | * 'foo_default_string()' - Do something with a defaulted string arg. 49 | */ 50 | 51 | int /* O - Integer value */ 52 | foo_default_string(int one, /* I - Integer */ 53 | const char *two = "2") 54 | /* I - String */ 55 | { 56 | if (one) 57 | { 58 | puts("Hello, World!"); 59 | } 60 | else 61 | puts(two); 62 | 63 | return (2); 64 | } 65 | 66 | 67 | /* 68 | * 'foo_default_int()' - Do something with a defaulted int arg. 69 | */ 70 | 71 | int /* O - Integer value */ 72 | foo_default_int(int one, /* I - Integer */ 73 | int two = 2) /* I - Integer */ 74 | { 75 | if (one) 76 | { 77 | puts("Hello, World!"); 78 | } 79 | else 80 | puts(two); 81 | 82 | return (2); 83 | } 84 | 85 | 86 | /* 87 | * 'foo_void_func()' - Function taking no arguments. 88 | */ 89 | 90 | void 91 | foo_void_func(void) 92 | { 93 | puts("foo_void_func()"); 94 | } 95 | 96 | 97 | /* 98 | * 'foo_private_func()' - Private function. 99 | * 100 | * @private@ 101 | */ 102 | 103 | void 104 | foo_private_func(void) 105 | { 106 | puts("foo_private_func()"); 107 | } 108 | -------------------------------------------------------------------------------- /test/functype.cxx: -------------------------------------------------------------------------------- 1 | typedef int (*foo_func_t)(void *foo, int bar); /**** Foo function type ****/ 2 | -------------------------------------------------------------------------------- /test/struct.cxx: -------------------------------------------------------------------------------- 1 | typedef struct foo_s /* Foo structure */ 2 | { 3 | float foo; /* Real number */ 4 | int bar; /* Integer */ 5 | 6 | foo_s(float f, int b); 7 | ~foo_s(); 8 | 9 | // 'get_bar()' - Get the value of bar. 10 | int // O - Value of bar 11 | get_bar() 12 | { 13 | return (bar); 14 | } 15 | 16 | // 'get_foo()' - Get the value of foo. 17 | float // O - Value of foo 18 | get_foo() 19 | { 20 | return (foo); 21 | } 22 | 23 | // 'set_bar()' - Set the value of bar. 24 | void 25 | set_bar(int b) // I - Value of bar 26 | { 27 | bar = b; 28 | } 29 | 30 | // 'set_foo()' - Set the value of foo. 31 | void 32 | set_foo(float f) // I - Value of foo 33 | { 34 | foo = f; 35 | } 36 | } foo_t; 37 | 38 | // 'foo_s::foo_s()' - Create a foo_s structure. 39 | foo_s::foo_s(float f, // I - Value of foo 40 | int b) // I - Value of bar 41 | { 42 | foo = f; 43 | bar = b; 44 | } 45 | 46 | // 'foo_s::~foo_s()' - Destroy a foo_s structure. 47 | foo_s::~foo_s() 48 | { 49 | } 50 | 51 | typedef struct foo_private_s /* @private@ */ 52 | { 53 | int a; /* Value of "a" */ 54 | char b[255]; /* Value of "b" */ 55 | } foo_private_t; 56 | -------------------------------------------------------------------------------- /test/type.cxx: -------------------------------------------------------------------------------- 1 | typedef int foo_simple_t; /* Simple integer type */ 2 | 3 | typedef int foo_simple_private_t; /* @private@ */ 4 | -------------------------------------------------------------------------------- /vcnet/config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * "$Id$" 3 | * 4 | * Configuration file for Mini-XML, a small XML-like file parsing library. 5 | * 6 | * Copyright 2003-2014 by Michael R Sweet. 7 | * 8 | * These coded instructions, statements, and computer programs are the 9 | * property of Michael R Sweet and are protected by Federal copyright 10 | * law. Distribution and use rights are outlined in the file "COPYING" 11 | * which should have been included with this file. If this file is 12 | * missing or damaged, see the license at: 13 | * 14 | * http://www.msweet.org/projects.php/Mini-XML 15 | */ 16 | 17 | /* 18 | * Beginning with VC2005, Microsoft breaks ISO C and POSIX conformance 19 | * by deprecating a number of functions in the name of security, even 20 | * when many of the affected functions are otherwise completely secure. 21 | * The _CRT_SECURE_NO_DEPRECATE definition ensures that we won't get 22 | * warnings from their use... 23 | * 24 | * Then Microsoft decided that they should ignore this in VC2008 and use 25 | * yet another define (_CRT_SECURE_NO_WARNINGS) instead. Bastards. 26 | */ 27 | 28 | #define _CRT_SECURE_NO_DEPRECATE 29 | #define _CRT_SECURE_NO_WARNINGS 30 | 31 | 32 | /* 33 | * Include necessary headers... 34 | */ 35 | 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | 44 | /* 45 | * Microsoft also renames the POSIX functions to _name, and introduces 46 | * a broken compatibility layer using the original names. As a result, 47 | * random crashes can occur when, for example, strdup() allocates memory 48 | * from a different heap than used by malloc() and free(). 49 | * 50 | * To avoid moronic problems like this, we #define the POSIX function 51 | * names to the corresponding non-standard Microsoft names. 52 | */ 53 | 54 | #define close _close 55 | #define open _open 56 | #define read _read 57 | #define snprintf _snprintf 58 | #define strdup _strdup 59 | #define vsnprintf _vsnprintf 60 | #define write _write 61 | 62 | 63 | /* 64 | * Version number... 65 | */ 66 | 67 | #define MXML_VERSION "Mini-XML v2.8" 68 | 69 | 70 | /* 71 | * Inline function support... 72 | */ 73 | 74 | #define inline _inline 75 | 76 | 77 | /* 78 | * Long long support... 79 | */ 80 | 81 | #define HAVE_LONG_LONG 1 82 | 83 | 84 | /* 85 | * Do we have the snprintf() and vsnprintf() functions? 86 | */ 87 | 88 | #define HAVE_SNPRINTF 1 89 | #define HAVE_VSNPRINTF 1 90 | 91 | 92 | /* 93 | * Do we have the strXXX() functions? 94 | */ 95 | 96 | #define HAVE_STRDUP 1 97 | 98 | 99 | /* 100 | * Define prototypes for string functions as needed... 101 | */ 102 | 103 | # ifndef HAVE_STRDUP 104 | extern char *_mxml_strdup(const char *); 105 | # define strdup _mxml_strdup 106 | # endif /* !HAVE_STRDUP */ 107 | 108 | extern char *_mxml_strdupf(const char *, ...); 109 | extern char *_mxml_vstrdupf(const char *, va_list); 110 | 111 | # ifndef HAVE_SNPRINTF 112 | extern int _mxml_snprintf(char *, size_t, const char *, ...); 113 | # define snprintf _mxml_snprintf 114 | # endif /* !HAVE_SNPRINTF */ 115 | 116 | # ifndef HAVE_VSNPRINTF 117 | extern int _mxml_vsnprintf(char *, size_t, const char *, va_list); 118 | # define vsnprintf _mxml_vsnprintf 119 | # endif /* !HAVE_VSNPRINTF */ 120 | 121 | /* 122 | * End of "$Id$". 123 | */ 124 | -------------------------------------------------------------------------------- /vcnet/mxml.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 10.00 2 | # Visual Studio 2008 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mxmldoc", "mxmldoc.vcproj", "{D909892E-520A-4322-9A47-DAEBDA9CC7A7}" 4 | ProjectSection(ProjectDependencies) = postProject 5 | {E5AA9476-9751-4654-8109-B1A2112D5E73} = {E5AA9476-9751-4654-8109-B1A2112D5E73} 6 | EndProjectSection 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mxml1", "mxml1.vcproj", "{E5AA9476-9751-4654-8109-B1A2112D5E73}" 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testmxml", "testmxml.vcproj", "{75CAC6C4-A6BC-4935-A3C9-8F0AE0744227}" 11 | ProjectSection(ProjectDependencies) = postProject 12 | {E5AA9476-9751-4654-8109-B1A2112D5E73} = {E5AA9476-9751-4654-8109-B1A2112D5E73} 13 | EndProjectSection 14 | EndProject 15 | Global 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|Win32 = Debug|Win32 18 | Debug|x64 = Debug|x64 19 | Release|Win32 = Release|Win32 20 | Release|x64 = Release|x64 21 | EndGlobalSection 22 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 23 | {D909892E-520A-4322-9A47-DAEBDA9CC7A7}.Debug|Win32.ActiveCfg = Debug|Win32 24 | {D909892E-520A-4322-9A47-DAEBDA9CC7A7}.Debug|Win32.Build.0 = Debug|Win32 25 | {D909892E-520A-4322-9A47-DAEBDA9CC7A7}.Debug|x64.ActiveCfg = Debug|x64 26 | {D909892E-520A-4322-9A47-DAEBDA9CC7A7}.Debug|x64.Build.0 = Debug|x64 27 | {D909892E-520A-4322-9A47-DAEBDA9CC7A7}.Release|Win32.ActiveCfg = Release|Win32 28 | {D909892E-520A-4322-9A47-DAEBDA9CC7A7}.Release|Win32.Build.0 = Release|Win32 29 | {D909892E-520A-4322-9A47-DAEBDA9CC7A7}.Release|x64.ActiveCfg = Release|x64 30 | {D909892E-520A-4322-9A47-DAEBDA9CC7A7}.Release|x64.Build.0 = Release|x64 31 | {E5AA9476-9751-4654-8109-B1A2112D5E73}.Debug|Win32.ActiveCfg = Debug|Win32 32 | {E5AA9476-9751-4654-8109-B1A2112D5E73}.Debug|Win32.Build.0 = Debug|Win32 33 | {E5AA9476-9751-4654-8109-B1A2112D5E73}.Debug|x64.ActiveCfg = Debug|x64 34 | {E5AA9476-9751-4654-8109-B1A2112D5E73}.Debug|x64.Build.0 = Debug|x64 35 | {E5AA9476-9751-4654-8109-B1A2112D5E73}.Release|Win32.ActiveCfg = Release|Win32 36 | {E5AA9476-9751-4654-8109-B1A2112D5E73}.Release|Win32.Build.0 = Release|Win32 37 | {E5AA9476-9751-4654-8109-B1A2112D5E73}.Release|x64.ActiveCfg = Release|x64 38 | {E5AA9476-9751-4654-8109-B1A2112D5E73}.Release|x64.Build.0 = Release|x64 39 | {75CAC6C4-A6BC-4935-A3C9-8F0AE0744227}.Debug|Win32.ActiveCfg = Debug|Win32 40 | {75CAC6C4-A6BC-4935-A3C9-8F0AE0744227}.Debug|Win32.Build.0 = Debug|Win32 41 | {75CAC6C4-A6BC-4935-A3C9-8F0AE0744227}.Debug|x64.ActiveCfg = Debug|x64 42 | {75CAC6C4-A6BC-4935-A3C9-8F0AE0744227}.Debug|x64.Build.0 = Debug|x64 43 | {75CAC6C4-A6BC-4935-A3C9-8F0AE0744227}.Release|Win32.ActiveCfg = Release|Win32 44 | {75CAC6C4-A6BC-4935-A3C9-8F0AE0744227}.Release|Win32.Build.0 = Release|Win32 45 | {75CAC6C4-A6BC-4935-A3C9-8F0AE0744227}.Release|x64.ActiveCfg = Release|x64 46 | {75CAC6C4-A6BC-4935-A3C9-8F0AE0744227}.Release|x64.Build.0 = Release|x64 47 | EndGlobalSection 48 | GlobalSection(SolutionProperties) = preSolution 49 | HideSolutionNode = FALSE 50 | EndGlobalSection 51 | EndGlobal 52 | -------------------------------------------------------------------------------- /vcnet/mxml1.def: -------------------------------------------------------------------------------- 1 | LIBRARY "MXML1" 2 | EXPORTS 3 | _mxml_strdupf 4 | _mxml_vstrdupf 5 | mxml_ignore_cb 6 | mxml_integer_cb 7 | mxml_opaque_cb 8 | mxml_real_cb 9 | mxmlAdd 10 | mxmlDelete 11 | mxmlElementDeleteAttr 12 | mxmlElementGetAttr 13 | mxmlElementSetAttr 14 | mxmlElementSetAttrf 15 | mxmlEntityAddCallback 16 | mxmlEntityGetName 17 | mxmlEntityGetValue 18 | mxmlEntityRemoveCallback 19 | mxmlFindElement 20 | mxmlFindPath 21 | mxmlGetCDATA 22 | mxmlGetCustom 23 | mxmlGetElement 24 | mxmlGetFirstChild 25 | mxmlGetInteger 26 | mxmlGetLastChild 27 | mxmlGetNextSibling 28 | mxmlGetOpaque 29 | mxmlGetParent 30 | mxmlGetPrevSibling 31 | mxmlGetReal 32 | mxmlGetRefCount 33 | mxmlGetText 34 | mxmlGetType 35 | mxmlGetUserData 36 | mxmlIndexDelete 37 | mxmlIndexEnum 38 | mxmlIndexFind 39 | mxmlIndexGetCount 40 | mxmlIndexNew 41 | mxmlIndexReset 42 | mxmlLoadFd 43 | mxmlLoadFile 44 | mxmlLoadString 45 | mxmlNewCDATA 46 | mxmlNewCustom 47 | mxmlNewElement 48 | mxmlNewInteger 49 | mxmlNewOpaque 50 | mxmlNewReal 51 | mxmlNewText 52 | mxmlNewTextf 53 | mxmlNewXML 54 | mxmlRelease 55 | mxmlRemove 56 | mxmlRetain 57 | mxmlSaveAllocString 58 | mxmlSaveFd 59 | mxmlSaveFile 60 | mxmlSaveString 61 | mxmlSAXLoadFd 62 | mxmlSAXLoadFile 63 | mxmlSAXLoadString 64 | mxmlSetCDATA 65 | mxmlSetCustom 66 | mxmlSetCustomHandlers 67 | mxmlSetElement 68 | mxmlSetErrorCallback 69 | mxmlSetInteger 70 | mxmlSetOpaque 71 | mxmlSetReal 72 | mxmlSetText 73 | mxmlSetTextf 74 | mxmlSetUserData 75 | mxmlSetWrapMargin 76 | mxmlWalkNext 77 | mxmlWalkPrev 78 | -------------------------------------------------------------------------------- /www/.htaccess: -------------------------------------------------------------------------------- 1 | RewriteEngine Off 2 | -------------------------------------------------------------------------------- /www/0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/www/0.gif -------------------------------------------------------------------------------- /www/1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/www/1.gif -------------------------------------------------------------------------------- /www/2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/www/2.gif -------------------------------------------------------------------------------- /www/3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/www/3.gif -------------------------------------------------------------------------------- /www/4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/www/4.gif -------------------------------------------------------------------------------- /www/A.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/www/A.gif -------------------------------------------------------------------------------- /www/B.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/www/B.gif -------------------------------------------------------------------------------- /www/C.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/www/C.gif -------------------------------------------------------------------------------- /www/D.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/www/D.gif -------------------------------------------------------------------------------- /www/data/.htaccess: -------------------------------------------------------------------------------- 1 | Order deny,allow 2 | Allow from none 3 | 4 | -------------------------------------------------------------------------------- /www/data/makedb: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if test -f mxml.db; then 4 | rm -f mxml.db.old 5 | mv mxml.db mxml.db.old 6 | fi 7 | 8 | sqlite mxml.db 2 | 3 | 4 | Mini-XML Programmers Manual, Version 2.7 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 25 | 26 | 27 | Contents 28 | Previous 29 | Next 30 |
31 |

1Building, Installing, and 33 | Packaging Mini-XML

34 |

This chapter describes how to build, install, and package Mini-XML on 35 | your system from the source archive. You will need an ANSI/ISO-C 36 | compatible compiler to build Mini-XML - GCC works, as do most vendors' 37 | C compilers. If you are building Mini-XML on Windows, we recommend 38 | using the Visual C++ environment with the supplied solution file. For 39 | other operating systems, you'll need a POSIX-compatible shell and 40 | make program in addition to the C compiler.

41 |

Compiling Mini-XML

42 |

Mini-XML comes with both an autoconf-based configure script and a 43 | Visual C++ solution that can be used to compile the library and 44 | associated tools.

45 |

Compiling with Visual C++

46 |

Open the mxml.sln solution in the vcnet folder. 47 | Choose the desired build configuration, "Debug" (the default) or 48 | "Release", and then choose Build Solution from the 49 | Build menu.

50 |

Compiling with Command-Line Tools

51 |

Type the following command to configure the Mini-XML source code for 52 | your system:

53 |
 54 |     ./configure ENTER
 55 | 
56 |

The default install prefix is /usr/local, which can be 57 | overridden using the --prefix option:

58 |
 59 |     ./configure --prefix=/foo ENTER
 60 | 
61 |

Other configure options can be found using the --help 62 | option:

63 |
 64 |     ./configure --help ENTER
 65 | 
66 |

Once you have configured the software, use the make(1) 67 | program to do the build and run the test program to verify that things 68 | are working, as follows:

69 |
 70 |     make ENTER
 71 | 
72 |

Installing Mini-XML

73 |

If you are using Visual C++, copy the mxml.lib and and 74 | mxml.h files to the Visual C++ lib and include 75 | directories, respectively.

76 |

Otherwise, use the make command with the install 77 | target to install Mini-XML in the configured directories:

78 |
 79 |     make install ENTER
 80 | 
81 |

Creating Mini-XML Packages

82 |

Mini-XML includes two files that can be used to create binary 83 | packages. The first file is mxml.spec which is used by the 84 | rpmbuild(8) software to create Red Hat Package Manager ("RPM") 85 | packages which are commonly used on Linux. Since rpmbuild 86 | wants to compile the software on its own, you can provide it with the 87 | Mini-XML tar file to build the package:

88 |
 89 |     rpmbuild -ta mxml-version.tar.gz ENTER
 90 | 
91 |

The second file is mxml.list which is used by the 92 | epm(1) program to create software packages in a variety of formats. 93 | The epm program is available from the following URL:

94 |
 95 |     http://www.epmhome.org/
 96 | 
97 |

Use the make command with the epm target to 98 | create portable and native packages for your system:

99 |
100 |     make epm ENTER
101 | 
102 |

The packages are stored in a subdirectory named dist for 103 | your convenience. The portable packages utilize scripts and tar files 104 | to install the software on the target system. After extracting the 105 | package archive, use the mxml.install script to install the 106 | software.

107 |

The native packages will be in the local OS's native format: RPM for 108 | Red Hat Linux, DPKG for Debian Linux, PKG for Solaris, and so forth. 109 | Use the corresponding commands to install the native packages.

110 |
111 | Contents 112 | Previous 113 | Next 114 | 115 | 116 | -------------------------------------------------------------------------------- /www/docfiles/intro.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Mini-XML Programmers Manual, Version 2.7 5 | 6 | 7 | 8 | 9 | 10 | 11 | 24 | 25 | 26 | Contents 27 | Next 28 |
29 |

0Introduction

31 |

This programmers manual describes Mini-XML version 2.7, a small XML 32 | parsing library that you can use to read and write XML data files in 33 | your C and C++ applications.

34 |

Mini-XML was initially developed for the 35 | Gutenprint project to replace the rather large and unwieldy 36 | libxml2 library with something substantially smaller and 37 | easier-to-use. It all began one morning in June of 2003 when Robert 38 | posted the following sentence to the developer's list:

39 |
It's bad enough that we require libxml2, but rolling our 40 | own XML parser is a bit more than we can handle.
41 |

I then replied with:

42 |
Given the limited scope of what you use in XML, it 43 | should be trivial to code a mini-XML API in a few hundred lines of 44 | code.
45 |

I took my own challenge and coded furiously for two days to produced 46 | the initial public release of Mini-XML, total lines of code: 696. 47 | Robert promptly integrated Mini-XML into Gutenprint and removed 48 | libxml2.

49 |

Thanks to lots of feedback and support from various developers, 50 | Mini-XML has evolved since then to provide a more complete XML 51 | implementation and now stands at a whopping 3,965 lines of code, 52 | compared to 103,893 lines of code for libxml2 version 2.6.9.

53 |

Aside from Gutenprint, Mini-XML is used for the following 54 | projects/software applications:

55 | 59 |

Please email me (mxml @ easysw . com) if you would like your project 60 | added or removed from this list, or if you have any comments/quotes you 61 | would like me to publish about your experiences with Mini-XML.

62 | 63 | 64 |

Organization of This Document

65 |

This manual is organized into the following chapters and appendices:

66 | 88 | 89 | 90 |

Notation Conventions

91 |

Various font and syntax conventions are used in this guide. Examples 92 | and their meanings and uses are explained below:

93 |
94 |
mxmldoc 95 |
mxmldoc(1)
96 |
The names of commands; the first mention of a command or function in 97 | a chapter is followed by a manual page section number. 98 |
99 |
100 |
/var 101 |
/etc/hosts
102 |
File and directory names. 103 |
104 |
105 |
Request ID is Printer-123
106 |
Screen output. 107 |
108 |
109 |
lp -d printer filename ENTER
110 |
Literal user input; special keys like ENTER are in ALL 111 | CAPS. 112 |
113 |
114 |
12.3
115 |
Numbers in the text are written using the period (.) to indicate the 116 | decimal point. 117 |
118 |
119 |
120 | 121 | 122 |

Abbreviations

123 |

The following abbreviations are used throughout this manual:

124 |
125 |
Gb
126 |
Gigabytes, or 1073741824 bytes 127 |
128 |
129 |
kb
130 |
Kilobytes, or 1024 bytes 131 |
132 |
133 |
Mb
134 |
Megabytes, or 1048576 bytes 135 |
136 |
137 |
UTF-8, UTF-16
138 |
Unicode Transformation Format, 8-bit or 16-bit 139 |
140 |
141 |
W3C
142 |
World Wide Web Consortium 143 |
144 |
145 |
XML
146 |
Extensible Markup Language 147 |
148 |
149 |
150 | 151 | 152 |

Other References

153 |
154 |
The Unicode Standard, Version 4.0, Addison-Wesley, ISBN 155 | 0-321-18578-1
156 |
The definition of the Unicode character set which is used for XML. 157 |
158 |
159 |
Extensible 160 | Markup Language (XML) 1.0 (Third Edition)
161 |
The XML specification from the World Wide Web Consortium (W3C) 162 |
163 |
164 |
165 | 166 | 167 |

Legal Stuff

168 |

The Mini-XML library is copyright 2003-2011 by Michael Sweet. License 169 | terms are described in Appendix A - 170 | Mini-XML License.

171 |
172 | Contents 173 | Next 174 | 175 | 176 | -------------------------------------------------------------------------------- /www/docfiles/mxmldoc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Mini-XML Programmers Manual, Version 2.7 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 25 | 26 | 27 | Contents 28 | Previous 29 | Next 30 |
31 |

4Using the mxmldoc Utility

33 |

This chapter describes how to use mxmldoc(1) program to 34 | automatically generate documentation from C and C++ source files.

35 |

The Basics

36 |

Originally developed to generate the Mini-XML and CUPS API 37 | documentation, mxmldoc is now a general-purpose utility which 38 | scans C and C++ source files to produce HTML and man page documentation 39 | along with an XML file representing the functions, types, and 40 | definitions in those source files. Unlike popular documentation 41 | generators like Doxygen or Javadoc, mxmldoc uses in-line 42 | comments rather than comment headers, allowing for more "natural" code 43 | documentation.

44 |

By default, mxmldoc produces HTML documentation. For 45 | example, the following command will scan all of the C source and header 46 | files in the current directory and produce a HTML documentation file 47 | called filename.html:

48 |
 49 |     mxmldoc *.h *.c >filename.html ENTER
 50 | 
51 |

You can also specify an XML file to create which contains all of the 52 | information from the source files. For example, the following command 53 | creates an XML file called filename.xml in addition to the 54 | HTML file:

55 |
 56 |     mxmldoc filename.xml *.h *.c >filename.html ENTER
 57 | 
58 |

The --no-output option disables the normal HTML output:

59 |
 60 |     mxmldoc --no-output filename.xml *.h *.c ENTER
 61 | 
62 |

You can then run mxmldoc again with the XML file alone to 63 | generate the HTML documentation:

64 |
 65 |     mxmldoc filename.xml >filename.html ENTER
 66 | 
67 |

Creating Man Pages

68 |

The --man filename option tells mxmldoc to create a 69 | man page instead of HTML documentation, for example:

70 |
 71 |     mxmldoc --man filename filename.xml \
 72 |         >filename.man ENTER
 73 | 
 74 |     mxmldoc --man filename *.h *.c \
 75 |         >filename.man ENTER
 76 | 
77 |

Creating Xcode Documentation Sets

78 |

The --docset directory.docset option tells mxmldoc 79 | to create an Xcode documentation set containing the HTML documentation, 80 | for example:

81 |
 82 |     mxmldoc --docset foo.docset *.h *.c foo.xml ENTER
 83 | 
84 |

Xcode documentation sets can only be built on Mac OS X with Xcode 3.0 85 | or higher installed.

86 |

Commenting Your Code

87 |

As noted previously, mxmldoc looks for in-line comments to 88 | describe the functions, types, and constants in your code. Mxmldoc 89 | will document all public names it finds in your source files - any 90 | names starting with the underscore character (_) or names that are 91 | documented with the @private@ directive are 92 | treated as private and are not documented.

93 |

Comments appearing directly before a function or type definition are 94 | used to document that function or type. Comments appearing after 95 | argument, definition, return type, or variable declarations are used to 96 | document that argument, definition, return type, or variable. For 97 | example, the following code excerpt defines a key/value structure and a 98 | function that creates a new instance of that structure:

99 |
100 |     /* A key/value pair. This is used with the
101 |        dictionary structure. */
102 | 
103 |     struct keyval
104 |     {
105 |       char *key; /* Key string */
106 |       char *val; /* Value string */
107 |     };
108 | 
109 |     /* Create a new key/value pair. */
110 | 
111 |     struct keyval * /* New key/value pair */
112 |     new_keyval(
113 |         const char *key, /* Key string */
114 | 	const char *val) /* Value string */
115 |     {
116 |       ...
117 |     }
118 | 
119 |

Mxmldoc also knows to remove extra asterisks (*) from the 120 | comment string, so the comment string:

121 |
122 |     /*
123 |      * Compute the value of PI.
124 |      *
125 |      * The function connects to an Internet server
126 |      * that streams audio of mathematical monks
127 |      * chanting the first 100 digits of PI.
128 |      */
129 | 
130 |

will be shown as:

131 |
132 |     Compute the value of PI.
133 | 
134 |     The function connects to an Internet server
135 |     that streams audio of mathematical monks
136 |     chanting the first 100 digits of PI.
137 | 
138 |

Comments can also include the following 139 | special @name ...@ directive strings:

140 |
    141 |
  • @deprecated@ - flags the item as deprecated to discourage 142 | its use
  • 143 |
  • @private@ - flags the item as private so it will not be 144 | included in the documentation
  • 145 |
  • @since ...@ - flags the item as new since a particular 146 | release. The text following the @since up to the closing @ 147 | is highlighted in the generated documentation, e.g. @since Mini-XML 148 | 2.7@.
  • 149 |
150 | 151 | 152 |

Titles, Sections, and Introductions

153 |

Mxmldoc also provides options to set the title, section, and 154 | introduction text for the generated documentation. The --title text 155 | option specifies the title for the documentation. The title string is 156 | usually put in quotes:

157 |
158 |     mxmldoc filename.xml \
159 |         --title "My Famous Documentation" \
160 |         >filename.html ENTER
161 | 
162 |

The --section name option specifies the section for the 163 | documentation. For HTML documentation, the name is placed in a HTML 164 | comment such as:

165 |
166 |     <!-- SECTION: name -->
167 | 
168 |

For man pages, the section name is usually just a number ("3"), or a 169 | number followed by a vendor name ("3acme"). The section name is used in 170 | the .TH directive in the man page:

171 |
172 |     .TH mylibrary 3acme "My Title" ...
173 | 
174 |

The default section name for man page output is "3". There is no 175 | default section name for HTML output.

176 |

Finally, the --intro filename option specifies a file to 177 | embed after the title and section but before the generated 178 | documentation. For HTML documentation, the file must consist of valid 179 | HTML without the usual DOCTYPE, html, and body 180 | elements. For man page documentation, the file must consist of valid 181 | nroff(1) text.

182 |
183 | Contents 184 | Previous 185 | Next 186 | 187 | 188 | -------------------------------------------------------------------------------- /www/docfiles/search.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/www/docfiles/search.index -------------------------------------------------------------------------------- /www/documentation.php: -------------------------------------------------------------------------------- 1 | The path '$path' is bad.

\n"); 42 | 43 | html_footer(); 44 | } 45 | } 46 | else 47 | { 48 | $fp = fopen("docfiles$path", "rb"); 49 | if (!$fp) 50 | { 51 | if ($type == "html") 52 | { 53 | html_header("Documentation Error"); 54 | 55 | print("

Unable to open path '$path'.

\n"); 56 | 57 | html_footer(); 58 | } 59 | } 60 | else if ($type == "html") 61 | { 62 | html_header("Documentation"); 63 | 64 | $saw_body = 0; 65 | $last_nav = 0; 66 | 67 | while ($line = fgets($fp, 1024)) 68 | { 69 | if (strstr($line, "") || strstr($line, "")) 74 | { 75 | break; 76 | } 77 | else if ($saw_body) 78 | { 79 | if (strstr($line, "ContentsPrevious") || 81 | strstr($line, ">Next")) 82 | { 83 | if ($last_nav) 84 | print("·\n"); 85 | else 86 | print("\n"); 108 | 109 | print("

User Comments

\n" 110 | ."

" 111 | ."Add Comment

\n"); 112 | 113 | $num_comments = show_comments("documentation.php$path"); 114 | 115 | if ($num_comments == 0) 116 | print("

No comments for this page.

\n"); 117 | 118 | html_footer(); 119 | } 120 | else 121 | { 122 | header("Content-Type: image/$type"); 123 | 124 | print(fread($fp, filesize("docfiles$path"))); 125 | 126 | fclose($fp); 127 | } 128 | } 129 | } 130 | else 131 | { 132 | html_header("Documentation"); 133 | 134 | if (array_key_exists("CLEAR", $_GET)) 135 | $q = ""; 136 | else if (array_key_exists("Q", $_GET)) 137 | $q = $_GET["Q"]; 138 | else 139 | $q = ""; 140 | 141 | $html = htmlspecialchars($q, ENT_QUOTES); 142 | 143 | if (stripos($_SERVER["HTTP_USER_AGENT"], "webkit") !== FALSE) 144 | { 145 | // Use Safari search box... 146 | $search = ""; 149 | } 150 | else 151 | { 152 | // Use standard HTML text field... 153 | $search = " " 155 | ." " 156 | .""; 157 | } 158 | 159 | print("
\n" 160 | ."

$search

\n" 161 | ."
\n"); 162 | 163 | if ($q != "") 164 | { 165 | // Run htmlsearch to search the documentation... 166 | $matches = array(); 167 | $scores = array(); 168 | $maxscore = 0; 169 | $fp = popen("/usr/local/bin/websearch docfiles " . escapeshellarg($q), 170 | "r"); 171 | 172 | fgets($fp, 1024); 173 | 174 | while ($line = fgets($fp, 1024)) 175 | { 176 | $data = explode("|", $line); 177 | $matches[$data[1]] = $data[2]; 178 | $scores[$data[1]] = $data[0]; 179 | 180 | if ($maxscore == 0) 181 | $maxscore = $data[0]; 182 | } 183 | 184 | pclose($fp); 185 | 186 | // Show the results... 187 | if (sizeof($matches) == 1) 188 | $total = "1 match"; 189 | else 190 | $total = sizeof($matches) . " matches"; 191 | 192 | print("

$total found:

\n" 193 | ."\n"); 194 | 195 | reset($matches); 196 | foreach ($matches as $file => $text) 197 | { 198 | $link = "$PHP_SELF/$file"; 199 | $score = str_repeat("★", 200 | (int)(4 * $scores[$file] / $maxscore) + 1); 201 | 202 | print("" 203 | ."\n"); 204 | } 205 | 206 | print("
$score   $text
\n"); 207 | } 208 | else 209 | { 210 | ?> 211 | 212 |

You can view the Mini-XML documentation in a single HTML file or in 213 | multiple files with comments on-line:

214 | 215 | 254 | 255 |

You can also get a printed version of the Mini-XML documentation on 256 | Lulu.com.

257 | 258 | 268 | -------------------------------------------------------------------------------- /www/images/.htaccess: -------------------------------------------------------------------------------- 1 | DirectoryIndex off 2 | 3 | -------------------------------------------------------------------------------- /www/images/black.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/www/images/black.gif -------------------------------------------------------------------------------- /www/images/favicon.xcf.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/www/images/favicon.xcf.gz -------------------------------------------------------------------------------- /www/images/graph.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/www/images/graph.gif -------------------------------------------------------------------------------- /www/images/logo-large.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/www/images/logo-large.gif -------------------------------------------------------------------------------- /www/images/logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/www/images/logo.gif -------------------------------------------------------------------------------- /www/images/private.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/www/images/private.gif -------------------------------------------------------------------------------- /www/index.php: -------------------------------------------------------------------------------- 1 | 23 | 24 | 29 | 30 |

Mini-XML: Lightweight XML Library

31 | 32 |

Mini-XML is a small XML library that you can use to read and write XML and 33 | XML-like data files in your application without requiring large non-standard 34 | libraries. Mini-XML only requires an ANSI C compatible compiler (GCC works, as 35 | do most vendors' ANSI C compilers) and a 'make' program.

36 | 37 |

Mini-XML supports reading of UTF-8 and UTF-16 and writing of UTF-8 encoded 38 | XML files and strings. Data is stored in a linked-list tree structure, 39 | preserving the XML data hierarchy, and arbitrary element names, attributes, 40 | and attribute values are supported with no preset limits, just available 41 | memory.

42 | 43 | 44 | 91 |
45 | 46 |

Documentation

47 | 48 |

Introduction

49 | 50 |

Getting Started with Mini-XML

51 | 52 |

More Mini-XML Programming 53 | Techniques

54 | 55 |

Mini-XML License

56 | 57 |

Library Reference

58 | 59 |
      60 | 61 |

Recent News

62 | 63 | $title - $abstract
\n" 83 | ."$date, $count

\n"); 84 | } 85 | 86 | db_free($result); 87 | 88 | ?> 89 | 90 |
92 | 93 | 94 | -------------------------------------------------------------------------------- /www/login.php: -------------------------------------------------------------------------------- 1 | \n"); 98 | html_footer(); 99 | exit(); 100 | } 101 | 102 | db_free($result); 103 | 104 | $usererror = "Username already exists!"; 105 | } 106 | else if ($argc == 1 && $argv[0] == "E" && $username != "" && 107 | $password != "" && $register != "") 108 | { 109 | // Check that we have an existing user account... 110 | $name = db_escape($username); 111 | $result = db_query("SELECT * FROM users WHERE name='$name'"); 112 | if (db_count($result) == 1) 113 | { 114 | // Yes, now check the registration code... 115 | $row = db_next($result); 116 | $hash = md5("$row[id]:$row[hash]"); 117 | 118 | if ($hash == $register) 119 | { 120 | // Good code, enable the account and login... 121 | db_query("UPDATE users SET is_published = 1 WHERE name='$name'"); 122 | 123 | if (auth_login($username, $password) == "") 124 | { 125 | db_query("UPDATE users SET is_published = 0 WHERE name='$name'"); 126 | $usererror = "Login failed!"; 127 | } 128 | } 129 | else 130 | $usererror = "Bad registration code!"; 131 | } 132 | else 133 | $usererror = "Username not found!"; 134 | 135 | db_free($result); 136 | } 137 | else if ($argc == 0 && $username != "" && $password != "") 138 | if (auth_login($username, $password) == "") 139 | $usererror = "Login failed!"; 140 | } 141 | else 142 | { 143 | $username = ""; 144 | $password = ""; 145 | $password2 = ""; 146 | $email = ""; 147 | $register = ""; 148 | } 149 | 150 | if ($LOGIN_USER != "") 151 | header("Location: $page"); 152 | else if ($argc == 0 || $argv[0] != "E") 153 | { 154 | // Header + start of table... 155 | html_header("Login"); 156 | 157 | print("\n" 159 | ."" 189 | ."" 192 | ."\n" 226 | ."
\n"); 160 | 161 | // Existing users... 162 | print("

Current Users

\n"); 163 | 164 | if ($argc == 0 && $usererror != "") 165 | print("

$usererror

\n"); 166 | 167 | $page = htmlspecialchars($page, ENT_QUOTES); 168 | 169 | print("

If you are a registered $PROJECT_NAME developer, please enter " 170 | ."your username and password to login:

\n" 171 | ."
" 172 | ."" 173 | ."\n" 174 | ."" 175 | ."\n" 181 | ."" 182 | ."\n" 184 | ."\n" 185 | ."
Username:
Password:" 183 | ."
\n"); 186 | 187 | // Separator... 188 | print("
    " 190 | ."" 191 | ."    \n"); 193 | 194 | // New users... 195 | print("

New Users

\n"); 196 | 197 | if ($argc == 1 && $usererror != "") 198 | print("

$usererror

\n"); 199 | 200 | $username = htmlspecialchars($username, ENT_QUOTES); 201 | $email = htmlspecialchars($email, ENT_QUOTES); 202 | 203 | print("

If you are a not registered $PROJECT_NAME developer, please fill " 204 | ."in the form below to register. An email will be sent to the " 205 | ."address you supply to confirm the registration:

\n" 206 | ."
" 207 | ."" 208 | ."\n" 209 | ."" 210 | ."\n" 212 | ."" 213 | ."\n" 215 | ."" 216 | ."\n" 218 | ."" 219 | ."\n" 221 | ."\n" 222 | ."
Username:
EMail:
Password:" 217 | ."
Password Again:" 220 | ."
\n"); 223 | 224 | // End table 225 | print("
\n"); 227 | 228 | html_footer(); 229 | } 230 | else 231 | { 232 | html_header("Enable Account"); 233 | 234 | if ($usererror != NULL) 235 | print("

$usererror

\n"); 236 | 237 | $username = htmlspecialchars($username, ENT_QUOTES); 238 | $register = htmlspecialchars($register, ENT_QUOTES); 239 | 240 | print("

Please enter the registration code that was emailed to you " 241 | ."with your username and password to enable your account and login:

\n" 242 | ."
" 243 | ."
\n" 244 | ."" 245 | ."\n" 248 | ."" 249 | ."\n" 251 | ."" 252 | ."\n" 254 | ."\n" 255 | ."
Registration Code:" 247 | ."
Username:
Password:" 253 | ."
\n"); 256 | 257 | html_footer(); 258 | } 259 | 260 | 261 | // 262 | // End of "$Id$". 263 | // 264 | ?> 265 | -------------------------------------------------------------------------------- /www/mxmldoc.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Mini-XML 2.7 documentation schema for mxmldoc output. 6 | Copyright 2003-2011 by Michael Sweet. 7 | 8 | This program is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Library General Public 10 | License as published by the Free Software Foundation; either 11 | version 2, or (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | -------------------------------------------------------------------------------- /www/org.minixml.atom: -------------------------------------------------------------------------------- 1 | 2 | 3 | http://www.minixml.org/org.minixml.atom/20111220234804 4 | minixml.org 5 | 6 | 2011-12-20T23:48:04-08:00 7 | 8 | tag:www.minixml.org,2011-12-20:org.minixml.docset/2.7.0 9 | Mini-XML API Reference 10 | 2011-12-20T23:48:04-08:00 11 | Mini-XML API Reference (v2.7.0) 12 | 13 | org.minixml.docset 14 | 2.7.0 15 | 16 | -------------------------------------------------------------------------------- /www/org.minixml.xar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chuckatkins/MiniXML/b20d77251f8d2242dbf8eb731a0cdb18edd1e7c6/www/org.minixml.xar -------------------------------------------------------------------------------- /www/phplib/.htaccess: -------------------------------------------------------------------------------- 1 | Order deny,allow 2 | Allow from none 3 | 4 | -------------------------------------------------------------------------------- /www/phplib/auth.php: -------------------------------------------------------------------------------- 1 | 184 | -------------------------------------------------------------------------------- /www/phplib/db.php: -------------------------------------------------------------------------------- 1 | Database error $sqlerrno: $sqlerr

\n"); 51 | print("

Please report the problem to " 52 | ."webmaster@easysw.com.

\n"); 53 | } 54 | 55 | 56 | // 57 | // 'db_count()' - Return the number of rows in a query result. 58 | // 59 | 60 | function // O - Number of rows in result 61 | db_count($result) // I - Result of query 62 | { 63 | if ($result) 64 | return (mysql_num_rows($result)); 65 | else 66 | return (0); 67 | } 68 | 69 | 70 | // 71 | // 'db_escape()' - Escape special chars in string for query. 72 | // 73 | 74 | function // O - Quoted string 75 | db_escape($str) // I - String 76 | { 77 | return (mysql_escape_string($str)); 78 | } 79 | 80 | 81 | // 82 | // 'db_free()' - Free a database query result... 83 | // 84 | 85 | function 86 | db_free($result) // I - Result of query 87 | { 88 | if ($result) 89 | mysql_free_result($result); 90 | } 91 | 92 | 93 | // 94 | // 'db_insert_id()' - Return the ID of the last inserted record. 95 | // 96 | 97 | function // O - ID number 98 | db_insert_id() 99 | { 100 | global $DB_CONN; 101 | 102 | return (mysql_insert_id($DB_CONN)); 103 | } 104 | 105 | 106 | // 107 | // 'db_next()' - Fetch the next row of a result set and return it as an object. 108 | // 109 | 110 | function // O - Row object or NULL at end 111 | db_next($result) // I - Result of query 112 | { 113 | if ($result) 114 | return (mysql_fetch_array($result)); 115 | else 116 | return (NULL); 117 | } 118 | 119 | 120 | // 121 | // 'db_query()' - Run a SQL query and return the result or 0 on error. 122 | // 123 | 124 | function // O - Result of query or NULL 125 | db_query($SQL_QUERY) // I - SQL query string 126 | { 127 | global $DB_NAME, $DB_CONN; 128 | 129 | return (mysql_query($SQL_QUERY, $DB_CONN)); 130 | 131 | // print("

SQL_QUERY: $SQL_QUERY

\n"); 132 | // 133 | // $result = mysql_query($SQL_QUERY, $DB_CONN); 134 | // $count = db_count($result); 135 | // print("

Result = $count rows...

\n"); 136 | // 137 | // return ($result); 138 | } 139 | 140 | 141 | // 142 | // 'db_seek()' - Seek to a specific row within a result. 143 | // 144 | 145 | function // O - TRUE on success, FALSE otherwise 146 | db_seek($result, // I - Result of query 147 | $index = 0) // I - Row number (0 = first row) 148 | { 149 | if ($result) 150 | return (mysql_data_seek($result, $index)); 151 | else 152 | return (FALSE); 153 | } 154 | 155 | 156 | // 157 | // End of "$Id: db.php,v 1.5 2004/05/21 03:59:17 mike Exp $". 158 | // 159 | ?> 160 | -------------------------------------------------------------------------------- /www/phplib/globals.php: -------------------------------------------------------------------------------- 1 | 50 | -------------------------------------------------------------------------------- /www/phplib/mirrors.php: -------------------------------------------------------------------------------- 1 | array("California, USA", 37.7898, -122.3942), 18 | "http://ftp2.easysw.com/pub" => array("New Jersey, USA", 40.4619, -74.3561), 19 | "http://ftp.funet.fi/pub/mirrors/ftp.easysw.com/pub" => array("Espoo, Finland", 60.2167, 24.6667), 20 | "http://ftp.rz.tu-bs.de/pub/mirror/ftp.easysw.com/ftp/pub" => array("Braunschweig, Germany", 52.2667, 10.5333), 21 | ); 22 | 23 | 24 | // 25 | // 'mirror_closest()' - Return the closest mirror to the current IP. 26 | // 27 | 28 | function // O - Closest mirror 29 | mirror_closest() 30 | { 31 | global $_SERVER, $MIRRORS; 32 | 33 | 34 | // Get the current longitude for the client... 35 | if (!extension_loaded("geoip.so") || 36 | $_SERVER["REMOTE_ADDR"] == "::1" || 37 | $_SERVER["REMOTE_ADDR"] == "127.0.0.1") 38 | $lon = -120; 39 | else 40 | { 41 | $current = geoip_record_by_name($_SERVER["REMOTE_ADDR"]); 42 | $lon = $current["longitude"]; 43 | } 44 | 45 | // Loop through the mirrors to find the closest one, currently just using 46 | // the longitude... 47 | $closest_mirror = ""; 48 | $closest_distance = 999; 49 | 50 | reset($MIRRORS); 51 | foreach ($MIRRORS as $mirror => $data) 52 | { 53 | $distance = abs($lon - $data[2]); 54 | if ($distance > 180) 55 | $distance = 360 - $distance; 56 | 57 | if ($distance < $closest_distance) 58 | { 59 | $closest_mirror = $mirror; 60 | $closest_distance = $distance; 61 | } 62 | } 63 | 64 | return ($closest_mirror); 65 | } 66 | 67 | 68 | // 69 | // End of "$Id$". 70 | // 71 | ?> 72 | -------------------------------------------------------------------------------- /www/phplib/poll.php: -------------------------------------------------------------------------------- 1 |
" 68 | ."$question\n"); 69 | 70 | if ($row['poll_type'] == $POLL_TYPE_PICKONE) 71 | print("(please pick one)\n"); 72 | else 73 | print("(pick all that apply)\n"); 74 | 75 | for ($i = 0; $i < 10; $i ++) 76 | { 77 | $answer = htmlspecialchars($row["answer$i"]); 78 | 79 | if ($answer != "") 80 | { 81 | if ($row['poll_type'] == $POLL_TYPE_PICKONE) 82 | print("
$answer\n"); 87 | } 88 | } 89 | 90 | $votes = $row['votes']; 91 | if ($votes == 1) 92 | $votes .= " vote"; 93 | else 94 | $votes .= " votes"; 95 | 96 | $ccount = count_comments("poll.php_r$id"); 97 | if ($ccount == 1) 98 | $ccount .= " comment"; 99 | else 100 | $ccount .= " comments"; 101 | 102 | print("
\n" 103 | ."[ Results ]\n"); 104 | print("
($votes, $ccount)

\n"); 105 | } 106 | 107 | db_free($result); 108 | } 109 | 110 | 111 | // 112 | // End of "$Id: poll.php,v 1.1 2004/05/20 03:38:42 mike Exp $". 113 | // 114 | ?> 115 | -------------------------------------------------------------------------------- /www/phplib/str.php: -------------------------------------------------------------------------------- 1 | "Resolved", 36 | 2 => "Unresolved", 37 | 3 => "Active", 38 | 4 => "Pending", 39 | 5 => "New" 40 | ); 41 | 42 | $status_long = array( 43 | 1 => "1 - Closed w/Resolution", 44 | 2 => "2 - Closed w/o Resolution", 45 | 3 => "3 - Active", 46 | 4 => "4 - Pending", 47 | 5 => "5 - New" 48 | ); 49 | 50 | $priority_text = array( 51 | 1 => "RFE", 52 | 2 => "LOW", 53 | 3 => "MODERATE", 54 | 4 => "HIGH", 55 | 5 => "CRITICAL" 56 | ); 57 | 58 | $priority_long = array( 59 | 1 => "1 - Request for Enhancement, e.g. asking for a feature", 60 | 2 => "2 - Low, e.g. a documentation error or undocumented side-effect", 61 | 3 => "3 - Moderate, e.g. unable to compile the software", 62 | 4 => "4 - High, e.g. key functionality not working", 63 | 5 => "5 - Critical, e.g. nothing working at all" 64 | ); 65 | 66 | $scope_text = array( 67 | 1 => "MACH", 68 | 2 => "OS", 69 | 3 => "ALL" 70 | ); 71 | 72 | $scope_long = array( 73 | 1 => "1 - Specific to a machine", 74 | 2 => "2 - Specific to an operating system", 75 | 3 => "3 - Applies to all machines and operating systems" 76 | ); 77 | 78 | 79 | // 80 | // End of "$Id: str.php,v 1.2 2004/05/19 00:57:33 mike Exp $". 81 | // 82 | ?> 83 | -------------------------------------------------------------------------------- /www/software.php: -------------------------------------------------------------------------------- 1 | Download\n"); 76 | 77 | print("

Your download should begin shortly. If not, please " 78 | ."click here to download the file " 79 | ."from the current mirror.

\n" 80 | ."
\n" 81 | ."\n" 83 | ."\n"); 85 | 86 | reset($MIRRORS); 87 | while (list($key, $val) = each($MIRRORS)) 88 | { 89 | print("$val[0]
\n"); 94 | } 95 | 96 | print("

\n" 97 | ."

\n"); 98 | } 99 | else 100 | { 101 | // Show files... 102 | print("

Releases

\n"); 103 | 104 | html_start_table(array("Version", "Filename", "Size", "MD5 Sum")); 105 | 106 | $curversion = ""; 107 | 108 | for ($i = 0; $i < sizeof($files); $i ++) 109 | { 110 | // Grab the data for the current file... 111 | $data = explode(" ", $files[$i]); 112 | $md5 = $data[0]; 113 | $fversion = $data[1]; 114 | $filename = $data[2]; 115 | $basename = basename($filename); 116 | 117 | if ($fversion == $version) 118 | { 119 | $cs = ""; 120 | $ce = ""; 121 | } 122 | else 123 | { 124 | $cs = ""; 125 | $ce = ""; 126 | } 127 | 128 | if ($fversion != $curversion) 129 | { 130 | if ($curversion != "") 131 | { 132 | html_start_row("header"); 133 | print(""); 134 | html_end_row(); 135 | } 136 | 137 | $curversion = $fversion; 138 | html_start_row(); 139 | print("$cs$fversion$ce"); 140 | } 141 | else 142 | { 143 | html_start_row(); 144 | print("$cs$ce"); 145 | } 146 | 147 | if (file_exists("/home/ftp.easysw.com/pub/$filename")) 148 | $kbytes = (int)((filesize("/home/ftp.easysw.com/pub/$filename") + 1023) / 1024); 149 | else 150 | $kbytes = "???"; 151 | 152 | print("$cs" 153 | ."$basename$ce" 154 | ."$cs${kbytes}k$ce" 155 | ."$cs$md5$ce"); 156 | 157 | html_end_row(); 158 | } 159 | 160 | html_end_table(); 161 | 162 | print("

Subversion Access

\n" 163 | ."

The $PROJECT_NAME software is available via Subversion " 164 | ."using the following URL:

\n" 165 | ."
\n"
166 |        ."    "
167 |        ."http://svn.easysw.com/public/$PROJECT_MODULE/\n"
168 |        ."
\n" 169 | ."

The following command can be used to checkout the current " 170 | ."$PROJECT_NAME source from Subversion:

\n" 171 | ."
\n"
172 |        ."    svn co http://svn.easysw.com/public/$PROJECT_MODULE/trunk/ $PROJECT_MODULE\n"
173 |        ."
\n"); 174 | } 175 | 176 | // Show the standard footer... 177 | html_footer(); 178 | 179 | // 180 | // End of "$Id$". 181 | // 182 | ?> 183 | -------------------------------------------------------------------------------- /www/strfiles/.htaccess: -------------------------------------------------------------------------------- 1 | DirectoryIndex off 2 | 3 | -------------------------------------------------------------------------------- /www/style.css: -------------------------------------------------------------------------------- 1 | BODY { 2 | background: #ffffff; 3 | color: #000000; 4 | font-family: sans-serif; 5 | margin: 15px; 6 | } 7 | 8 | P, TD, TH { 9 | color: #000000; 10 | font-family: sans-serif; 11 | } 12 | 13 | H1, H2, H3, H4, H5, H6 { 14 | color: #000000; 15 | font-family: sans-serif; 16 | } 17 | 18 | H2, H3, H4, H5, H6 { 19 | font-style: italic; 20 | } 21 | 22 | KBD { 23 | color: #006600; 24 | font-family: monospace; 25 | font-weight: bold; 26 | } 27 | 28 | PRE { 29 | color: #7f0000; 30 | font-family: monospace; 31 | } 32 | 33 | SUB, SUP { 34 | font-size: smaller; 35 | } 36 | 37 | FORM { 38 | display: inline; 39 | } 40 | 41 | INPUT[TYPE="TEXT"], INPUT[TYPE="PASSWORD"], INPUT[TYPE="SEARCH"], TEXTAREA { 42 | font-family: monospace; 43 | } 44 | 45 | A:link { 46 | font-family: sans-serif; 47 | text-decoration: none; 48 | color: #00007f; 49 | } 50 | 51 | A:visited { 52 | font-family: sans-serif; 53 | text-decoration: none; 54 | color: #0000bf; 55 | } 56 | 57 | A:hover { 58 | font-family: sans-serif; 59 | text-decoration: none; 60 | color: #7f0000; 61 | } 62 | 63 | A:active { 64 | font-family: sans-serif; 65 | text-decoration: underline; 66 | color: #bf0000; 67 | } 68 | 69 | TD.unsel, TD.sel { 70 | border-bottom: solid 1px black; 71 | padding: 1px 10px; 72 | vertical-align: bottom; 73 | } 74 | 75 | TD.unsel A, TD.sel A { 76 | font-weight: bold; 77 | padding: 1px 10px; 78 | } 79 | 80 | TD.sel A { 81 | border-bottom: solid 3px black; 82 | } 83 | 84 | TD.unsel A:hover, TD.sel A:hover { 85 | background: #f4f4f4; 86 | border-bottom: solid 3px #999999; 87 | } 88 | 89 | TD.page { 90 | height: 100%; 91 | padding: 10px 0px; 92 | vertical-align: top; 93 | } 94 | 95 | TD.footer { 96 | border-top: solid thin #666666; 97 | color: #666666; 98 | font-size: 80%; 99 | padding: 5px; 100 | } 101 | 102 | P.links { 103 | border-bottom: solid 1px #999999; 104 | margin-left: auto; 105 | margin-right: auto; 106 | padding: 0px 10px; 107 | text-align: center; 108 | vertical-align: bottom; 109 | width: 80%; 110 | } 111 | 112 | P.links A { 113 | padding: 0px 5px; 114 | } 115 | 116 | P.links A:hover { 117 | background: #f8f8f8; 118 | border-bottom: solid 3px #cccccc; 119 | } 120 | 121 | TABLE.standard { 122 | border-bottom: solid thin black; 123 | border-collapse: collapse; 124 | } 125 | 126 | TR.header TH { 127 | border-bottom: solid thin black; 128 | padding: 0px 5px; 129 | vertical-align: bottom; 130 | } 131 | 132 | TR.data0 TD, TR.data0 TH { 133 | background-color: #f8f8f8; 134 | padding: 2px; 135 | } 136 | 137 | TR.data1 TD, TR.data1 TH { 138 | background-color: #f4f4f4; 139 | padding: 2px; 140 | } 141 | 142 | .dateinfo { 143 | font-size: 80%; 144 | font-style: italic; 145 | } 146 | 147 | .invalid { 148 | background: red; 149 | color: white; 150 | font-weight: bold; 151 | padding: 2px; 152 | } 153 | /* Styles for documentation */ 154 | .class { 155 | border-bottom: solid 2px gray; 156 | } 157 | .constants { 158 | } 159 | .description { 160 | margin-top: 0.5em; 161 | } 162 | .discussion { 163 | } 164 | .enumeration { 165 | border-bottom: solid 2px gray; 166 | } 167 | .function { 168 | border-bottom: solid 2px gray; 169 | margin-bottom: 0; 170 | } 171 | .members { 172 | } 173 | .method { 174 | } 175 | .parameters { 176 | } 177 | .returnvalue { 178 | } 179 | .struct { 180 | border-bottom: solid 2px gray; 181 | } 182 | .typedef { 183 | border-bottom: solid 2px gray; 184 | } 185 | .union { 186 | border-bottom: solid 2px gray; 187 | } 188 | .variable { 189 | } 190 | code, p.code, pre, ul.code li { 191 | font-family: monaco, courier, monospace; 192 | font-size: 90%; 193 | } 194 | a:link, a:visited { 195 | text-decoration: none; 196 | } 197 | span.info { 198 | background: black; 199 | border: solid thin black; 200 | color: white; 201 | font-size: 80%; 202 | font-style: italic; 203 | font-weight: bold; 204 | white-space: nowrap; 205 | } 206 | h3 span.info, h4 span.info { 207 | float: right; 208 | font-size: 100%; 209 | } 210 | ul.code, ul.contents, ul.subcontents { 211 | list-style-type: none; 212 | margin: 0; 213 | padding-left: 0; 214 | } 215 | ul.code li { 216 | margin: 0; 217 | } 218 | ul.contents > li { 219 | margin-top: 1em; 220 | } 221 | ul.contents li ul.code, ul.contents li ul.subcontents { 222 | padding-left: 2em; 223 | } 224 | div.body dl { 225 | margin-top: 0; 226 | } 227 | div.body dt { 228 | font-style: italic; 229 | margin-top: 0; 230 | } 231 | div.body dd { 232 | margin-bottom: 0.5em; 233 | } 234 | h1.title { 235 | } 236 | h2.title { 237 | border-bottom: solid 2px black; 238 | } 239 | h3.title { 240 | border-bottom: solid 2px black; 241 | } 242 | -------------------------------------------------------------------------------- /www/swfiles/.htaccess: -------------------------------------------------------------------------------- 1 | DirectoryIndex off 2 | 3 | --------------------------------------------------------------------------------