{"id":21436969,"url":"https://github.com/axfab/xstreaming","last_synced_at":"2025-08-18T18:06:47.563Z","repository":{"id":74655726,"uuid":"42124686","full_name":"AxFab/xstreaming","owner":"AxFab","description":"C++ Library for XML streaming. Fast parsing, handy for huge file and basic DOM implementation.","archived":false,"fork":false,"pushed_at":"2015-09-23T09:42:11.000Z","size":188,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-15T23:44:53.050Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AxFab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-08T16:26:54.000Z","updated_at":"2015-09-08T16:27:13.000Z","dependencies_parsed_at":"2023-03-11T17:34:35.745Z","dependency_job_id":null,"html_url":"https://github.com/AxFab/xstreaming","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AxFab/xstreaming","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxFab%2Fxstreaming","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxFab%2Fxstreaming/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxFab%2Fxstreaming/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxFab%2Fxstreaming/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AxFab","download_url":"https://codeload.github.com/AxFab/xstreaming/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxFab%2Fxstreaming/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271035481,"owners_count":24688419,"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","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-23T00:17:02.167Z","updated_at":"2025-08-18T18:06:47.495Z","avatar_url":"https://github.com/AxFab.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# XStreaming\n\nXStreaming is a library use to parse and build xml files. Instead of using \nthe common W3C standard this library provide a C++ implementation of the .NET\npackage `System.Xml.Linq`.\n\nAlso this library provide a way of loading Xml files as a stream. The \n`XReader` provide a read method capable to return xml objects as they come \nbefore the DOM is entirely build. This way parsed nodes can be freed to \nminimize memory consumption at no cost.\n\n## Usage \n\n### Simple usage\n\n```c++\nXElement* root = XElement::Load(\"MyFile\");\nstd::cout \u003c\u003c \"Load document XML : \" \u003c\u003c root.name() \u003c\u003c std::endl;\n// Note that ownership of XObject is always handle by the XDocument.\n// You should not destroy this element directly;\ndelete root-\u003edocument();\n```\n\n### Stream usage\n\n```c++\nclass MyCatalogReader {\n  XReader *reader_;\n  MyCatalog *build_;\n  explicit MyCatalogReader(XReader *reader)\n  {\n    reader_ = reader;\n  }\n\n  ~MyCatalogReader() \n  {\n    reader_-\u003edispose(); // Clean the underlying XDocument and close.\n    delete reader_;\n  }\n\n  MyCatalog *readCatalog() \n  {\n    XNode* current = reader_-\u003eread();\n    if (current-\u003enodeType() != XNODE_ELEMENT)\n      return NULL;\n    XElement* ndRoot = reinterpret_cast\u003cXElement*\u003e(current);\n    if (ndSchema-\u003ename() != \"catalog\")\n      return NULL;\n    build_ = new MyCatalog(ndRoot-\u003eattributeString(\"name\"));\n\n    if (reader_-\u003edidClose())\n      return build_; // The document contains only the '\u003ccatalog /\u003e' element\n\n    for (;;) {\n      XNode *node = reader_-\u003eread();\n      // When we get the same element, it's means we close it!\n      if (node == current) {\n        reader_-\u003edispose();\n        return build_;\n      }\n\n      if (node-\u003enodeType() != XNODE_ELEMENT)\n        continue;\n\n      XElement* ndChild = reinterpret_cast\u003cXElement*\u003e(node);\n      if (ndChild-\u003ename() == \"book\") {\n        build-\u003eadd(new Book(ndChild-\u003eattributeString(\"name\")))\n        node-\u003eremoveNodes(); // We limit memory consumtion this way!\n      } else if (ndChild-\u003ename() == \"album\") {\n        build-\u003eadd(new Album(ndChild-\u003eattributeString(\"name\")))\n        node-\u003eremoveNodes(); // We limit memory consumtion this way!\n      } \n      // We ignore other tags, we could also add warning for unknown element!\n    }\n  }\n\n  static MyCatalog *Read(cstr url)\n  {\n    XReader* read = new XReader(url);\n    MyCatalogReader libReader(read);\n    MyCatalog *catalog = libReader.readCatalog;\n  }\n}\n```\n\n\n## Internal design\n\n### Resource objects (like `XReader`)\n\n  Resource instance have a function named `close` hover they still respect \n  RAII (Resource Acquisition Is Initialization), as the destructor will \n  call the close automaticaly.\n\n  However some factory class will provide a second method named `dipsose`.\n  Such class usally have a resource that can be freed using close but also \n  create/instantiate some data. That are not release by a regular close and \n  as such won't be desallocate by the destructor.\n\n  To desallocate all you need to use the dispose function.\n  The principe here is that you get the choice of who gonna be te owner of \n  the new object. Often you want the factory to allocate your object and \n  then grab the ownership. But some other time the objects created are just \n  temporary, in this case the ownership should be keeped by the factory \n  class, But you will need to manually called the dispose methods.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxfab%2Fxstreaming","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faxfab%2Fxstreaming","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxfab%2Fxstreaming/lists"}