You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ch...@apache.org on 2006/08/24 10:47:44 UTC

svn commit: r434340 - in /webservices/commons/trunk/modules/axiom/modules: axiom-api/src/main/java/org/apache/axiom/om/ axiom-api/src/main/java/org/apache/axiom/om/impl/builder/ axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ axiom-dom/src/main/j...

Author: chinthaka
Date: Thu Aug 24 01:47:43 2006
New Revision: 434340

URL: http://svn.apache.org/viewvc?rev=434340&view=rev
Log:
Fixed a bug which was there hiding for some time.
OMDocument didn't serialize properly when it has text, dtd and an element as children. This made me to change the API also a bit, but I hope that won't harm anything. The reason for the api change being createOMText had no variation which took OMContainer as a parent , but always it was an OMElement. That hindered me in adding some texts as children of an OMDocument. 
Even the DTD handling was not correct as lastNode and done properties were not set properly. 

The bug I was trying to fix was the one pointed out my Abdera community. But that bug showed the path to this bug. Next step is to look in to that.

Added:
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDTDTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/dtd.xml
Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMFactory.java
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXBuilder.java
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextImpl.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java
    webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocTypeImpl.java
    webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
    webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMTextImpl.java
    webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/DefaultNSHandlingTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/OMSerializerTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/moreover.xml
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/simple.xml
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/web.xml

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMFactory.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMFactory.java?rev=434340&r1=434339&r2=434340&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMFactory.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMFactory.java Thu Aug 24 01:47:43 2006
@@ -100,14 +100,14 @@
      * @param text
      * @return Returns OMText.
      */
-    public OMText createOMText(OMElement parent, String text);
+    public OMText createOMText(OMContainer parent, String text);
 
     /**
      * @param parent
      * @param text   - This text itself can contain a namespace inside it.
      * @return
      */
-    public OMText createOMText(OMElement parent, QName text);
+    public OMText createOMText(OMContainer parent, QName text);
 
     /**
      * @param parent
@@ -116,8 +116,8 @@
      *               XMLStreamConstants.SPACE, XMLStreamConstants.ENTITY_REFERENCE
      * @return Returns OMText.
      */
-    public OMText createOMText(OMElement parent, String text, int type);
-    public OMText createOMText(OMElement parent, char[] charArary, int type);
+    public OMText createOMText(OMContainer parent, String text, int type);
+    public OMText createOMText(OMContainer parent, char[] charArary, int type);
 
     /**
      * @param parent
@@ -125,7 +125,7 @@
      * @param type
      * @return
      */
-    public OMText createOMText(OMElement parent, QName text, int type);
+    public OMText createOMText(OMContainer parent, QName text, int type);
 
     /**
      * @param s
@@ -145,10 +145,10 @@
 
     public OMText createOMText(Object dataHandler, boolean optimize);
 
-    public OMText createOMText(OMElement parent, String s, String mimeType,
+    public OMText createOMText(OMContainer parent, String s, String mimeType,
                                boolean optimize);
 
-    public OMText createOMText(String contentID, OMElement parent,
+    public OMText createOMText(String contentID, OMContainer parent,
                                OMXMLParserWrapper builder);
 
     public OMAttribute createOMAttribute(String localName,

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXBuilder.java?rev=434340&r1=434339&r2=434340&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXBuilder.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXBuilder.java Thu Aug 24 01:47:43 2006
@@ -16,17 +16,7 @@
 
 package org.apache.axiom.om.impl.builder;
 
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMConstants;
-import org.apache.axiom.om.OMContainer;
-import org.apache.axiom.om.OMDocument;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMException;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.OMText;
+import org.apache.axiom.om.*;
 import org.apache.axiom.om.impl.OMNodeEx;
 import org.apache.axiom.om.impl.util.OMSerializerUtil;
 
@@ -93,8 +83,7 @@
 
         // check whether data handlers are treated seperately
         try {
-            if (parser != null && (Boolean.TRUE == parser.getProperty(OMConstants.IS_DATA_HANDLERS_AWARE)))
-            {
+            if (parser != null && (Boolean.TRUE == parser.getProperty(OMConstants.IS_DATA_HANDLERS_AWARE))) {
                 isDataHandlerAware = true;
             }
         } catch (IllegalArgumentException e) {
@@ -179,10 +168,7 @@
         } else if (!lastNode.isComplete()) {
             node = createOMText((OMElement) lastNode, textType);
         } else {
-            OMContainer parent = lastNode.getParent();
-            if (!(parent instanceof OMDocument)) {
-                node = createOMText((OMElement) parent, textType);
-            }
+            node = createOMText(lastNode.getParent(), textType);
         }
         return node;
     }
@@ -191,22 +177,22 @@
      * This method will check whether the text can be optimizable using IS_BINARY flag.
      * If that is set then we try to get the data handler.
      *
-     * @param omElement
+     * @param omContainer
      * @param textType
      * @return omNode
      */
