Code example for DOMImplementation

Methods: createDocument

0
    InputSource input = new InputSource(new StringReader(source));
    DOMFragmentParser parser = new DOMFragmentParser();
    parser.setProperty("http://cyberneko.org/html/properties/names/elems", "default");
    parser.setFeature("http://cyberneko.org/html/features/document-fragment", true);
 
    Document htmlDoc = documentProvider.createDocument(null, null, null);
    DocumentFragment fragment = htmlDoc.createDocumentFragment();
    parser.parse(input, fragment);
    normalizeFragment(htmlDoc, fragment);
    return htmlDoc;
  } 
 
  static class Serializer extends HtmlSerializer { 
 
    static final OutputFormat outputFormat = new OutputFormat();
    static { 
      outputFormat.setPreserveSpace(true);
      outputFormat.setPreserveEmptyAttributes(false);
    } 
 
    public String serializeImpl(Document doc) {