XML technologies / XML / XML in a Nutshell / DOM reference / Object reference / Comment

(Excerpt from "XML in a Nutshell" by Elliotte Rusty Harold & W. Scott Means)

This object contains the text of an XML comment, that is, the characters between <!-- and -->. Comment is an interface derived from CharacterData.

Note: The DOM specification does not require XML parsers to retain comments after parsing. Some implementations therefore discard comments during parsing.

Java example

// Ein Kommentar-Objekt wird erzeugt
Comment ndComment = doc.createComment("Das Dokument wurde vom
                    DOM-Werkzeug geparst.");

// und in das Dokument eingefügt
doc.appendChild(ndComment);

  

 

 

 

back to top