1 38 39 package com.sun.xml.fastinfoset.stax.events ; 40 41 import java.io.Writer ; 42 import javax.xml.stream.Location; 43 import javax.xml.stream.XMLStreamConstants; 44 import javax.xml.stream.XMLStreamException; 45 import javax.xml.stream.events.ProcessingInstruction; 46 47 48 public class ProcessingInstructionEvent extends EventBase implements ProcessingInstruction { 49 50 private String targetName; 51 private String _data; 52 53 public ProcessingInstructionEvent() { 54 init(); 55 } 56 57 public ProcessingInstructionEvent(String targetName, String data) { 58 this.targetName = targetName; 59 _data = data; 60 init(); 61 } 62 63 protected void init() { 64 setEventType(XMLStreamConstants.PROCESSING_INSTRUCTION); 65 } 66 67 public String getTarget() { 68 return targetName; 69 } 70 71 public void setTarget(String targetName) { 72 this.targetName = targetName; 73 } 74 75 public void setData(String data) { 76 _data = data; 77 } 78 79 public String getData() { 80 return _data; 81 } 82 83 public String toString() { 84 if(_data != null && targetName != null) 85 return "<?" + targetName + " " + _data + "?>"; 86 if(targetName != null) 87 return "<?" + targetName + "?>"; 88 if(_data != null) 89 return "<?" + _data + "?>"; 90 else 91 return "<??>"; 92 } 93 94 } 95 | Popular Tags |