1 19 20 package org.netbeans.modules.xml.text.syntax.dom; 21 22 import org.w3c.dom.*; 23 24 import org.netbeans.editor.TokenItem; 25 26 import org.netbeans.modules.xml.spi.dom.*; 27 import org.netbeans.modules.xml.text.syntax.XMLSyntaxSupport; 28 import org.netbeans.modules.xml.text.api.XMLDefaultTokenContext; 29 34 public final class ProcessingInstructionImpl extends SyntaxNode { 35 36 37 38 public ProcessingInstructionImpl(XMLSyntaxSupport syntax, TokenItem from, int to) { 39 super(syntax, from, to); 40 } 41 42 45 public short getNodeType() { 46 return Node.PROCESSING_INSTRUCTION_NODE; 47 } 48 49 55 public String getTarget() { 56 TokenItem target = first.getNext(); 57 if (target != null) { 58 return target.getImage(); 59 } else { 60 return ""; } 62 } 63 64 public String getNodeName() { 65 return getTarget(); 66 } 67 68 74 public String getData() { 75 StringBuffer buf = new StringBuffer (); 76 TokenItem next = first.getNext(); 77 while (next != null && next.getTokenID() != XMLDefaultTokenContext.PI_CONTENT) { 78 next = next.getNext(); 79 } 80 if (next == null) return ""; do { 82 buf.append(next.getImage()); 83 next = next.getNext(); 84 } while (next != null && next.getTokenID() == XMLDefaultTokenContext.PI_CONTENT); 85 return buf.toString(); 86 } 87 88 public String getNodeValue() { 89 return getData(); 90 } 91 92 95 public void setData(String data) throws DOMException { 96 throw new ROException(); 97 } 98 99 } 100 | Popular Tags |