https://github.com/olivergondza/saxeed
Sufficiently Advanced XML Eventing Editor
https://github.com/olivergondza/saxeed
java low-memory-footprint streaming-api transformation xml
Last synced: about 1 year ago
JSON representation
Sufficiently Advanced XML Eventing Editor
- Host: GitHub
- URL: https://github.com/olivergondza/saxeed
- Owner: olivergondza
- License: mit
- Created: 2024-03-25T11:53:52.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-08T07:29:35.000Z (almost 2 years ago)
- Last Synced: 2025-01-23T07:46:18.306Z (over 1 year ago)
- Topics: java, low-memory-footprint, streaming-api, transformation, xml
- Language: Java
- Homepage:
- Size: 2.18 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sufficiently Advanced XML Eventing EDitor
Your user-friendly, namespace aware tool to transform XML files easily, with memory consumption in mind.
[](https://github.com/olivergondza/saxeed/actions/workflows/ci.yaml)
[](https://central.sonatype.com/artifact/com.github.olivergondza/saxeed)
[](https://javadoc.io/doc/com.github.olivergondza/saxeed)
## Spirit
Saxeed, a SAX wrapper, traverses XML input document performing predefined transformations, and writes the resulting XML document to declared output.
It accepts the constraints of "streaming" (or "eventing") approach — elements are visited one-by-one with no option to move around the stream.
This is a tradeoff we accept in return for predictable memory footprint.
The very nature of stream-based processing restricts the data that are available in every moment, and modifications that are permitted.
To accommodate that, developer needs to accept a paradigm shift compared to, say, dom4j.
Saxeed strives to add as much convenience on top of plain old SAX, while adding as little of an overhead.
### Capabilities
Each tag visitor can do the following:
| operation / event | Tag Start | Tag End | Text Content |
|-----------------------------------------|------------------------|------------------------|--------------|
| Access Tag attributes | ☑ | ☑ | ☑ |
| Access Parent(s) Tag attributes | ☑ | ☑ | ☑ |
| Add Child Tags/Text | ☑ | ☑ (before closing tag) | ☑ |
| Add Sibling Tags/text (NOT IMPLEMENTED) | ☑ (before and after) | ☑ (only after) | ☑ |
| Add Parent Tag (`wrapWith()`) | ☑ | ☐ | ☑ |
| Change Attributes | ☑ | ☐ | ☐ |
| Delete Tag (`unwrap()`) | ☑ | ☐ | n/a |
| Delete Tag Recursively (`skip()`) | ☑ | ☐ | n/a |
| Delete Child Tags (`empty()`) | ☑ | ☐ | n/a |
More complex changes can be implemented by subscribing visitors to multiple tags, and retaining information between their visits.
## Usage
- [Basic Concepts](./docs/BASICS.md)
- [Implementing Visitors](./docs/VISITORS.md)
## Maintenance
### Contributing
Saxeed is an Open Source library, and we welcome contribution. File your Issue or an MR now!
### Releasing
The library is released to maven central.
To produce a new release, run `git tag X.Y.Z` and then `mvn deploy`.
To deploy `-SNAPSHOT`, run `mvn deploy` on a commit without tag.