Save This Page
Home » openjdk-7 » com.sun.xml.internal.messaging » saaj » soap » impl » [javadoc | source]
    1   /*
    2    * $Id: TextImpl.java,v 1.19 2006/01/27 12:49:36 vj135062 Exp $
    3    * $Revision: 1.19 $
    4    * $Date: 2006/01/27 12:49:36 $
    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 TextImpl
   42       extends com.sun.org.apache.xerces.internal.dom.TextImpl
   43       implements javax.xml.soap.Text, org.w3c.dom.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       public TextImpl(SOAPDocumentImpl ownerDoc, String text) {
   50           super(ownerDoc, text);
   51       }
   52   
   53       public String getValue() {
   54           String nodeValue = getNodeValue();
   55           return (nodeValue.equals("") ? null : nodeValue);
   56       }
   57   
   58       public void setValue(String text) {
   59           setNodeValue(text);
   60       }
   61   
   62       public void setParentElement(SOAPElement parent) throws SOAPException {
   63           if (parent == null) {
   64               log.severe("SAAJ0126.impl.cannot.locate.ns");
   65               throw new SOAPException("Cannot pass NULL to setParentElement");
   66           }
   67           ((ElementImpl) parent).addNode(this);
   68       }
   69   
   70       public SOAPElement getParentElement() {
   71           return (SOAPElement) getParentNode();
   72       }
   73   
   74   
   75       public void detachNode() {
   76           org.w3c.dom.Node parent = getParentNode();
   77           if (parent != null) {
   78               parent.removeChild(this);
   79           }
   80       }
   81   
   82       public void recycleNode() {
   83           detachNode();
   84           // TBD
   85           //  - add this to the factory so subsequent
   86           //    creations can reuse this object.
   87       }
   88   
   89       public boolean isComment() {
   90           String txt = getNodeValue();
   91   
   92           return txt.startsWith("<!--") && txt.endsWith("-->");
   93       }
   94   }

Save This Page
Home » openjdk-7 » com.sun.xml.internal.messaging » saaj » soap » impl » [javadoc | source]