Your user-friendly, namespace aware SAX wrapper to transform XML files easily, with memory consumption in mind.
Saxeed, a SAX wrapper, stream process XML input performing modifications to its outputs based on predefined transformation(s).
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.
Each tag visitor 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.
Saxeed is an Open Source library, and we welcome contribution. File your Issue or an MR now!
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.