001: /*
002: * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003: *
004: * This file is part of Resin(R) Open Source
005: *
006: * Each copy or derived work must preserve the copyright notice and this
007: * notice unmodified.
008: *
009: * Resin Open Source is free software; you can redistribute it and/or modify
010: * it under the terms of the GNU General Public License as published by
011: * the Free Software Foundation; either version 2 of the License, or
012: * (at your option) any later version.
013: *
014: * Resin Open Source is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017: * of NON-INFRINGEMENT. See the GNU General Public License for more
018: * details.
019: *
020: * You should have received a copy of the GNU General Public License
021: * along with Resin Open Source; if not, write to the
022: * Free SoftwareFoundation, Inc.
023: * 59 Temple Place, Suite 330
024: * Boston, MA 02111-1307 USA
025: *
026: * @author Emil Ong
027: */
028:
029: package com.caucho.xml.saaj;
030:
031: import org.w3c.dom.Attr;
032: import org.w3c.dom.Element;
033: import org.w3c.dom.Node;
034: import org.w3c.dom.TypeInfo;
035:
036: import java.io.IOException;
037:
038: import javax.xml.soap.*;
039:
040: public class SOAPAttrImpl extends SOAPNodeImpl implements Attr {
041: private boolean _isId = false;
042: private boolean _specified;
043: private String _value;
044:
045: SOAPAttrImpl(SOAPFactory factory, NameImpl name) {
046: super (factory, name);
047: }
048:
049: SOAPAttrImpl(SOAPFactory factory, NameImpl name, String value) {
050: super (factory, name);
051:
052: _value = value;
053: }
054:
055: public void detachNode() {
056: if (getParentNode() != null) {
057: if (this == _parent._firstAttribute)
058: _parent._firstAttribute = (SOAPAttrImpl) _next;
059: else if (_previous != null)
060: _previous._next = _next;
061:
062: if (this == _parent._lastAttribute)
063: _parent._lastAttribute = (SOAPAttrImpl) _previous;
064: else if (_next != null)
065: _next._previous = _previous;
066:
067: _previous = null;
068: _next = null;
069: _parent = null;
070: }
071: }
072:
073: public String getName() {
074: return _name.getQualifiedName();
075: }
076:
077: public Element getOwnerElement() {
078: return (Element) getParentNode();
079: }
080:
081: public short getNodeType() {
082: return ATTRIBUTE_NODE;
083: }
084:
085: public TypeInfo getSchemaTypeInfo() {
086: return null;
087: }
088:
089: public boolean getSpecified() {
090: return _specified;
091: }
092:
093: public void setSpecified(boolean specified) {
094: _specified = specified;
095: }
096:
097: public String getValue() {
098: return _value;
099: }
100:
101: public void setValue(String value) {
102: _value = value;
103: }
104:
105: public boolean isId() {
106: return _isId;
107: }
108:
109: public void setIsId(boolean isId) {
110: _isId = isId;
111: }
112:
113: public String getNodeValue() {
114: return _value;
115: }
116:
117: public void setNodeValue(String value) {
118: _value = value;
119: }
120:
121: public String getNodeName() {
122: return getName();
123: }
124:
125: public String toString() {
126: if (_value != null)
127: return "Attr[" + _name + " " + _value + "]";
128: else
129: return "Attr[" + _name + "]";
130: }
131: }
|