jaxws/src/java.xml.soap/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/CDATAImpl.java
changeset 28641 6b05689b7445
parent 28640 01e4ca94fb0d
parent 28505 7574ac3bb6c1
child 28642 a42fefc69922
equal deleted inserted replaced
28640:01e4ca94fb0d 28641:6b05689b7445
     1 /*
       
     2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.  Oracle designates this
       
     8  * particular file as subject to the "Classpath" exception as provided
       
     9  * by Oracle in the LICENSE file that accompanied this code.
       
    10  *
       
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    14  * version 2 for more details (a copy is included in the LICENSE file that
       
    15  * accompanied this code).
       
    16  *
       
    17  * You should have received a copy of the GNU General Public License version
       
    18  * 2 along with this work; if not, write to the Free Software Foundation,
       
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    20  *
       
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    22  * or visit www.oracle.com if you need additional information or have any
       
    23  * questions.
       
    24  */
       
    25 
       
    26 package com.sun.xml.internal.messaging.saaj.soap.impl;
       
    27 
       
    28 import java.util.logging.Logger;
       
    29 
       
    30 import javax.xml.soap.SOAPElement;
       
    31 import javax.xml.soap.SOAPException;
       
    32 
       
    33 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
       
    34 import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
       
    35 
       
    36 public class CDATAImpl
       
    37     extends com.sun.org.apache.xerces.internal.dom.CDATASectionImpl
       
    38     implements javax.xml.soap.Text {
       
    39 
       
    40     protected static final Logger log =
       
    41         Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN,
       
    42                          "com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings");
       
    43 
       
    44     static final String cdataUC = "<![CDATA[";
       
    45     static final String cdataLC = "<![cdata[";
       
    46 
       
    47     public CDATAImpl(SOAPDocumentImpl ownerDoc, String text) {
       
    48         super(ownerDoc, text);
       
    49     }
       
    50 
       
    51     public String getValue() {
       
    52         String nodeValue = getNodeValue();
       
    53         return (nodeValue.equals("") ? null : nodeValue);
       
    54     }
       
    55 
       
    56     public void setValue(String text) {
       
    57         setNodeValue(text);
       
    58     }
       
    59 
       
    60     public void setParentElement(SOAPElement parent) throws SOAPException {
       
    61         if (parent == null) {
       
    62             log.severe("SAAJ0145.impl.no.null.to.parent.elem");
       
    63             throw new SOAPException("Cannot pass NULL to setParentElement");
       
    64         }
       
    65         ((ElementImpl) parent).addNode(this);
       
    66     }
       
    67 
       
    68     public SOAPElement getParentElement() {
       
    69         return (SOAPElement) getParentNode();
       
    70     }
       
    71 
       
    72 
       
    73     public void detachNode() {
       
    74         org.w3c.dom.Node parent = getParentNode();
       
    75         if (parent != null) {
       
    76             parent.removeChild(this);
       
    77         }
       
    78     }
       
    79 
       
    80     public void recycleNode() {
       
    81         detachNode();
       
    82         // TBD
       
    83         //  - add this to the factory so subsequent
       
    84         //    creations can reuse this object.
       
    85     }
       
    86 
       
    87     public boolean isComment() {
       
    88         return false;
       
    89     }
       
    90 }