November 2002
Intermediate to advanced
1120 pages
21h 2m
English
XML comments don't have a lot of structure. They're really just some undifferentiated text inside <!-- and -->. Therefore, the Comment interface, shown in Example 11.19, is a subinterface of CharacterData and shares all of its method with that interface. However, your code can use the type to determine that a node is a comment, and treat it appropriately. Serializers will be smart enough to output a Comment with the right markup around it.
package org.w3c.dom;
public interface Comment extends CharacterData {
}
|
In Example 7.12, I demonstrated a SAX program that reads comments. Now in Example 11.20, you can see the DOM equivalent. The approach is different—actively walking a tree instead ...
Read now
Unlock full access