-    private OMNode createOMText(OMElement omElement, int textType) {
+    private OMNode createOMText(OMContainer omContainer, int textType) {
         try {
             if (isDataHandlerAware && Boolean.TRUE == parser.getProperty(OMConstants.IS_BINARY)) {
                 Object dataHandler = parser.getProperty(OMConstants.DATA_HANDLER);
                 OMText text = omfactory.createOMText(dataHandler, true);
-                omElement.addChild(text);
+                omContainer.addChild(text);
                 return text;
             } else {
-                return omfactory.createOMText(omElement, parser.getText(), textType);
+                return omfactory.createOMText(omContainer, parser.getText(), textType);
             }
         } catch (IllegalArgumentException e) {
-            return omfactory.createOMText(omElement, parser.getText(), textType);
+            return omfactory.createOMText(omContainer, parser.getText(), textType);
         }
     }
 

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java?rev=434340&r1=434339&r2=434340&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java Thu Aug 24 01:47:43 2006
@@ -16,17 +16,10 @@
 
 package org.apache.axiom.om.impl.builder;
 
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMContainer;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMException;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.OMText;
-import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axiom.om.*;
 import org.apache.axiom.om.impl.OMContainerEx;
 import org.apache.axiom.om.impl.OMNodeEx;
+import org.apache.axiom.om.util.StAXUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -275,7 +268,8 @@
     protected OMNode createDTD() throws OMException {
         if (!parser.hasText())
             return null;
-        return omfactory.createOMDocType(document, parser.getText());
+        lastNode = omfactory.createOMDocType(document, parser.getText());
+        return lastNode;
     }
 
     /**

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextImpl.java?rev=434340&r1=434339&r2=434340&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextImpl.java Thu Aug 24 01:47:43 2006
@@ -16,13 +16,7 @@
 package org.apache.axiom.om.impl.dom;
 
 import org.apache.axiom.attachments.DataHandlerUtils;
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMException;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMText;
-import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.*;
 import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.apache.axiom.om.impl.OMNamespaceImpl;
 import org.apache.axiom.om.impl.mtom.MTOMStAXSOAPModelBuilder;
@@ -97,7 +91,7 @@
      *            Stores a reference to the builder and the content-id. Supports
      *            deffered parsing of MIME messages
      */
-    public TextImpl(String contentID, OMElement parent,
+    public TextImpl(String contentID, OMContainer parent,
             OMXMLParserWrapper builder, OMFactory factory) {
         super((DocumentImpl) ((ParentNode) parent).getOwnerDocument(), factory);
         this.contentID = contentID;

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java?rev=434340&r1=434339&r2=434340&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java Thu Aug 24 01:47:43 2006
@@ -15,29 +15,9 @@
  */
 package org.apache.axiom.om.impl.dom.factory;
 
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMComment;
-import org.apache.axiom.om.OMContainer;
-import org.apache.axiom.om.OMDataSource;
-import org.apache.axiom.om.OMDocType;
-import org.apache.axiom.om.OMDocument;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMException;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMProcessingInstruction;
-import org.apache.axiom.om.OMText;
-import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.*;
 import org.apache.axiom.om.impl.OMNodeEx;
-import org.apache.axiom.om.impl.dom.AttrImpl;
-import org.apache.axiom.om.impl.dom.CommentImpl;
-import org.apache.axiom.om.impl.dom.DocumentFragmentimpl;
-import org.apache.axiom.om.impl.dom.DocumentImpl;
-import org.apache.axiom.om.impl.dom.ElementImpl;
-import org.apache.axiom.om.impl.dom.NamespaceImpl;
-import org.apache.axiom.om.impl.dom.OMDOMException;
-import org.apache.axiom.om.impl.dom.ParentNode;
-import org.apache.axiom.om.impl.dom.TextImpl;
+import org.apache.axiom.om.impl.dom.*;
 import org.w3c.dom.Node;
 
 import javax.xml.namespace.QName;
@@ -196,7 +176,7 @@
      * @see org.apache.axiom.om.OMFactory#createOMText(
      *      org.apache.axiom.om.OMElement,java.lang.String)
      */
-    public OMText createOMText(OMElement parent, String text) {
+    public OMText createOMText(OMContainer parent, String text) {
         ElementImpl parentElem = (ElementImpl) parent;
         TextImpl txt = new TextImpl((DocumentImpl) parentElem
                 .getOwnerDocument(), text, this);
@@ -204,22 +184,22 @@
         return txt;
     }
 
-    public OMText createOMText(OMElement parent, QName text) {
+    public OMText createOMText(OMContainer parent, QName text) {
         throw new UnsupportedOperationException();
     }
 
-    public OMText createOMText(OMElement parent, String text, int type) {
+    public OMText createOMText(OMContainer parent, String text, int type) {
         OMText textNode = createOMText(parent, text);
         ((OMNodeEx) textNode).setType(type);
         return textNode;
     }
 
-    public OMText createOMText(OMElement parent, char[] charArary, int type) {
+    public OMText createOMText(OMContainer parent, char[] charArary, int type) {
         // TODO : Fix me
         throw new UnsupportedOperationException();
     }
 
-    public OMText createOMText(OMElement parent, QName text, int type) {
+    public OMText createOMText(OMContainer parent, QName text, int type) {
         // TODO : Fix me
         throw new UnsupportedOperationException();
     }
@@ -273,10 +253,10 @@
      * Creates an OMDOM Text node, adds it to the give parent element and
      * returns it.
      * 
-     * @see org.apache.axiom.om.OMFactory#createOMText(org.apache.axiom.om.OMElement,
+     * @see org.apache.axiom.om.OMFactory#createOMText(OMContainer,
      *      java.lang.String, java.lang.String, boolean)
      */
-    public OMText createOMText(OMElement parent, String s, String mimeType,
+    public OMText createOMText(OMContainer parent, String s, String mimeType,
                                boolean optimize) {
         TextImpl text = new TextImpl((DocumentImpl) ((ElementImpl) parent)
                 .getOwnerDocument(), s, mimeType, optimize, this);
@@ -284,7 +264,7 @@
         return text;
     }
 
-    public OMText createOMText(String contentID, OMElement parent,
+    public OMText createOMText(String contentID, OMContainer parent,
                                OMXMLParserWrapper builder) {
         TextImpl text = new TextImpl(contentID, parent, builder, this);
         parent.addChild(text);

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocTypeImpl.java?rev=434340&r1=434339&r2=434340&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocTypeImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocTypeImpl.java Thu Aug 24 01:47:43 2006
@@ -16,12 +16,7 @@
 
 package org.apache.axiom.om.impl.llom;
 
-import org.apache.axiom.om.OMContainer;
-import org.apache.axiom.om.OMDocType;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMException;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.*;
 
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
@@ -40,6 +35,7 @@
         super(parentNode, factory);
         this.value = contentText;
         nodeType = OMNode.DTD_NODE;
+        this.done = true;
     }
 
     /**

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java?rev=434340&r1=434339&r2=434340&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java Thu Aug 24 01:47:43 2006
@@ -16,17 +16,7 @@
 
 package org.apache.axiom.om.impl.llom;
 
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMConstants;
-import org.apache.axiom.om.OMContainer;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMException;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.OMText;
-import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.*;
 import org.apache.axiom.om.impl.OMContainerEx;
 import org.apache.axiom.om.impl.OMNamespaceImpl;
 import org.apache.axiom.om.impl.OMNodeEx;
@@ -267,7 +257,7 @@
         while (!done) {
             int token = builder.next();
             if (token == XMLStreamConstants.END_DOCUMENT) {
-                throw new OMException();
+                throw new OMException("Parser has already reached end of the document. No siblings found");
             }
         }
         return super.getNextOMSibling();

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMTextImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMTextImpl.java?rev=434340&r1=434339&r2=434340&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMTextImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMTextImpl.java Thu Aug 24 01:47:43 2006
@@ -17,14 +17,7 @@
 package org.apache.axiom.om.impl.llom;
 
 
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMConstants;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMException;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMText;
-import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.*;
 import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.apache.axiom.om.impl.OMNamespaceImpl;
 import org.apache.axiom.om.impl.mtom.MTOMStAXSOAPModelBuilder;
@@ -105,11 +98,11 @@
      * @param parent
      * @param text
      */
-    public OMTextImpl(OMElement parent, String text, OMFactory factory) {
+    public OMTextImpl(OMContainer parent, String text, OMFactory factory) {
         this(parent, text, TEXT_NODE, factory);
     }
 
-    public OMTextImpl(OMElement parent, String text, int nodeType,
+    public OMTextImpl(OMContainer parent, String text, int nodeType,
                       OMFactory factory) {
         super(parent, factory);
         this.value = text;
@@ -117,7 +110,7 @@
         this.nodeType = nodeType;
     }
 
-    public OMTextImpl(OMElement parent, char[] charArray, int nodeType,
+    public OMTextImpl(OMContainer parent, char[] charArray, int nodeType,
                       OMFactory factory) {
         super(parent, factory);
         this.charArray = charArray;
@@ -126,11 +119,11 @@
     }
 
 
-    public OMTextImpl(OMElement parent, QName text, OMFactory factory) {
+    public OMTextImpl(OMContainer parent, QName text, OMFactory factory) {
         this(parent, text, TEXT_NODE, factory);
     }
 
-    public OMTextImpl(OMElement parent, QName text, int nodeType,
+    public OMTextImpl(OMContainer parent, QName text, int nodeType,
                       OMFactory factory) {
         super(parent, factory);
         this.textNS = ((OMElementImpl) parent).handleNamespace(text);
@@ -154,7 +147,7 @@
      *                 base64 encoded String representation of Binary
      * @param mimeType of the Binary
      */
-    public OMTextImpl(OMElement parent, String s, String mimeType,
+    public OMTextImpl(OMContainer parent, String s, String mimeType,
                       boolean optimize, OMFactory factory) {
         this(parent, s, factory);
         this.mimeType = mimeType;
@@ -191,7 +184,7 @@
      *                  Stores a reference to the builder and the content-id. Supports
      *                  deferred parsing of MIME messages.
      */
-    public OMTextImpl(String contentID, OMElement parent,
+    public OMTextImpl(String contentID, OMContainer parent,
                       OMXMLParserWrapper builder, OMFactory factory) {
         super(parent, factory);
         this.contentID = contentID;

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java?rev=434340&r1=434339&r2=434340&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java Thu Aug 24 01:47:43 2006
@@ -16,28 +16,9 @@
 
 package org.apache.axiom.om.impl.llom.factory;
 
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMComment;
-import org.apache.axiom.om.OMContainer;
-import org.apache.axiom.om.OMDataSource;
-import org.apache.axiom.om.OMDocType;
-import org.apache.axiom.om.OMDocument;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMException;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMProcessingInstruction;
-import org.apache.axiom.om.OMText;
-import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.*;
 import org.apache.axiom.om.impl.OMNamespaceImpl;
-import org.apache.axiom.om.impl.llom.OMAttributeImpl;
-import org.apache.axiom.om.impl.llom.OMCommentImpl;
-import org.apache.axiom.om.impl.llom.OMDocTypeImpl;
-import org.apache.axiom.om.impl.llom.OMDocumentImpl;
-import org.apache.axiom.om.impl.llom.OMElementImpl;
-import org.apache.axiom.om.impl.llom.OMProcessingInstructionImpl;
-import org.apache.axiom.om.impl.llom.OMSourcedElementImpl;
-import org.apache.axiom.om.impl.llom.OMTextImpl;
+import org.apache.axiom.om.impl.llom.*;
 
 import javax.xml.namespace.QName;
 import java.util.HashMap;
@@ -149,23 +130,23 @@
      * @param text
      * @return Returns OMText.
      */
-    public OMText createOMText(OMElement parent, String text) {
+    public OMText createOMText(OMContainer parent, String text) {
         return new OMTextImpl(parent, text, this);
     }
 
-    public OMText createOMText(OMElement parent, QName text) {
+    public OMText createOMText(OMContainer parent, QName text) {
         return new OMTextImpl(parent, text, this);
     }
 
-    public OMText createOMText(OMElement parent, String text, int type) {
+    public OMText createOMText(OMContainer parent, String text, int type) {
         return new OMTextImpl(parent, text, type, this);
     }
 
-    public OMText createOMText(OMElement parent, char[] charArary, int type) {
+    public OMText createOMText(OMContainer parent, char[] charArary, int type) {
         return new OMTextImpl(parent, charArary, type, this);
     }
 
-    public OMText createOMText(OMElement parent, QName text, int type) {
+    public OMText createOMText(OMContainer parent, QName text, int type) {
         return new OMTextImpl(parent, text, type, this);
     }
 
@@ -206,7 +187,7 @@
         return new OMTextImpl(dataHandler, optimize, this);
     }
 
-    public OMText createOMText(String contentID, OMElement parent,
+    public OMText createOMText(String contentID, OMContainer parent,
                                OMXMLParserWrapper builder) {
         return new OMTextImpl(contentID, parent, builder, this);
     }
@@ -220,7 +201,7 @@
      * @param optimize
      * @return Returns OMText.
      */
-    public OMText createOMText(OMElement parent,
+    public OMText createOMText(OMContainer parent,
                                String s,
                                String mimeType,
                                boolean optimize) {

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/DefaultNSHandlingTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/DefaultNSHandlingTest.java?rev=434340&r1=434339&r2=434340&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/DefaultNSHandlingTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/DefaultNSHandlingTest.java Thu Aug 24 01:47:43 2006
@@ -73,6 +73,8 @@
         OMElement omElementThree = omFactory.createOMElement("Bar", defaultNS1, omElementTwo);
         omElementThree.declareDefaultNamespace("http://defaultNS1.org");
 
+        System.out.println("omElementOne = " + omElementOne);
+
         assertTrue("http://defaultNS1.org".equals(omElementOneChild.getNamespace().getNamespaceURI()));
         assertTrue("http://defaultNS2.org".equals(omElementTwoChild.getNamespace().getNamespaceURI()));
 

Added: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDTDTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDTDTest.java?rev=434340&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDTDTest.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDTDTest.java Thu Aug 24 01:47:43 2006
@@ -0,0 +1,52 @@
+package org.apache.axiom.om;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+
+import javax.xml.stream.XMLStreamException;
+import java.io.ByteArrayOutputStream;
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class OMDTDTest extends TestCase {
+
+    private OMDocument document;
+
+    protected void setUp() throws Exception {
+        try {
+            StAXOMBuilder stAXOMBuilder = new StAXOMBuilder("test-resources/xml/dtd.xml");
+            stAXOMBuilder.setDoDebug(true);
+            document = this.document = stAXOMBuilder.getDocument();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void testDTDSerialization() {
+        try {
+
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            document.serialize(baos);
+            String serializedString = new String(baos.toByteArray());
+
+            assertTrue(serializedString.indexOf("<!ENTITY foo \"bar\">" ) > -1);
+            assertTrue(serializedString.indexOf("<!ENTITY bar \"foo\">" ) > -1);
+            assertTrue(serializedString.indexOf("<feed xmlns=\"http://www.w3.org/2005/Atom\">" ) > -1);
+        } catch (XMLStreamException e) {
+            fail("Bug in serializing OMDocuments which have DTDs, text and a document element");
+        }
+    }
+}

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/OMSerializerTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/OMSerializerTest.java?rev=434340&r1=434339&r2=434340&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/OMSerializerTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/OMSerializerTest.java Thu Aug 24 01:47:43 2006
@@ -109,6 +109,7 @@
            env.serializeAndConsume(writer);
            fail();
         } catch (XMLStreamException e) {
+            e.printStackTrace();
            assertTrue(true);
         } catch (Exception e) {
            assertTrue(true);

Added: webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/dtd.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/dtd.xml?rev=434340&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/dtd.xml (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/dtd.xml Thu Aug 24 01:47:43 2006
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE feed [
+        <!ENTITY foo "bar">
+        <!ENTITY bar "foo">
+        ]>
+<feed xmlns="http://www.w3.org/2005/Atom">
+</feed>
\ No newline at end of file

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/moreover.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/moreover.xml?rev=434340&r1=434339&r2=434340&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/moreover.xml (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/moreover.xml Thu Aug 24 01:47:43 2006
@@ -240,5 +240,4 @@
          <access_registration> </access_registration>
          <access_status> </access_status>
       </article>
-    </moreovernews>
-
+    </moreovernews>
\ No newline at end of file

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/simple.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/simple.xml?rev=434340&r1=434339&r2=434340&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/simple.xml (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/simple.xml Thu Aug 24 01:47:43 2006
@@ -1,2 +1,2 @@
 <?xml version="1.0" ?>
-<root><a>a</a><b>b</b><c><d>d</d></c></root>
+<root><a>a</a><b>b</b><c><d>d</d></c></root>
\ No newline at end of file

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/web.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/web.xml?rev=434340&r1=434339&r2=434340&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/web.xml (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/web.xml Thu Aug 24 01:47:43 2006
@@ -39,4 +39,4 @@
      president
     </role-name>
   </security-role>
-</web-app>
+</web-app>
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org