src/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/CDATAImpl.java

changeset 1
0961a4a21176
child 45
31822b475baa
equal deleted inserted replaced
-1:000000000000 1:0961a4a21176
1 /*
2 * $Id: CDATAImpl.java,v 1.19 2006/01/27 12:49:34 vj135062 Exp $
3 * $Revision: 1.19 $
4 * $Date: 2006/01/27 12:49:34 $
5 */
6
7 /*
8 * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
9 * 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
42 extends com.sun.org.apache.xerces.internal.dom.CDATASectionImpl
43 implements javax.xml.soap.Text {
44
45 protected static Logger log =
46 Logger.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) throws SOAPException {
66 if (parent == null) {
67 log.severe("SAAJ0145.impl.no.null.to.parent.elem");
68 throw new SOAPException("Cannot pass NULL to setParentElement");
69 }
70 ((ElementImpl) parent).addNode(this);
71 }
72
73 public SOAPElement getParentElement() {
74 return (SOAPElement) getParentNode();
75 }
76
77
78 public void detachNode() {
79 org.w3c.dom.Node parent = getParentNode();
80 if (parent != null) {
81 parent.removeChild(this);
82 }
83 }
84
85 public void recycleNode() {
86 detachNode();
87 // TBD
88 // - add this to the factory so subsequent
89 // creations can reuse this object.
90 }
91
92 public boolean isComment() {
93 return false;
94 }
95 }

mercurial