ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1728806 - in /webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common: builder/BuilderHandler.java builder/PushOMBuilder.java builder/StAXOMBuilder.java factory/SAXOMBuilder.java
Date Sat, 06 Feb 2016 10:33:27 GMT
Author: veithen
Date: Sat Feb  6 10:33:26 2016
New Revision: 1728806

URL: http://svn.apache.org/viewvc?rev=1728806&view=rev
Log:
Unify the endElement logic in the three builder implementations.

Modified:
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/BuilderHandler.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/PushOMBuilder.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/SAXOMBuilder.java

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/BuilderHandler.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/BuilderHandler.java?rev=1728806&r1=1728805&r2=1728806&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/BuilderHandler.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/BuilderHandler.java
Sat Feb  6 10:33:26 2016
@@ -129,6 +129,19 @@ public final class BuilderHandler {
         return element;
     }
     
+    public void endElement() {
+        elementLevel--;
+        target.setComplete(true);
+        if (elementLevel == 0) {
+            // This is relevant for OMSourcedElements and for the case where the document
has been discarded
+            // using getDocumentElement(true). In these cases, this will actually set target
to null. In all
+            // other cases, this will have the same effect as the instruction in the else
clause.
+            target = document;
+        } else {
+            target = (AxiomContainer)((AxiomElement)target).getParent();
+        }
+    }
+
     public void processCharacterData(Object data, boolean ignorable) {
         AxiomCharacterDataNode node = nodeFactory.createNode(AxiomCharacterDataNode.class);
         node.coreSetCharacterData(data);

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/PushOMBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/PushOMBuilder.java?rev=1728806&r1=1728805&r2=1728806&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/PushOMBuilder.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/PushOMBuilder.java
Sat Feb  6 10:33:26 2016
@@ -30,7 +30,6 @@ import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.impl.intf.AxiomContainer;
 import org.apache.axiom.om.impl.intf.AxiomElement;
 import org.apache.axiom.om.impl.intf.AxiomSourcedElement;
 import org.apache.axiom.om.impl.intf.OMFactoryEx;
@@ -111,6 +110,7 @@ public class PushOMBuilder extends Abstr
         if (handler.target == null) {
             root.validateName(prefix, localName, namespaceURI);
             handler.target = root;
+            handler.elementLevel = 1;
         } else {
             handler.startElement(namespaceURI, localName, prefix);
         }
@@ -124,14 +124,7 @@ public class PushOMBuilder extends Abstr
     }
 
     protected void doWriteEndElement() {
-        if (handler.target == root) {
-            handler.target = null;
-        } else {
-            // Since we use the createOMElement variant that takes a OMXMLParserWrapper parameter,
-            // we need to update the completion status.
-            handler.target.setComplete(true);
-            handler.target = (AxiomContainer)((OMElement)handler.target).getParent();
-        }
+        handler.endElement();
     }
 
     protected void doWriteEmptyElement(String prefix, String localName, String namespaceURI)
{

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java?rev=1728806&r1=1728805&r2=1728806&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java
Sat Feb  6 10:33:26 2016
@@ -587,8 +587,7 @@ public class StAXOMBuilder implements Bu
                     createOMText(token);
                     break;
                 case XMLStreamConstants.END_ELEMENT:
-                    handler.elementLevel--;
-                    endElement();
+                    handler.endElement();
                     break;
                 case XMLStreamConstants.END_DOCUMENT:
                     handler.done = true;
@@ -766,18 +765,6 @@ public class StAXOMBuilder implements Bu
         return text;
     }
 
-    private void endElement() {
-        handler.target.setComplete(true);
-        if (handler.elementLevel == 0) {
-            // This is relevant for OMSourcedElements and for the case where the document
has been discarded
-            // using getDocumentElement(true). In these cases, this will actually set target
to null. In all
-            // other cases, this will have the same effect as the instruction in the else
clause.
-            handler.target = handler.document;
-        } else {
-            handler.target = (AxiomContainer)((OMElement)handler.target).getParent();
-        }
-    }
-
     public final OMElement getDocumentElement() {
         return getDocumentElement(false);
     }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/SAXOMBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/SAXOMBuilder.java?rev=1728806&r1=1728805&r2=1728806&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/SAXOMBuilder.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/SAXOMBuilder.java
Sat Feb  6 10:33:26 2016
@@ -23,7 +23,6 @@ import org.apache.axiom.core.NodeFactory
 import org.apache.axiom.om.OMDocument;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMException;
-import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.impl.common.OMContentHandler;
 import org.apache.axiom.om.impl.common.builder.BuilderHandler;
@@ -151,8 +150,7 @@ public class SAXOMBuilder extends OMCont
     }
 
     protected void completed() {
-        ((AxiomElement)handler.target).setComplete(true);
-        handler.target = (AxiomContainer)((OMNode)handler.target).getParent();
+        handler.endElement();
     }
 
     protected void createOMText(String text, int type) {



Mime
View raw message