1 28 29 package com.caucho.xml; 30 31 import org.w3c.dom.Node ; 32 import org.w3c.dom.ProcessingInstruction ; 33 34 import java.io.IOException ; 35 36 public class QProcessingInstruction extends QNode 37 implements ProcessingInstruction { 38 String _name; 39 String _data; 40 41 public QProcessingInstruction(String name) 42 { 43 _name = name.intern(); 44 } 45 46 public QProcessingInstruction(String name, String data) 47 { 48 _name = name.intern(); 49 _data = data; 50 } 51 52 public String getNodeName() { return _name; } 53 public String getNodeValue() { return _data; } 54 public short getNodeType() { return PROCESSING_INSTRUCTION_NODE; } 55 56 public String getTarget() { return getNodeName(); } 57 58 public String getData() { return _data; } 59 public void setData(String arg) { _data = arg; } 60 61 Node importNode(QDocument owner, boolean deep) 62 { 63 QProcessingInstruction pi = new QProcessingInstruction(_name, _data); 64 65 pi._owner = owner; 66 67 return pi; 68 } 69 70 public String getNamespaceURI() 71 { 72 return null; 73 } 74 75 public void print(XmlPrinter os) throws IOException 76 { 77 os.processingInstruction(getNodeName(), getData()); 78 } 79 80 private Object writeReplace() 81 { 82 return new SerializedXml(this); 83 } 84 85 public String toString() 86 { 87 return "PI[" + getNodeName() + " " + getData() + "]"; 88 } 89 } 90 | Popular Tags |