MCPcopy Index your code
hub / github.com/HtmlUnit/htmlunit / appendChild

Method appendChild

src/main/java/org/htmlunit/util/XmlUtils.java:216–227  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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) {

Callers 3

transformToFragmentMethod · 0.95
XmlPageMethod · 0.95
copyMethod · 0.45

Calls 8

getNameMethod · 0.95
getPublicIdMethod · 0.95
getSystemIdMethod · 0.95
createFromMethod · 0.95
copyMethod · 0.95
getDoctypeMethod · 0.45
getOwnerDocumentMethod · 0.45
setDocumentTypeMethod · 0.45

Tested by

no test coverage detected