Package com.ganteater.ae.util.xml.easyparser


package com.ganteater.ae.util.xml.easyparser
Lightweight, non-validating XML parsing with a simple in-memory node tree.

The primary entry point is EasyParser, which parses small XML payloads into a mutable tree of Node instances. The implementation is intentionally minimal and focuses on convenience for configuration-like documents rather than full XML compliance.

Core model

Parsing behavior

  • Leading <?xml ... ?> headers are skipped by the stream-based parser.
  • <!DOCTYPE ...> declarations are removed before parsing.
  • XML comments (<!-- ... -->) are converted into nodes with the tag name Comment. When serializing, Comment nodes are emitted as XML comments.
  • The parser does not perform DTD/XSD validation.

Utilities

  • NodeMapper can create missing elements along a /-separated path and set an attribute on the terminal element.
  • EasyUtils provides small recursive helpers such as removing an attribute (for example Node.TAG_ID) across a subtree.
  • ParserException wraps errors from stream-based parsing.

Example

 EasyParser parser = new EasyParser();
 Node root = parser.getObject("<root><child id=\"1\">text</child></root>");

 Node child = root.getNodes("child")[0];
 String id = child.getAttribute("id");
 String text = child.getInnerText();

 String xml = root.getXMLText();