1 29 30 package com.caucho.xml.stream.events; 31 32 import javax.xml.stream.XMLStreamException; 33 import javax.xml.stream.events.Comment; 34 import java.io.IOException ; 35 import java.io.Writer ; 36 37 public class CommentImpl extends XMLEventImpl implements Comment { 38 private final String _text; 39 40 public CommentImpl(String text) 41 { 42 _text = text; 43 } 44 45 public String getText() 46 { 47 return _text; 48 } 49 50 public int getEventType() 51 { 52 return COMMENT; 53 } 54 55 public void writeAsEncodedUnicode(Writer writer) 56 throws XMLStreamException 57 { 58 try { 59 writer.write("<!--" + _text + "-->"); 60 } 61 catch (IOException e) { 62 throw new XMLStreamException(e); 63 } 64 } 65 } 66 67 | Popular Tags |