Code example for Document

Methods: createComment

0
    /** 
     * Lexical Handler method to create comment node in DOM tree. 
     */ 
    public void comment(char[] ch, int start, int length) {
	final Node last = (Node)_nodeStk.peek();
	Comment comment = _document.createComment(new String(ch,start,length));
	if (comment != null){
          if (last == _root && _nextSibling != null)
              last.insertBefore(comment, _nextSibling);
          else 
              last.appendChild(comment);
           
          _lastSibling = comment;
        } 
    } 
 
    // Lexical Handler methods- not implemented 
    public void startCDATA() { } 
    public void endCDATA() { } 
    public void startEntity(java.lang.String name) { }
    public void endDTD() { }