You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2015/07/18 20:29:35 UTC
svn commit: r1691763 - in /webservices/axiom/trunk:
aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMAttributeSupport.aj
implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
Author: veithen
Date: Sat Jul 18 18:29:34 2015
New Revision: 1691763
URL: http://svn.apache.org/r1691763
Log:
Also reimplement Attr#getValue() based on coreGetTextContent.
Modified:
webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMAttributeSupport.aj
webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
Modified: webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMAttributeSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMAttributeSupport.aj?rev=1691763&r1=1691762&r2=1691763&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMAttributeSupport.aj (original)
+++ webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMAttributeSupport.aj Sat Jul 18 18:29:34 2015
@@ -48,10 +48,18 @@ public aspect DOMAttributeSupport {
}
public final String DOMAttribute.getTextContent() {
- return getValue();
+ return coreGetTextContent(ElementAction.FAIL);
}
public final void DOMAttribute.setTextContent(String textContent) {
coreSetTextContent(textContent, Policies.DETACH_POLICY);
}
+
+ public final String DOMAttribute.getValue() {
+ return getTextContent();
+ }
+
+ public final void DOMAttribute.setValue(String value) {
+ setTextContent(value);
+ }
}
Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java?rev=1691763&r1=1691762&r2=1691763&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java (original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java Sat Jul 18 18:29:34 2015
@@ -21,10 +21,7 @@ package org.apache.axiom.om.impl.dom;
import org.apache.axiom.dom.DOMAttribute;
import org.apache.axiom.om.OMFactory;
-import org.w3c.dom.DOMException;
import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
import org.w3c.dom.TypeInfo;
/** Implementation of <code>org.w3c.dom.Attr</code> and <code>org.apache.axiom.om.OMAttribute</code> */
@@ -38,50 +35,6 @@ public abstract class AttrImpl extends R
}
// /
- // /org.w3c.dom.Node methods
- // /
-
- /**
- * Returns the value of this attribute.
- *
- * @see org.w3c.dom.Attr#getValue()
- */
- public String getValue() {
- String value = null;
- StringBuffer buffer = null;
- Node child = getFirstChild();
-
- while (child != null) {
- String textValue = ((Text)child).getData();
- if (textValue != null && textValue.length() != 0) {
- if (value == null) {
- // This is the first non empty text node. Just save the string.
- value = textValue;
- } else {
- // We've already seen a non empty text node before. Concatenate using
- // a StringBuffer.
- if (buffer == null) {
- // This is the first text node we need to append. Initialize the
- // StringBuffer.
- buffer = new StringBuffer(value);
- }
- buffer.append(textValue);
- }
- }
- child = child.getNextSibling();
- }
-
- if (value == null) {
- // We didn't see any text nodes. Return an empty string.
- return "";
- } else if (buffer != null) {
- return buffer.toString();
- } else {
- return value;
- }
- }
-
- // /
// /org.w3c.dom.Attr methods
// /
@@ -110,15 +63,6 @@ public abstract class AttrImpl extends R
coreSetSpecified(specified);
}
- /**
- * Sets the value of the attribute.
- *
- * @see org.w3c.dom.Attr#setValue(String)
- */
- public void setValue(String value) throws DOMException {
- setTextContent(value);
- }
-
public final String coreGetValue() {
return getValue();
}