Recursively appends a Node child to DomNode parent. @param page the owner page of DomElements to be created @param parent the parent DomNode @param child the child Node @param handleXHTMLAsHTML if true elements from the XHTML namespace are handled as HTML elements instead of
(final SgmlPage page, final DomNode parent, final Node child,
final boolean handleXHTMLAsHTML)
| 214 | * DOM elements |
| 215 | */ |
| 216 | public static void appendChild(final SgmlPage page, final DomNode parent, final Node child, |
| 217 | final boolean handleXHTMLAsHTML) { |
| 218 | final DocumentType documentType = child.getOwnerDocument().getDoctype(); |
| 219 | if (documentType != null && page instanceof XmlPage xmlPage) { |
| 220 | final DomDocumentType domDoctype = new DomDocumentType( |
| 221 | page, documentType.getName(), documentType.getPublicId(), documentType.getSystemId()); |
| 222 | xmlPage.setDocumentType(domDoctype); |
| 223 | } |
| 224 | final DomNode childXml = createFrom(page, child, handleXHTMLAsHTML); |
| 225 | parent.appendChild(childXml); |
| 226 | copy(page, child, childXml, handleXHTMLAsHTML); |
| 227 | } |
| 228 | |
| 229 | private static DomNode createFrom(final SgmlPage page, final Node source, final boolean handleXHTMLAsHTML) { |
| 230 | if (source.getNodeType() == Node.TEXT_NODE) { |
no test coverage detected