01: /*
02: * $Id: CDATAImpl.java,v 1.19 2006/01/27 12:49:34 vj135062 Exp $
03: * $Revision: 1.19 $
04: * $Date: 2006/01/27 12:49:34 $
05: */
06:
07: /*
08: * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
09: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
10: *
11: * This code is free software; you can redistribute it and/or modify it
12: * under the terms of the GNU General Public License version 2 only, as
13: * published by the Free Software Foundation. Sun designates this
14: * particular file as subject to the "Classpath" exception as provided
15: * by Sun in the LICENSE file that accompanied this code.
16: *
17: * This code is distributed in the hope that it will be useful, but WITHOUT
18: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20: * version 2 for more details (a copy is included in the LICENSE file that
21: * accompanied this code).
22: *
23: * You should have received a copy of the GNU General Public License version
24: * 2 along with this work; if not, write to the Free Software Foundation,
25: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
26: *
27: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
28: * CA 95054 USA or visit www.sun.com if you need additional information or
29: * have any questions.
30: */
31: package com.sun.xml.internal.messaging.saaj.soap.impl;
32:
33: import java.util.logging.Logger;
34:
35: import javax.xml.soap.SOAPElement;
36: import javax.xml.soap.SOAPException;
37:
38: import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
39: import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
40:
41: public class CDATAImpl extends
42: com.sun.org.apache.xerces.internal.dom.CDATASectionImpl
43: implements javax.xml.soap.Text {
44:
45: protected static Logger log = Logger
46: .getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN,
47: "com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings");
48:
49: static final String cdataUC = "<![CDATA[";
50: static final String cdataLC = "<![cdata[";
51:
52: public CDATAImpl(SOAPDocumentImpl ownerDoc, String text) {
53: super (ownerDoc, text);
54: }
55:
56: public String getValue() {
57: String nodeValue = getNodeValue();
58: return (nodeValue.equals("") ? null : nodeValue);
59: }
60:
61: public void setValue(String text) {
62: setNodeValue(text);
63: }
64:
65: public void setParentElement(SOAPElement parent)
66: throws SOAPException {
67: if (parent == null) {
68: log.severe("SAAJ0145.impl.no.null.to.parent.elem");
69: throw new SOAPException(
70: "Cannot pass NULL to setParentElement");
71: }
72: ((ElementImpl) parent).addNode(this );
73: }
74:
75: public SOAPElement getParentElement() {
76: return (SOAPElement) getParentNode();
77: }
78:
79: public void detachNode() {
80: org.w3c.dom.Node parent = getParentNode();
81: if (parent != null) {
82: parent.removeChild(this );
83: }
84: }
85:
86: public void recycleNode() {
87: detachNode();
88: // TBD
89: // - add this to the factory so subsequent
90: // creations can reuse this object.
91: }
92:
93: public boolean isComment() {
94: return false;
95: }
96: }
|