You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2005/07/11 14:41:58 UTC
svn commit: r210111 -
/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/xpath/DocumentNavigator.java
Author: dims
Date: Mon Jul 11 05:41:58 2005
New Revision: 210111
URL: http://svn.apache.org/viewcvs?rev=210111&view=rev
Log:
Need parent of Attribute as well.
Modified:
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/xpath/DocumentNavigator.java
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/xpath/DocumentNavigator.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/xpath/DocumentNavigator.java?rev=210111&r1=210110&r2=210111&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/xpath/DocumentNavigator.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/xpath/DocumentNavigator.java Mon Jul 11 05:41:58 2005
@@ -20,6 +20,7 @@
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
+import javax.xml.namespace.QName;
import java.io.FileInputStream;
import java.net.URL;
import java.util.ArrayList;
@@ -317,7 +318,12 @@
*/
public Iterator getAttributeAxisIterator(Object contextNode) throws UnsupportedAxisException {
if (isElement(contextNode)) {
- return ((OMElement) contextNode).getAttributes();
+ ArrayList attributes = new ArrayList();
+ Iterator i = ((OMElement) contextNode).getAttributes();
+ while(i != null && i.hasNext()){
+ attributes.add(new OMAttributeEx((OMAttribute)i.next(), (OMContainer)contextNode));
+ }
+ return attributes.iterator();
}
return JaxenConstants.EMPTY_ITERATOR;
}
@@ -419,6 +425,8 @@
return new SingleObjectIterator(((OMNode) contextNode).getParent());
} else if (contextNode instanceof OMNamespaceEx) {
return new SingleObjectIterator(((OMNamespaceEx) contextNode).getParent());
+ } else if (contextNode instanceof OMAttributeEx) {
+ return new SingleObjectIterator(((OMAttributeEx) contextNode).getParent());
}
return JaxenConstants.EMPTY_ITERATOR;
}
@@ -648,10 +656,10 @@
class OMNamespaceEx implements OMNamespace {
OMNamespace originalNsp = null;
- OMContainer contextNode = null;
- OMNamespaceEx(OMNamespace nsp, OMContainer node) {
+ OMContainer parent = null;
+ OMNamespaceEx(OMNamespace nsp, OMContainer parent) {
originalNsp = nsp;
- contextNode = node;
+ this.parent = parent;
}
public boolean equals(String uri, String prefix) {
return originalNsp.equals(uri, prefix);
@@ -666,7 +674,47 @@
}
public OMContainer getParent() {
- return contextNode;
+ return parent;
+ }
+ }
+
+ class OMAttributeEx implements OMAttribute {
+ OMAttribute attribute = null;
+ OMContainer parent = null;
+ OMAttributeEx(OMAttribute attribute, OMContainer parent) {
+ this.attribute = attribute;
+ this.parent = parent;
+ }
+ public String getLocalName() {
+ return attribute.getLocalName();
+ }
+
+ public void setLocalName(String localName) {
+ attribute.setLocalName(localName);
+ }
+
+ public String getValue() {
+ return attribute.getValue();
+ }
+
+ public void setValue(String value) {
+ attribute.setValue(value);
+ }
+
+ public void setOMNamespace(OMNamespace omNamespace) {
+ attribute.setOMNamespace(omNamespace);
+ }
+
+ public OMNamespace getNamespace() {
+ return attribute.getNamespace();
+ }
+
+ public QName getQName() {
+ return attribute.getQName();
+ }
+
+ public OMContainer getParent() {
+ return parent;
}
}
}