ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1738356 - in /webservices/axiom/trunk: aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMDocumentSupport.aj implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
Date Sat, 09 Apr 2016 12:16:33 GMT
Author: veithen
Date: Sat Apr  9 12:16:32 2016
New Revision: 1738356

URL: http://svn.apache.org/viewvc?rev=1738356&view=rev
Log:
Reimplement the getDoctype method.

Modified:
    webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMDocumentSupport.aj
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java

Modified: webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMDocumentSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMDocumentSupport.aj?rev=1738356&r1=1738355&r2=1738356&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMDocumentSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMDocumentSupport.aj
Sat Apr  9 12:16:32 2016
@@ -20,6 +20,7 @@ package org.apache.axiom.dom.impl.mixin;
 
 import javax.xml.XMLConstants;
 
+import org.apache.axiom.core.CoreChildNode;
 import org.apache.axiom.core.CoreElement;
 import org.apache.axiom.core.CoreModelException;
 import org.apache.axiom.dom.DOMCDATASection;
@@ -51,6 +52,7 @@ import org.w3c.dom.DOMException;
 import org.w3c.dom.DOMImplementation;
 import org.w3c.dom.Document;
 import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.DocumentType;
 import org.w3c.dom.Element;
 import org.w3c.dom.EntityReference;
 import org.w3c.dom.NamedNodeMap;
@@ -335,4 +337,22 @@ public aspect DOMDocumentSupport {
                 throw new IllegalStateException();
         }
     }
+
+    public final DocumentType DOMDocument.getDoctype() {
+        try {
+            CoreChildNode child = coreGetFirstChild();
+            while (child != null) {
+                if (child instanceof DocumentType) {
+                    return (DocumentType)child;
+                } else if (child instanceof Element) {
+                    // A doctype declaration can only appear before the root element. Stop
here.
+                    return null;
+                }
+                child = child.coreGetNextSibling();
+            }
+            return null;
+        } catch (CoreModelException ex) {
+            throw DOMExceptionUtil.toUncheckedException(ex);
+        }
+    }
 }

Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java?rev=1738356&r1=1738355&r2=1738356&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
(original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
Sat Apr  9 12:16:32 2016
@@ -23,7 +23,6 @@ import static org.apache.axiom.dom.DOMEx
 
 import java.util.Enumeration;
 import java.util.Hashtable;
-import java.util.Iterator;
 import java.util.Vector;
 
 import org.apache.axiom.core.CoreChildNode;
@@ -32,7 +31,6 @@ import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.impl.intf.AxiomDocument;
 import org.w3c.dom.Attr;
 import org.w3c.dom.DOMException;
-import org.w3c.dom.DocumentType;
 import org.w3c.dom.Element;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
@@ -43,23 +41,6 @@ public class DocumentImpl extends Parent
 
     protected Hashtable identifiers;
     
-    // /org.w3c.dom.Document methods
-    // /
-
-    public DocumentType getDoctype() {
-        Iterator it = getChildren();
-        while (it.hasNext()) {
-            Object child = it.next();
-            if (child instanceof DocumentType) {
-                return (DocumentType)child;
-            } else if (child instanceof Element) {
-                // A doctype declaration can only appear before the root element. Stop here.
-                return null;
-            }
-        }
-        return null;
-    }
-
     public Element getElementById(String elementId) {
 
         //If there are no id attrs



Mime
View raw message