code: private void domToSax(final Node root) throws SAXException {
          try {
              final Result result = new SAXResult(new FilterHandler(getContentHandler()));
              final NodeList children = root.getChildNodes();
              for (int i = 0; i < children.getLength(); i++) {
                  final Node links = rewriteLinks((Element) children.item(i));
                  final Source source = new DOMSource(links);
                  saxToDomTransformer.transform(source, result);
              }
          } catch (TransformerException e) {
              throw new SAXException("Failed to serialize DOM node to SAX: " + e.getMessage(), e);
          }
      }
docs: DOM to SAX conversion methods