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

Method printXml

src/main/java/org/htmlunit/html/DomElement.java:349–382  ·  view source on GitHub ↗

{@inheritDoc}

(final String indent, final boolean tagBefore, final PrintWriter printWriter)

Source from the content-addressed store, hash-verified

347 * {@inheritDoc}
348 */
349 @Override
350 protected boolean printXml(final String indent, final boolean tagBefore, final PrintWriter printWriter) {
351 final boolean hasChildren = getFirstChild() != null;
352
353 if (tagBefore) {
354 printWriter.print("\r\n");
355 printWriter.print(indent);
356 }
357
358 printWriter.print('<');
359 printOpeningTagContentAsXml(printWriter);
360
361 if (hasChildren) {
362 printWriter.print(">");
363 final boolean tag = printChildrenAsXml(indent, true, printWriter);
364 if (tag) {
365 printWriter.print("\r\n");
366 printWriter.print(indent);
367 }
368 printWriter.print("</");
369 printWriter.print(getTagName());
370 printWriter.print(">");
371 }
372 else if (isEmptyXmlTagExpanded()) {
373 printWriter.print("></");
374 printWriter.print(getTagName());
375 printWriter.print(">");
376 }
377 else {
378 printWriter.print("/>");
379 }
380
381 return true;
382 }
383
384 /**
385 * Indicates if a node without children should be written in expanded form as XML

Callers

nothing calls this directly

Calls 6

getTagNameMethod · 0.95
isEmptyXmlTagExpandedMethod · 0.95
getFirstChildMethod · 0.45
printMethod · 0.45
printChildrenAsXmlMethod · 0.45

Tested by

no test coverage detected