public Document createDOM(TagNode rootNode) throws ParserConfigurationException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); DOMImplementation impl = builder.getDOMImplementation(); Document document; // // Where a DOCTYPE is supplied in the input, ensure that this is in the output DOM. See issue #27 // if (rootNode.getDocType() != null){ String qualifiedName = rootNode.getDocType().getPart1(); String publicId = rootNode.getDocType().getPublicId(); String systemId = rootNode.getDocType().getSystemId(); DocumentType documentType = impl.createDocumentType(qualifiedName, publicId, systemId); document = impl.createDocument(rootNode.getNamespaceURIOnPath(""), qualifiedName, documentType); } else { document = builder.newDocument(); Element rootElement = document.createElement(rootNode.getName()); document.appendChild(rootElement); } createSubnodes(document, (Element)document.getDocumentElement(), rootNode.getAllChildren()); return document; }
if (rootNode.getDocType() != null) { String qualifiedName = rootNode.getDocType().getPart1(); String publicId = rootNode.getDocType().getPublicId(); String systemId = rootNode.getDocType().getSystemId();
DoctypeToken doctypeToken = tagNode.getDocType(); if ( doctypeToken != null ) { doctypeToken.serialize(this, writer);
DoctypeToken doctypeToken = tagNode.getDocType(); if (doctypeToken != null) { doctypeToken.serialize(this, writer);
private HeadlessTagNode(TagNode wrappedNode) { super(""); getAttributes().putAll(wrappedNode.getAttributes()); addChildren(wrappedNode.getAllChildren()); setDocType(wrappedNode.getDocType()); Map<String, String> nsDecls = getNamespaceDeclarations(); if (nsDecls != null) { Map<String, String> wrappedNSDecls = wrappedNode.getNamespaceDeclarations(); if (wrappedNSDecls != null) { nsDecls.putAll(wrappedNSDecls); } } } }
private HeadlessTagNode(TagNode wrappedNode) { super(""); getAttributes().putAll(wrappedNode.getAttributes()); addChildren(wrappedNode.getAllChildren()); setDocType(wrappedNode.getDocType()); Map<String, String> nsDecls = getNamespaceDeclarations(); if (nsDecls != null) { Map<String, String> wrappedNSDecls = wrappedNode.getNamespaceDeclarations(); if (wrappedNSDecls != null) { nsDecls.putAll(wrappedNSDecls); } } } }
if (rootNode.getDocType() != null) { String qualifiedName = rootNode.getDocType().getPart1(); String publicId = rootNode.getDocType().getPublicId(); String systemId = rootNode.getDocType().getSystemId();