This page lists some example code that may get you started.
DOMUtils class contains some potentionally useful methods. You should consider using the getLocalName() and getXmlns...() methods at least - they implements flawed DOM Level 1/2 methods correctly.
To obtain a list of all nodes on the ascendant-or-self axis just use
List<Node> ascendantOrSelf = DOMUtils.getNodePathToRoot(node);
For debugging purposes you may print nodes on this axis:
String pathToRoot = DOMUtils.getPathToRoot(node);
To get a string description of the node type:
String nodeType = DOMUtils.getNodeType(Node.ELEMENT_NODE); // nodeType is "ELEMENT_NODE"
To modify a DOM document use the DOMMutils (DOM Mutation Utilities) class. For example, to insert an element after fifth character of a text node (thus splitting this text node) use:
DOMMutils.insertNode(element, DomPointerFactory.create(textNode, 5), false);
There are two enums you may use to work with DOM events: EventClassEnum containing four enum classes: UI, Mouse, Mutation and HTML events, and EventTypesEnum providing all events and their description. Currently only Mutation events are enlisted in the enum, I'll add another events when requested by the community.
Some useful methods are provided by the SourceEnum enum: to convert a SAX source into a DOM source just use:
DOMSource ds = SourceEnum.DOM.convert(saxSource, null);
To copy from a Source to a Result just use:
SourceEnum.copy(SourceEnum.STAX.convert(domSource, null), staxResult);
A STAXSource extending Source and a STAXResult extending Result are provided, along with some utilities to read from/construct a DOM node using STAX events.
The NodeListAdapter class wraps the NamedNodeMap interface and provides the NodeList interface. You may obtain all nodes contained in a NodeList interface using
List<Node> nodes = DOMUtils.nodeListToList(node.getChildNodes());
You may use PipedExceptionInputStream to connect two threads using a pipe. If the producer thread fails, the exception is trasferred to the receiver, causing the receiver to fail in any read() method with the producer's exception. You may use IOWithCauseException exception to wrap any exception in the IOException.
Use ElementStack instance to verify in ContentHandler if elements are properly nested. You may use SAXDebuggerHandler and/or SAXDebuggerReader to print SAX events in a SAX chain. To wrap an exception in the SAXException use SAXExceptionFixed which sets the cause exception correctly.
To setup a parser you may use constants in SAXConstants class. Please note that not all parsers supports all these constants - this list was taken from the Xerces's features and properties list. The class currently does not contain properties yet.
The IDManager class allows you to create and/or obtain ID for each node in the document. It may be registered as an observer to capture changes in the document and remove/add id attributes to nodes being removed/added.