While processing instructions provide support for unstructured application-oriented information, comments provide a place for unstructured human-readable information. Comments do not have names, only content, and generally represent information that applications should ignore.
Comments are represented by IXMLDOMComment
objects, which are created using the createComment
method of DOMDocument
. Comments can appear before, after, or within the root element.
JScript
The following code creates a comment that says "catalog last updated 2000-11-01"
.
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.5.0"); var dateComment=xmlDoc.createComment("catalog last updated 2000-11-01"); xmlDoc.appendChild(dateComment);
VBScript
Set xmlDoc = CreateObject("Msxml2.DOMDocument.5.0") Set dateComment=xmlDoc.createComment("catalog last updated 2000-11-01") xmlDoc.appendChild(dateComment)
The contents of an IXMLDOMComment
object are always stored in its nodeValue
property.
For more information about properties and methods of IXMLDOMComment
, see IXMLDOMComment.