home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / parser.jar / com / sun / xml / tree / CommentNode.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-02-23  |  1.4 KB  |  64 lines

  1. package com.sun.xml.tree;
  2.  
  3. import java.io.IOException;
  4. import java.io.Writer;
  5. import org.w3c.dom.Comment;
  6. import org.w3c.dom.Node;
  7.  
  8. class CommentNode extends DataNode implements Comment {
  9.    public CommentNode() {
  10.    }
  11.  
  12.    public CommentNode(String var1) {
  13.       super(var1);
  14.    }
  15.  
  16.    CommentNode(char[] var1, int var2, int var3) {
  17.       super(var1, var2, var3);
  18.    }
  19.  
  20.    public Node cloneNode(boolean var1) {
  21.       CommentNode var2 = new CommentNode(super.data, 0, super.data.length);
  22.       ((NodeBase)var2).setOwnerDocument((XmlDocument)((NodeBase)this).getOwnerDocument());
  23.       return var2;
  24.    }
  25.  
  26.    public String getNodeName() {
  27.       return "#comment";
  28.    }
  29.  
  30.    public short getNodeType() {
  31.       return 8;
  32.    }
  33.  
  34.    public void writeXml(XmlWriteContext var1) throws IOException {
  35.       Writer var2 = var1.getWriter();
  36.       var2.write("<!--");
  37.       if (super.data != null) {
  38.          boolean var3 = false;
  39.          int var4 = super.data.length;
  40.  
  41.          for(int var5 = 0; var5 < var4; ++var5) {
  42.             if (super.data[var5] == '-') {
  43.                if (!var3) {
  44.                   var3 = true;
  45.                   var2.write(45);
  46.                   continue;
  47.                }
  48.  
  49.                var2.write(32);
  50.             }
  51.  
  52.             var3 = false;
  53.             var2.write(super.data[var5]);
  54.          }
  55.  
  56.          if (super.data[super.data.length - 1] == '-') {
  57.             var2.write(32);
  58.          }
  59.       }
  60.  
  61.       var2.write("-->");
  62.    }
  63. }
  64.