{"id":30139587,"url":"https://github.com/irgaly/original-characters-stax-xml-parser","last_synced_at":"2026-04-12T22:42:34.972Z","repository":{"id":42494304,"uuid":"452269252","full_name":"irgaly/original-characters-stax-xml-parser","owner":"irgaly","description":"A Stax Parser Wrapper with original texts from input XML.","archived":false,"fork":false,"pushed_at":"2025-07-13T05:56:16.000Z","size":416,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-13T07:35:46.532Z","etag":null,"topics":["java","kotlin","stax","xml"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/irgaly.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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,"zenodo":null},"funding":{"github":"irgaly","custom":["https://github.com/irgaly/irgaly"]}},"created_at":"2022-01-26T12:36:44.000Z","updated_at":"2025-07-13T05:55:45.000Z","dependencies_parsed_at":"2022-09-06T01:41:06.717Z","dependency_job_id":"4eb08727-cf07-41a6-8e91-4e6299a68dc9","html_url":"https://github.com/irgaly/original-characters-stax-xml-parser","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/irgaly/original-characters-stax-xml-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irgaly%2Foriginal-characters-stax-xml-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irgaly%2Foriginal-characters-stax-xml-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irgaly%2Foriginal-characters-stax-xml-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irgaly%2Foriginal-characters-stax-xml-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/irgaly","download_url":"https://codeload.github.com/irgaly/original-characters-stax-xml-parser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irgaly%2Foriginal-characters-stax-xml-parser/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269819032,"owners_count":24480087,"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-11T02:00:10.019Z","response_time":75,"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":["java","kotlin","stax","xml"],"created_at":"2025-08-11T02:15:30.104Z","updated_at":"2026-04-12T22:42:29.942Z","avatar_url":"https://github.com/irgaly.png","language":"Kotlin","funding_links":["https://github.com/sponsors/irgaly","https://github.com/irgaly/irgaly"],"categories":[],"sub_categories":[],"readme":"# original-characters-stax-xml-parser\n\nA Stax Parser Wrapper with original texts from input XML.\n\nThis library is useful to parse and modify XML, with preserving original characters and original XML\nstructures.\n\nexmple: preserving spaces and indent tabs, don't extract `\u0026#{unicode};`, don't replace `\u003e`\nwith `\u0026gt;`, don't replace XML empty tag...\n\nThis is a simple wrapper to [Woodstox](https://github.com/FasterXML/woodstox) Stax2 XML Parser.\n\n## Usage\n\nThis library is published to Maven Central Repository.\n\nEnsure `mavenCentral()` is declared.\n\n`settings.gradle.kts`\n\n```kotlin\ndependencyResolutionManagement {\n    repositories {\n        //...\n        mavenCentral()\n    }\n}\n```\n\nAdd dependencies.\n\n`build.gradle.kts`\n\n```kotlin\ndependencies {\n  implementation(\"io.github.irgaly.xml:original-characters-stax:1.1.0\")\n}\n```\n\nThen use library!\n\n## Class Documents\n\n[There are KDoc references.](docs/index.md)\n\n## OriginalCharactersStaxXmlParser class\n\nOriginalCharactersStaxXml class sample.\n\nThis class is a simple wrapper class to Woodstox's WstxEventReader class.\n\n```kotlin\nval inputStream = File(\"input.xml\").inputStream()\nval parser = OriginalCharactersStaxXmlParser(inputStream)\nwhile (parser.hasNext()) {\n    val event = parser.nextEvent()\n    println(\"original text:[${event.originalText}]\")\n}\nparser.close() // parser closes inputStream too.\n```\n\nparser.nextEvent() returns XmlEvent, that has both of Stax original Event and XML original Text.\n\n```kotlin\nevent.event // Stax2's XMLEvent2\nevent.originalText // Original XML's Texts\n```\n\nThat sample code's input and output is below.\n\n`input.xml`\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003c!-- header comment --\u003e\n\u003cresources\u003e\n    \u003c!-- comment1 --\u003e\n    \u003creference\u003e\u0026apos; \u0026amp;\u003c/reference\u003e\n    \u003csurrogate\u003e\u0026#x1F6AD;\u003c/surrogate\u003e\n    \u003cempty\u003e\u003c/empty\u003e\n\u003c/resources\u003e\n\u003c!-- footer comment --\u003e\n```\n\noutputs\n\n```shell\noriginal text:[\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e]\noriginal text:[\n]\noriginal text:[\u003c!-- header comment --\u003e]\noriginal text:[\n]\noriginal text:[\u003cresources\u003e]\noriginal text:[\n    ]\noriginal text:[\u003c!-- comment1 --\u003e]\noriginal text:[\n    ]\noriginal text:[\u003creference\u003e]\noriginal text:[\u0026apos; \u0026amp;]\noriginal text:[\u003c/reference\u003e]\noriginal text:[\n    ]\noriginal text:[\u003csurrogate\u003e]\noriginal text:[\u0026#x1F6AD;]\noriginal text:[\u003c/surrogate\u003e]\noriginal text:[\n    ]\noriginal text:[\u003cempty\u003e]\noriginal text:[\u003c/empty\u003e]\noriginal text:[\n]\noriginal text:[\u003c/resources\u003e]\noriginal text:[\n]\noriginal text:[\u003c!-- footer comment --\u003e]\noriginal text:[]\n```\n\n## More documentation for Stax2\n\n* [Github Woodstox](https://github.com/FasterXML/woodstox)\n* Stax Configurations\n    * [Stax1 Properties](https://cowtowncoder.medium.com/configuring-woodstox-xml-parser-basic-stax-properties-39bdf88c18ec)\n    * [Stax2 Properties](https://cowtowncoder.medium.com/configuring-woodstox-xml-parser-stax2-properties-c80ef5a32ef1)\n    * [Woodstox Properties](https://cowtowncoder.medium.com/configuring-woodstox-xml-parser-woodstox-specific-properties-1ce5030a5173)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firgaly%2Foriginal-characters-stax-xml-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Firgaly%2Foriginal-characters-stax-xml-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firgaly%2Foriginal-characters-stax-xml-parser/lists"}