{"id":27020369,"url":"https://github.com/awesomo4000/pugixml","last_synced_at":"2025-04-09T18:00:07.870Z","repository":{"id":286162107,"uuid":"960546949","full_name":"awesomo4000/pugixml","owner":"awesomo4000","description":"Zig wrapper interface to pugixml C++ library","archived":false,"fork":false,"pushed_at":"2025-04-04T17:04:15.000Z","size":103,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-04T18:21:43.624Z","etag":null,"topics":["xml","zig"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/awesomo4000.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-04-04T16:12:37.000Z","updated_at":"2025-04-04T17:13:24.000Z","dependencies_parsed_at":"2025-04-04T18:21:49.190Z","dependency_job_id":"3f18e3d4-b872-4cb1-a45c-ffea707c5324","html_url":"https://github.com/awesomo4000/pugixml","commit_stats":null,"previous_names":["awesomo4000/pugixml"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awesomo4000%2Fpugixml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awesomo4000%2Fpugixml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awesomo4000%2Fpugixml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awesomo4000%2Fpugixml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/awesomo4000","download_url":"https://codeload.github.com/awesomo4000/pugixml/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248083911,"owners_count":21045123,"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":["xml","zig"],"created_at":"2025-04-04T18:29:55.711Z","updated_at":"2025-04-09T18:00:07.835Z","avatar_url":"https://github.com/awesomo4000.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Zig wrapper for pugixml (C++ xml parser)\n\nThis is a set of wrappers with a nice zig interface to the pugixml C++ xml library.\n\nPugixml C++ (https://pugixml.org/) is a high-speed in-situ XML parser. It parses XML to a DOM structure without doing much copying of the data (using pointers). It is one of the fastest XML parsers available. XML files must fit in memory with an overhead of about 25%.\n\nThe code for pugixml C++ (currently v1.15) is included in this repo in the `src/c/pugi*.[ch]pp` files. The zig c-\u003ecpp interface to the library files are in `src/c/zig-pugixml.cpp` and `src/c/zig-pugixml.h`.\n\n\n## Using:\n\nIn your zig project, run:\n\n\n`zig fetch --save=pugixml https://github.com/awesomo4000/pugixml/archive/refs/tag/v0.2.1.tar.gz`\n\nIn build.zig:\n\n```zig\n\n    // Define the dependency\n\n    const pugixml_dep = b.dependency(\"pugixml\", .{\n        .target = target,\n        .optimize = optimize,\n    });\n\n    // Use it with a module\n\n    const exe_mod = b.createModule(.{\n        .root_source_file = b.path(\"src/main.zig\"),\n        .target = target,\n        .optimize = optimize,\n    });\n    exe_mod.addImport(\"pugixml\", pugixml_dep.module(\"pugixml\"));\n\n```\n\nAfter modifying build.zig, you may import \"pugixml\" in your zig source:\n\n```zig\n\nconst pugixml = @import(\"pugixml\");\n\n```\n\nRefer to `src/tests.zig` to see examples of usage.\n\n\n## C++ and Zig\n\nUsing C++ code from Zig requires a translation layer using the C++ code from C, then exporting the C functions via `extern C` in the C header file. Zig code then imports the C header file to reference its definitions. This code is linked into the final binary (staticly for this binding).\n\nLook in `src/c/zig-pugixml.h` to see how zig does C imports.\n\nCheck out `build.zig` to see how the build system compiles the C++ library and links it to the Zig module.\n\n## Sample program: `parse-xml`\n\nThere is a sample program `parse-xml` included in the build that shows how to use the zig module. It times how long it takes to parse an XML file. Example:\n\n```\n$ ./zig-out/bin/parse-xml\nUsage: parse-xml filename\n\n$ ls -lh ./big-testfile.xml\n-rw-r--r-- 434M Jan 15 03:12 ./big-testfile.xml\n\n$ ./zig-out/bin/parse-xml ./big-testfile.xml \n./big-testfile.xml: No error.\nElapsed time: 224.362ms.\n```\n\n`parse-xml` should run fine against malformed data, e.g.:\n\n```\n$ ./zig-out/bin/parse-xml /dev/random\n/dev/random: Error reading from file/stream.\nElapsed time: 0.059ms.\n```\n\n## Building:\n\nUse version 0.14.0 of Zig to build.\n\nCross-compiled builds produced working versions for the following platforms:\n\n   - x86_64-windows\n   - aarch64-windows\n   - aarch64-linux\n   - aarch64-macos\n\n\n### For production builds:\n\n```\nzig build --release=fast\n\nzig build --release=small\n```\n\n### For debug build (the default):\n\n`zig build`\n\n### Building for other OSes\n\nBy default, Zig builds for the OS running the compiler.  To cross compile for a different system, use commands like these:\n\n`zig build -Dtarget=x86-64-winodws --release=small`\n\n`zig build -Dtarget=aarch64-windows --release=fast`\n\n`zig build -Dtarget=x86-64-linux --release=fast`\n\n`zig build -Dtarget=aarch64-linux --release=fast`\n\n\n## Tests\n\nFor tests in debug mode:\n\n`zig build test` \n\nFor tests in release mode: \n\n`zig build test --release=fast`\n\nA clean test run will return no output, which means all tests passed. The exit code should be 0 for a good test run.\n\n\n## Build Artifacts\n\nOutput from build is in `./zig-out`, with sample binary `parse-xml` in `./zig-out/bin/parse-xml`. \n\nInclude files and C code is in `./zig-out/include`.\n\nThe static library for pugixml C++ created during the build is in `./zig-out/lib/libpugixml_cpp.a` .\n\n\n## Build options\n\nUse `zig build -h` to see other options and build commands:\n\n```\n$ zig build -h\nUsage: zig build [steps] [options]\n\nSteps:\n  install (default)            Copy build artifacts to prefix path\n  uninstall                    Remove build artifacts from prefix path\n  run                          run parse-xml\n  test                         run tests\n  clean                        Clean up\n  tarball                      Make tarball from sources\n\n...\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawesomo4000%2Fpugixml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fawesomo4000%2Fpugixml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawesomo4000%2Fpugixml/lists"}