25 26 package com.sun.xml.internal.messaging.saaj.soap.impl; 27 28 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl; 29 import org.w3c.dom.CharacterData; 30 import org.w3c.dom.DOMException; 31 import org.w3c.dom.Text; 32 33 public class SOAPTextImpl extends TextImpl<Text> implements Text { 34 35 public SOAPTextImpl(SOAPDocumentImpl ownerDoc, String text) { 36 super(ownerDoc, text); 37 } 38 39 public SOAPTextImpl(SOAPDocumentImpl ownerDoc, CharacterData data) { 40 super(ownerDoc, data); 41 } 42 43 @Override 44 protected Text createN(SOAPDocumentImpl ownerDoc, String text) { 45 Text t = ownerDoc.getDomDocument().createTextNode(text); 46 // ownerDoc.register(this); 47 return t; 48 } 49 50 @Override 51 protected Text createN(SOAPDocumentImpl ownerDoc, CharacterData data) { 52 Text t = (Text) data; 53 return t; 54 } 55 56 @Override 57 public Text splitText(int offset) throws DOMException { 58 return getDomElement().splitText(offset); 59 } 60 61 @Override 62 public boolean isElementContentWhitespace() { 63 return getDomElement().isElementContentWhitespace(); 64 } 65 66 @Override 67 public String getWholeText() { 68 return getDomElement().getWholeText(); 69 } 70 71 @Override 72 public Text replaceWholeText(String content) throws DOMException { 73 return getDomElement().replaceWholeText(content); 74 } 75 76 @Override 77 public boolean isComment() { 78 String txt = getNodeValue(); 79 if (txt == null) { 80 return false; 81 } 82 return txt.startsWith("<!--") && txt.endsWith("-->"); 83 } 84 85 } | 25 26 package com.sun.xml.internal.messaging.saaj.soap.impl; 27 28 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl; 29 import org.w3c.dom.CharacterData; 30 import org.w3c.dom.DOMException; 31 import org.w3c.dom.Text; 32 33 public class SOAPTextImpl extends TextImpl<Text> implements Text { 34 35 public SOAPTextImpl(SOAPDocumentImpl ownerDoc, String text) { 36 super(ownerDoc, text); 37 } 38 39 public SOAPTextImpl(SOAPDocumentImpl ownerDoc, CharacterData data) { 40 super(ownerDoc, data); 41 } 42 43 @Override 44 protected Text createN(SOAPDocumentImpl ownerDoc, String text) { 45 return ownerDoc.getDomDocument().createTextNode(text); 46 } 47 48 @Override 49 protected Text createN(SOAPDocumentImpl ownerDoc, CharacterData data) { 50 return (Text) data; 51 } 52 53 @Override 54 public Text splitText(int offset) throws DOMException { 55 Text text = getDomElement().splitText(offset); 56 getSoapDocument().registerChildNodes(text, true); 57 return text; 58 } 59 60 @Override 61 public boolean isElementContentWhitespace() { 62 return getDomElement().isElementContentWhitespace(); 63 } 64 65 @Override 66 public String getWholeText() { 67 return getDomElement().getWholeText(); 68 } 69 70 @Override 71 public Text replaceWholeText(String content) throws DOMException { 72 Text text = getDomElement().replaceWholeText(content); 73 getSoapDocument().registerChildNodes(text, true); 74 return text; 75 } 76 77 @Override 78 public boolean isComment() { 79 String txt = getNodeValue(); 80 if (txt == null) { 81 return false; 82 } 83 return txt.startsWith("<!--") && txt.endsWith("-->"); 84 } 85 86 } |