{"id":16647181,"url":"https://github.com/michaelrsweet/mxml","last_synced_at":"2025-05-16T07:05:32.703Z","repository":{"id":37665029,"uuid":"83096734","full_name":"michaelrsweet/mxml","owner":"michaelrsweet","description":"Tiny XML library.","archived":false,"fork":false,"pushed_at":"2025-01-19T17:24:59.000Z","size":30406,"stargazers_count":469,"open_issues_count":5,"forks_count":168,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-05-09T17:21:31.363Z","etag":null,"topics":["ansi","mini-xml","xml-data","xml-files","xml-node-trees"],"latest_commit_sha":null,"homepage":"https://www.msweet.org/mxml","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michaelrsweet.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"michaelrsweet","liberapay":"michaelrsweet"}},"created_at":"2017-02-25T01:19:51.000Z","updated_at":"2025-04-18T08:18:07.000Z","dependencies_parsed_at":"2024-04-21T22:29:45.101Z","dependency_job_id":"1e319b44-696f-4292-83f5-5f40db04aa6e","html_url":"https://github.com/michaelrsweet/mxml","commit_stats":{"total_commits":656,"total_committers":10,"mean_commits":65.6,"dds":"0.35518292682926833","last_synced_commit":"804c4f4d922e4ca240ce2cad3ec7bc5d00c08691"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelrsweet%2Fmxml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelrsweet%2Fmxml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelrsweet%2Fmxml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelrsweet%2Fmxml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaelrsweet","download_url":"https://codeload.github.com/michaelrsweet/mxml/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254485060,"owners_count":22078767,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansi","mini-xml","xml-data","xml-files","xml-node-trees"],"created_at":"2024-10-12T08:44:05.159Z","updated_at":"2025-05-16T07:05:27.687Z","avatar_url":"https://github.com/michaelrsweet.png","language":"C","readme":"Mini-XML - Tiny XML Parsing Library v4\n======================================\n\n![Version](https://img.shields.io/github/v/release/michaelrsweet/mxml?include_prereleases)\n![Apache 2.0](https://img.shields.io/github/license/michaelrsweet/mxml)\n![Build](https://github.com/michaelrsweet/mxml/workflows/Build/badge.svg)\n[![Coverity Scan Status](https://img.shields.io/coverity/scan/23959.svg)](https://scan.coverity.com/projects/michaelrsweet-mxml)\n\n\nMini-XML is a small XML parsing library that you can use to read XML data files\nor strings in your application without requiring large non-standard libraries.\nMini-XML only requires a \"make\" program and a C99 compatible compiler - GCC\nworks, as do most vendors' C compilers.\n\nMini-XML provides the following functionality:\n\n- Reading of UTF-8 and UTF-16 and writing of UTF-8 encoded XML files and\n  strings.\n- Data is stored in a linked-list tree structure, preserving the XML data\n  hierarchy.\n- SAX (streamed) reading of XML files and strings to minimize memory usage.\n- Supports arbitrary element names, attributes, and attribute values with no\n  preset limits, just available memory.\n- Supports integer, real, opaque, text, and custom data types in \"leaf\" nodes.\n- Functions for creating and managing trees of data.\n- \"Find\" and \"walk\" functions for easily locating and navigating trees of data.\n- Support for custom string memory management functions to implement string\n  pools and other schemes for reducing memory usage.\n\nMini-XML doesn't do validation or other types of processing on the data\nbased upon schema files or other sources of definition information.\n\n\nBuilding Mini-XML\n-----------------\n\nMini-XML comes with an autoconf-based configure script; just type the\nfollowing command to get things going:\n\n    ./configure\n\nThe default install prefix is `/usr/local`, which can be overridden using the\n`--prefix` option:\n\n    ./configure --prefix=/foo\n\nOther configure options can be found using the `--help` option:\n\n    ./configure --help\n\nOnce you have configured the software, type `make` to do the build and run\nthe test program to verify that things are working, as follows:\n\n    make\n\nIf you are using Mini-XML under Microsoft Windows with Visual C++, use the\nincluded project files in the `vcnet` subdirectory to build the library\ninstead.  Note: The static library on Windows is NOT thread-safe.\n\n\nInstalling Mini-XML\n-------------------\n\nThe `install` target will install Mini-XML in the lib and include\ndirectories:\n\n    sudo make install\n\nOnce you have installed it, use the `-lmxml` option to link your application\nagainst it.\n\n\nDocumentation\n-------------\n\nThe documentation is available in the `doc` subdirectory in the files\n`mxml.html` (HTML) and `mxml.epub` (EPUB).  You can also look at the\n`testmxml.c` source file for examples of using Mini-XML.\n\nMini-XML provides a single header file which you include:\n\n    #include \u003cmxml.h\u003e\n\nNodes (elements, comments, declarations, integers, opaque strings, processing\ninstructions, real numbers, and text strings) are represented by `mxml_node_t`\npointers.  New nodes can be created using the mxmlNewXxx functions.  The top\nnode must be the `\u003c?xml ...?\u003e` processing instruction.\n\nYou load an XML file using the mxmlLoadFilename function:\n\n    mxml_node_t *tree;\n\n    tree = mxmlLoadFilename(/*top*/NULL, /*options*/NULL,\n                            \"example.xml\");\n\nSimilarly, you save an XML file using the mxmlSaveFilename function:\n\n    mxml_node_t *tree;\n\n    mxmlSaveFilename(tree, /*options*/NULL,\n                     \"filename.xml\");\n\nThere are variations of these functions for loading from or saving to file\ndescriptors, `FILE` pointers, strings, and IO callbacks.\n\nYou can find a named element/node using the mxmlFindElement function:\n\n    mxml_node_t *node = mxmlFindElement(tree, tree, \"name\", \"attr\",\n\t\t\t\t\t\"value\", MXML_DESCEND_ALL);\n\nThe `name`, `attr`, and `value` arguments can be passed as `NULL` to act as\nwildcards, e.g.:\n\n    /* Find the first \"a\" element */\n    node = mxmlFindElement(tree, tree, \"a\", NULL, NULL, MXML_DESCEND_ALL);\n\n    /* Find the first \"a\" element with \"href\" attribute */\n    node = mxmlFindElement(tree, tree, \"a\", \"href\", NULL, MXML_DESCEND_ALL);\n\n    /* Find the first \"a\" element with \"href\" to a URL */\n    node = mxmlFindElement(tree, tree, \"a\", \"href\",\n                           \"https://www.msweet.org/mxml\", MXML_DESCEND_ALL);\n\n    /* Find the first element with a \"src\" attribute*/\n    node = mxmlFindElement(tree, tree, NULL, \"src\", NULL, MXML_DESCEND_ALL);\n\n    /* Find the first element with a \"src\" = \"foo.jpg\" */\n    node = mxmlFindElement(tree, tree, NULL, \"src\", \"foo.jpg\",\n                           MXML_DESCEND_ALL);\n\nYou can also iterate with the same function:\n\n    mxml_node_t *node;\n\n    for (node = mxmlFindElement(tree, tree, \"name\", NULL, NULL,\n\t\t\t\tMXML_DESCEND_ALL);\n\t node != NULL;\n\t node = mxmlFindElement(node, tree, \"name\", NULL, NULL,\n\t\t\t\tMXML_DESCEND_ALL))\n    {\n      ... do something ...\n    }\n\nThe mxmlFindPath function finds the (first) value node under a specific\nelement using an XPath:\n\n    mxml_node_t *value = mxmlFindPath(tree, \"path/to/*/foo/bar\");\n\nThe mxmlGetInteger, mxmlGetOpaque, mxmlGetReal, and mxmlGetText functions\nretrieve the corresponding value from a node:\n\n    mxml_node_t *node;\n\n    int intvalue = mxmlGetInteger(node);\n\n    const char *opaquevalue = mxmlGetOpaque(node);\n\n    double realvalue = mxmlGetReal(node);\n\n    bool whitespacevalue;\n    const char *textvalue = mxmlGetText(node, \u0026whitespacevalue);\n\nFinally, once you are done with the XML data, use the mxmlDelete function to\nrecursively free the memory that is used for a particular node or the entire\ntree:\n\n    mxmlDelete(tree);\n\n\nGetting Help And Reporting Problems\n-----------------------------------\n\nThe [Mini-XML project page](https://www.msweet.org/mxml) provides access to the\ncurrent version of this software, documentation, and Github issue tracking page.\n\n\nLegal Stuff\n-----------\n\nCopyright © 2003-2025 by Michael R Sweet\n\nThe Mini-XML library is licensed under the Apache License Version 2.0 with an\n*optional* exception to allow linking against GPL2/LGPL2-only software.  See the\nfiles \"LICENSE\" and \"NOTICE\" for more information.\n\n\u003e Note: The exception listed in the NOTICE file only applies when linking\n\u003e against GPL2/LGPL2-only software.  Some Apache License purists have objected\n\u003e to linking Apache Licensed code against Mini-XML with these exceptions on the\n\u003e grounds that it makes Mini-XML somehow incompatible with the Apache License.\n\u003e For that reason, people wishing to retain their Apache License purity may\n\u003e omit the exception from their copy of Mini-XML.\n\u003e\n\u003e Note 2: IANAL, but I am beginning to dislike them!\n","funding_links":["https://github.com/sponsors/michaelrsweet","https://liberapay.com/michaelrsweet"],"categories":["XML","排序","XML ##"],"sub_categories":["XML","Vim ###"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelrsweet%2Fmxml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaelrsweet%2Fmxml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelrsweet%2Fmxml/lists"}