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 2012/07/22 11:11:28 UTC

svn commit: r1364242 - in /webservices/commons/trunk/modules/axiom: ./ modules/axiom-api/src/main/java/org/apache/axiom/ext/stax/ modules/axiom-api/src/main/java/org/apache/axiom/om/ modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/ mod...

Author: veithen
Date: Sun Jul 22 09:11:26 2012
New Revision: 1364242

URL: http://svn.apache.org/viewvc?rev=1364242&view=rev
Log:
AXIOM-437: Correctly implement DTD support.

Added:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/ext/stax/DTDReader.java
      - copied unchanged from r1364239, webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/ext/stax/DTDReader.java
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/StAX2StreamReaderWrapper.java
      - copied unchanged from r1364239, webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/StAX2StreamReaderWrapper.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documenttype/
      - copied from r1364239, webservices/axiom/branches/AXIOM-437/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documenttype/
    webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documenttype/TestWithParser1.java
      - copied unchanged from r1364239, webservices/axiom/branches/AXIOM-437/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documenttype/TestWithParser1.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documenttype/TestWithParser2.java
      - copied unchanged from r1364239, webservices/axiom/branches/AXIOM-437/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documenttype/TestWithParser2.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/resources/org/apache/axiom/ts/dom/documenttype/
      - copied from r1364239, webservices/axiom/branches/AXIOM-437/modules/axiom-dom-testsuite/src/main/resources/org/apache/axiom/ts/dom/documenttype/
    webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/resources/org/apache/axiom/ts/dom/documenttype/test.dtd
      - copied unchanged from r1364239, webservices/axiom/branches/AXIOM-437/modules/axiom-dom-testsuite/src/main/resources/org/apache/axiom/ts/dom/documenttype/test.dtd
    webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/resources/org/apache/axiom/ts/dom/documenttype/test1.xml
      - copied unchanged from r1364239, webservices/axiom/branches/AXIOM-437/modules/axiom-dom-testsuite/src/main/resources/org/apache/axiom/ts/dom/documenttype/test1.xml
    webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/resources/org/apache/axiom/ts/dom/documenttype/test2.xml
      - copied unchanged from r1364239, webservices/axiom/branches/AXIOM-437/modules/axiom-dom-testsuite/src/main/resources/org/apache/axiom/ts/dom/documenttype/test2.xml
Modified:
    webservices/commons/trunk/modules/axiom/   (props changed)
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMContainer.java
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMDocType.java
    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/OMXMLBuilderFactory.java
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/OMFactoryEx.java
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.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-api/src/main/java/org/apache/axiom/om/impl/jaxp/OMSource.java
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/OMXMLReader.java
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamingOMSerializer.java
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamWriterUtils.java
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/Woodstox3StreamReaderWrapper.java
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/Woodstox4StreamReaderWrapper.java
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/AbstractTestCase.java
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/DOMCompatibilityTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/jaxp/StreamSourceToOMResultTestCase.java
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/serialize/StreamingOMSerializerTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java
    webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/DOMXMLStreamReader.java
    webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/SAXOMXMLParserWrapper.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentTypeImpl.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-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.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/factory/OMLinkedListImplFactory.java
    webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-integration/src/test/java/org/apache/axiom/om/impl/builder/SAXOMBuilderSAXParserTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestCreateOMBuilderFromDOMSource.java
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestCreateOMBuilderFromSAXSource.java
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetSAXSource.java
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMDocTypeWithoutParent.java

Propchange: webservices/commons/trunk/modules/axiom/
------------------------------------------------------------------------------
  Merged /webservices/axiom/branches/AXIOM-437:r1364041-1364239

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMContainer.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMContainer.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMContainer.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMContainer.java Sun Jul 22 09:11:26 2012
@@ -26,6 +26,8 @@ import javax.xml.transform.Transformer;
 import javax.xml.transform.sax.SAXSource;
 
 import org.xml.sax.ContentHandler;
+import org.xml.sax.DTDHandler;
+import org.xml.sax.ext.DeclHandler;
 import org.xml.sax.ext.LexicalHandler;
 
 import java.io.OutputStream;
@@ -387,8 +389,7 @@ public interface OMContainer extends OMS
      * used with the {@link Transformer} API.
      * <p>
      * The returned object supports all events defined by {@link ContentHandler} and
-     * {@link LexicalHandler}, with the exception of DTD related events. {@link OMDocType} nodes
-     * will be silently skipped.
+     * {@link LexicalHandler}. {@link DTDHandler} and {@link DeclHandler} are not supported.
      * <p>
      * If the node is an element and has a parent which is not a document, care is taken to properly
      * generate {@link ContentHandler#startPrefixMapping(String, String)} and

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMDocType.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMDocType.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMDocType.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMDocType.java Sun Jul 22 09:11:26 2012
@@ -22,16 +22,31 @@ package org.apache.axiom.om;
 /** Interface OMDocType */
 public interface OMDocType extends OMNode {
     /**
-     * Returns the value of this DocType.
-     *
-     * @return Returns String.
+     * Get the root name, i.e. the name immediately following the <tt>DOCTYPE</tt> keyword.
+     * 
+     * @return the root name; must not be <code>null</code>
      */
-    String getValue();
+    String getRootName();
 
     /**
-     * Sets the content of this DocType to the specified string.
-     *
-     * @param text
+     * Get the public ID of the external subset.
+     * 
+     * @return the public ID, or <code>null</code> if there is no external subset or no public ID
+     *         has been specified for the external subset
      */
-    void setValue(String text);
+    String getPublicId();
+
+    /**
+     * Get the system ID of the external subset.
+     * 
+     * @return the system ID, or <code>null</code> if there is no external subset
+     */
+    String getSystemId();
+    
+    /**
+     * Get the internal subset.
+     * 
+     * @return the internal subset, or <code>null</code> if there is none
+     */
+    String getInternalSubset();
 }

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=1364242&r1=1364241&r2=1364242&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 Sun Jul 22 09:11:26 2012
@@ -317,13 +317,25 @@ public interface OMFactory {
                                          String value);
 
     /**
-     * Creates DocType/DTD.
+     * Creates DTD (<tt>DOCTYPE</tt> declaration) node.
      *
      * @param parent
-     * @param content
-     * @return Returns doctype.
+     *            the parent to which the newly created text node will be added; this may be
+     *            <code>null</code>
+     * @param rootName
+     *            the root name, i.e. the name immediately following the <tt>DOCTYPE</tt> keyword
+     * @param publicId
+     *            the public ID of the external subset, or <code>null</code> if there is no external
+     *            subset or no public ID has been specified for the external subset
+     * @param systemId
+     *            the system ID of the external subset, or <code>null</code> if there is no external
+     *            subset
+     * @param internalSubset
+     *            the internal subset, or <code>null</code> if there is none
+     * @return the newly created {@link OMDocType} node
      */
-    OMDocType createOMDocType(OMContainer parent, String content);
+    OMDocType createOMDocType(OMContainer parent, String rootName, String publicId, String systemId,
+            String internalSubset);
 
     /**
      * Creates a PI.

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMXMLBuilderFactory.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMXMLBuilderFactory.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMXMLBuilderFactory.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMXMLBuilderFactory.java Sun Jul 22 09:11:26 2012
@@ -302,7 +302,6 @@ public class OMXMLBuilderFactory {
      *            the source of the XML document
      * @return the builder
      */
-    // TODO: if the source is a SAXSource or DOMSource and the document has a DTD, then Axiom will remove the DTD (or even fail); fix this and/or specify the behavior
     public static OMXMLParserWrapper createOMBuilder(OMFactory omFactory, Source source) {
         return omFactory.getMetaFactory().createOMBuilder(omFactory, source);
     }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/OMFactoryEx.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/OMFactoryEx.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/OMFactoryEx.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/OMFactoryEx.java Sun Jul 22 09:11:26 2012
@@ -51,7 +51,8 @@ public interface OMFactoryEx extends OMF
     
     OMComment createOMComment(OMContainer parent, String content, boolean fromBuilder);
     
-    OMDocType createOMDocType(OMContainer parent, String content, boolean fromBuilder);
+    OMDocType createOMDocType(OMContainer parent, String rootName, String publicId, String systemId,
+            String internalSubset, boolean fromBuilder);
     
     OMProcessingInstruction createOMProcessingInstruction(OMContainer parent,
             String piTarget, String piData, boolean fromBuilder);

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java Sun Jul 22 09:11:26 2012
@@ -35,6 +35,7 @@ import org.apache.axiom.om.impl.OMNodeEx
 import org.xml.sax.Attributes;
 import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
+import org.xml.sax.ext.DeclHandler;
 import org.xml.sax.ext.LexicalHandler;
 import org.xml.sax.helpers.DefaultHandler;
 
@@ -43,9 +44,34 @@ import java.util.List;
 
 import javax.xml.XMLConstants;
 
-public class SAXOMBuilder extends DefaultHandler implements LexicalHandler, OMXMLParserWrapper {
+public class SAXOMBuilder extends DefaultHandler implements LexicalHandler, DeclHandler, OMXMLParserWrapper {
     private OMDocument document;
     
+    /**
+     * Stores the root name if there is a DTD.
+     */
+    private String dtdName;
+    
+    /**
+     * Stores the public ID if there is a DTD.
+     */
+    private String dtdPublicId;
+    
+    /**
+     * Stores the system ID if there is a DTD.
+     */
+    private String dtdSystemId;
+    
+    /**
+     * Stores the internal subset if there is a DTD.
+     */
+    private StringBuilder internalSubset;
+    
+    /**
+     * Flag indicating that the parser is processing the external subset.
+     */
+    private boolean inExternalSubset;
+    
     OMElement root = null;
 
     OMNode lastNode = null;
@@ -95,10 +121,101 @@ public class SAXOMBuilder extends Defaul
     }
 
     public void startDTD(String name, String publicId, String systemId) throws SAXException {
-//        addNode(factory.createOMDocType(getContainer(), ""));
+        dtdName = name;
+        dtdPublicId = publicId;
+        dtdSystemId = systemId;
+        internalSubset = new StringBuilder();
+    }
+
+    public void elementDecl(String name, String model) throws SAXException {
+        if (!inExternalSubset) {
+            internalSubset.append("<!ELEMENT ");
+            internalSubset.append(name);
+            internalSubset.append(' ');
+            internalSubset.append(model);
+            internalSubset.append(">\n");
+        }
+    }
+
+    public void attributeDecl(String eName, String aName, String type, String mode, String value)
+            throws SAXException {
+        if (!inExternalSubset) {
+            internalSubset.append("<!ATTLIST ");
+            internalSubset.append(eName);
+            internalSubset.append(' ');
+            internalSubset.append(aName);
+            internalSubset.append(' ');
+            internalSubset.append(type);
+            if (value != null) {
+                internalSubset.append(' ');
+                internalSubset.append(value);
+            }
+            internalSubset.append(">\n");
+        }
+    }
+
+    public void externalEntityDecl(String name, String publicId, String systemId) throws SAXException {
+        if (!inExternalSubset) {
+            internalSubset.append("<!ENTITY ");            
+            internalSubset.append(name);
+            if (publicId != null) {
+                internalSubset.append(" PUBLIC \"");
+                internalSubset.append(publicId);
+            } else {
+                internalSubset.append(" SYSTEM \"");
+                internalSubset.append(systemId);
+            }
+            internalSubset.append("\">\n");
+        }
+    }
+
+    public void internalEntityDecl(String name, String value) throws SAXException {
+        if (!inExternalSubset) {
+            internalSubset.append("<!ENTITY ");
+            internalSubset.append(name);
+            internalSubset.append(" \"");
+            internalSubset.append(value);
+            internalSubset.append("\">\n");
+        }
+    }
+
+    public void notationDecl(String name, String publicId, String systemId) throws SAXException {
+        if (!inExternalSubset) {
+            internalSubset.append("<!NOTATION ");            
+            internalSubset.append(name);
+            if (publicId != null) {
+                internalSubset.append(" PUBLIC \"");
+                internalSubset.append(publicId);
+            } else {
+                internalSubset.append(" SYSTEM \"");
+                internalSubset.append(systemId);
+            }
+            internalSubset.append("\">\n");
+        }
+    }
+
+    public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName)
+            throws SAXException {
+        if (!inExternalSubset) {
+            internalSubset.append("<!ENTITY ");
+            internalSubset.append(name);
+            if (publicId != null) {
+                internalSubset.append(" PUBLIC \"");
+                internalSubset.append(publicId);
+            } else {
+                internalSubset.append(" SYSTEM \"");
+                internalSubset.append(systemId);
+            }
+            internalSubset.append("\" NDATA ");
+            internalSubset.append(notationName);
+            internalSubset.append(">\n");
+        }
     }
 
     public void endDTD() throws SAXException {
+        addNode(factory.createOMDocType(getContainer(), dtdName, dtdPublicId, dtdSystemId,
+                internalSubset.length() == 0 ? null : internalSubset.toString(), true));
+        internalSubset = null;
     }
 
     protected OMElement createNextElement(String localName) throws OMException {
@@ -235,9 +352,15 @@ public class SAXOMBuilder extends Defaul
     }
 
     public void startEntity(String name) throws SAXException {
+        if (name.equals("[dtd]")) {
+            inExternalSubset = true;
+        }
     }
 
     public void endEntity(String name) throws SAXException {
+        if (name.equals("[dtd]")) {
+            inExternalSubset = false;
+        }
     }
 
     public OMDocument getDocument() {

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=1364242&r1=1364241&r2=1364242&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 Sun Jul 22 09:11:26 2012
@@ -19,6 +19,7 @@
 
 package org.apache.axiom.om.impl.builder;
 
+import org.apache.axiom.ext.stax.DTDReader;
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMDocument;
 import org.apache.axiom.om.OMElement;
@@ -446,10 +447,22 @@ public class StAXOMBuilder extends StAXB
      * @throws OMException
      */
     protected OMNode createDTD() throws OMException {
-        if (!parser.hasText()) {
-            return null;
+        DTDReader dtdReader;
+        try {
+            dtdReader = (DTDReader)parser.getProperty(DTDReader.PROPERTY);
+        } catch (IllegalArgumentException ex) {
+            dtdReader = null;
+        }
+        if (dtdReader == null) {
+            throw new OMException("Cannot create OMDocType because the XMLStreamReader doesn't support the DTDReader extension");
+        }
+        String internalSubset = getDTDText();
+        // Woodstox returns an empty string if there is no internal subset
+        if (internalSubset != null && internalSubset.length() == 0) {
+            internalSubset = null;
         }
-        return omfactory.createOMDocType(target, getDTDText(), true);
+        return omfactory.createOMDocType(target, dtdReader.getRootName(), dtdReader.getPublicId(),
+                dtdReader.getSystemId(), internalSubset, true);
     }
     
     /**

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/jaxp/OMSource.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/jaxp/OMSource.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/jaxp/OMSource.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/jaxp/OMSource.java Sun Jul 22 09:11:26 2012
@@ -24,15 +24,19 @@ import javax.xml.transform.sax.SAXSource
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.impl.serialize.OMXMLReader;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.DTDHandler;
 import org.xml.sax.InputSource;
+import org.xml.sax.ext.DeclHandler;
+import org.xml.sax.ext.LexicalHandler;
 
 /**
  * Implementation of {@link javax.xml.transform.Source} for AXIOM.
  * The implementation is based on {@link SAXSource} and directly transforms an AXIOM
  * tree into a stream of SAX events using {@link OMXMLReader}.
  * <p>
- * Note that {@link org.apache.axiom.om.OMDocType} nodes are not supported and will be
- * silently skipped.
+ * Note that this class only supports {@link ContentHandler} and {@link LexicalHandler}.
+ * {@link DTDHandler} and {@link DeclHandler} are not supported.
  * <p>
  * <b>NOTE: As of version 1.2.13, application code should use
  * {@link OMContainer#getSAXSource(boolean)} instead of instantiating this class directly.</b>

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/OMXMLReader.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/OMXMLReader.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/OMXMLReader.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/OMXMLReader.java Sun Jul 22 09:11:26 2012
@@ -29,6 +29,7 @@ import java.util.Set;
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMComment;
 import org.apache.axiom.om.OMContainer;
+import org.apache.axiom.om.OMDocType;
 import org.apache.axiom.om.OMDocument;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMNamespace;
@@ -38,17 +39,20 @@ import org.apache.axiom.om.OMText;
 import org.apache.axiom.util.sax.AbstractXMLReader;
 import org.xml.sax.Attributes;
 import org.xml.sax.ContentHandler;
+import org.xml.sax.DTDHandler;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.XMLReader;
+import org.xml.sax.ext.DeclHandler;
+import org.xml.sax.ext.LexicalHandler;
 
 /**
  * SAX {@link XMLReader} implementation that traverses a given OM tree and invokes the
  * callback methods on the configured {@link ContentHandler}. This can be used to
  * serialize an Axiom tree to SAX.
  * <p>
- * Note that this class doesn't support serializing {@link org.apache.axiom.om.OMDocType}
- * nodes. They will be silently skipped.
+ * Note that this class only supports {@link ContentHandler} and {@link LexicalHandler}.
+ * {@link DTDHandler} and {@link DeclHandler} are not supported.
  * <p>
  * This class can also generate SAX events for a subtree. This is the case if the
  * element passed to the constructor is not the root element of the document. In this
@@ -177,6 +181,13 @@ public class OMXMLReader extends Abstrac
         for (Iterator it = parent.getChildren(); it.hasNext(); ) {
             OMNode node = (OMNode)it.next();
             switch (node.getType()) {
+                case OMNode.DTD_NODE:
+                    if (lexicalHandler != null) {
+                        OMDocType doctype = (OMDocType)node;
+                        lexicalHandler.startDTD(doctype.getRootName(), doctype.getPublicId(), doctype.getSystemId());
+                        lexicalHandler.endDTD();
+                    }
+                    break;
                 case OMNode.ELEMENT_NODE:
                     generateEvents((OMElement)node);
                     break;

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamingOMSerializer.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamingOMSerializer.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamingOMSerializer.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamingOMSerializer.java Sun Jul 22 09:11:26 2012
@@ -19,6 +19,7 @@
 
 package org.apache.axiom.om.impl.serialize;
 
+import org.apache.axiom.ext.stax.DTDReader;
 import org.apache.axiom.ext.stax.datahandler.DataHandlerReader;
 import org.apache.axiom.ext.stax.datahandler.DataHandlerWriter;
 import org.apache.axiom.om.OMDataSource;
@@ -193,6 +194,9 @@ public class StreamingOMSerializer imple
                     } catch (Exception e) {
                         //TODO: log exceptions
                     }
+                    break;
+                case DTD:
+                    serializeDTD(reader, writer);
                 }
             }
             if (depth == 0) {
@@ -623,4 +627,18 @@ public class StreamingOMSerializer imple
             throw new XMLStreamException("Error while reading data handler", ex);
         }
     }
+
+    private void serializeDTD(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
+        DTDReader dtdReader;
+        try {
+            dtdReader = (DTDReader)reader.getProperty(DTDReader.PROPERTY);
+        } catch (IllegalArgumentException ex) {
+            dtdReader = null;
+        }
+        if (dtdReader == null) {
+            throw new XMLStreamException("Cannot serialize the DTD because the XMLStreamReader doesn't support the DTDReader extension");
+        }
+        XMLStreamWriterUtils.writeDTD(writer, dtdReader.getRootName(), dtdReader.getPublicId(),
+                dtdReader.getSystemId(), reader.getText());
+    }
 }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamWriterUtils.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamWriterUtils.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamWriterUtils.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamWriterUtils.java Sun Jul 22 09:11:26 2012
@@ -166,4 +166,47 @@ public class XMLStreamWriterUtils {
             writeBase64(writer, dataHandlerProvider.getDataHandler());
         }
     }
+    
+    /**
+     * Prepare the <tt>DOCTYPE</tt> declaration using the provided information and output it using
+     * {@link XMLStreamWriter#writeDTD(String)}.
+     * 
+     * @param writer
+     *            the stream writer to write the <tt>DOCTYPE</tt> declaration to
+     * @param rootName
+     *            the root name, i.e. the name immediately following the <tt>DOCTYPE</tt> keyword
+     * @param publicId
+     *            the public ID of the external subset, or <code>null</code> if there is no external
+     *            subset or no public ID has been specified for the external subset
+     * @param systemId
+     *            the system ID of the external subset, or <code>null</code> if there is no external
+     *            subset
+     * @param internalSubset
+     *            the internal subset, or <code>null</code> if there is none
+     * @throws XMLStreamException
+     *             if an error occurs while writing to the stream
+     */
+    public static void writeDTD(XMLStreamWriter writer, String rootName, String publicId,
+            String systemId, String internalSubset) throws XMLStreamException {
+        StringBuilder buffer = new StringBuilder("<!DOCTYPE ");
+        buffer.append(rootName);
+        if (publicId != null) {
+            buffer.append(" PUBLIC \"");
+            buffer.append(publicId);
+            buffer.append("\" \"");
+            buffer.append(systemId);
+            buffer.append("\"");
+        } else if (systemId != null) {
+            buffer.append(" SYSTEM \"");
+            buffer.append(systemId);
+            buffer.append("\"");
+        }
+        if (internalSubset != null) {
+            buffer.append(" [");
+            buffer.append(internalSubset);
+            buffer.append("]");
+        }
+        buffer.append(">");
+        writer.writeDTD(buffer.toString());
+    }
 }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/Woodstox3StreamReaderWrapper.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/Woodstox3StreamReaderWrapper.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/Woodstox3StreamReaderWrapper.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/Woodstox3StreamReaderWrapper.java Sun Jul 22 09:11:26 2012
@@ -22,9 +22,8 @@ import javax.xml.namespace.NamespaceCont
 import javax.xml.stream.XMLStreamReader;
 
 import org.apache.axiom.ext.stax.DelegatingXMLStreamReader;
-import org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper;
 
-class Woodstox3StreamReaderWrapper extends XMLStreamReaderWrapper implements DelegatingXMLStreamReader {
+class Woodstox3StreamReaderWrapper extends StAX2StreamReaderWrapper implements DelegatingXMLStreamReader {
     public Woodstox3StreamReaderWrapper(XMLStreamReader reader) {
         super(reader);
     }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/Woodstox4StreamReaderWrapper.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/Woodstox4StreamReaderWrapper.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/Woodstox4StreamReaderWrapper.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/Woodstox4StreamReaderWrapper.java Sun Jul 22 09:11:26 2012
@@ -28,10 +28,9 @@ import javax.xml.stream.XMLStreamReader;
 import org.apache.axiom.ext.stax.CharacterDataReader;
 import org.apache.axiom.ext.stax.DelegatingXMLStreamReader;
 import org.apache.axiom.util.stax.XMLStreamReaderUtils;
-import org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper;
 import org.codehaus.stax2.XMLStreamReader2;
 
-class Woodstox4StreamReaderWrapper extends XMLStreamReaderWrapper implements DelegatingXMLStreamReader, CharacterDataReader {
+class Woodstox4StreamReaderWrapper extends StAX2StreamReaderWrapper implements DelegatingXMLStreamReader, CharacterDataReader {
     public Woodstox4StreamReaderWrapper(XMLStreamReader reader) {
         super(reader);
     }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/AbstractTestCase.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/AbstractTestCase.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/AbstractTestCase.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/AbstractTestCase.java Sun Jul 22 09:11:26 2012
@@ -24,11 +24,8 @@ import java.net.URL;
 
 import javax.activation.DataSource;
 import javax.activation.URLDataSource;
-import javax.xml.parsers.DocumentBuilderFactory;
 
 import org.custommonkey.xmlunit.XMLTestCase;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentType;
 
 /** Abstract base class for test cases. */
 public abstract class AbstractTestCase
@@ -76,14 +73,5 @@ public abstract class AbstractTestCase
     public static OMElement getTestResourceAsElement(OMMetaFactory omMetaFactory, String relativePath) {
         return OMXMLBuilderFactory.createOMBuilder(omMetaFactory.getOMFactory(), getTestResource(relativePath)).getDocumentElement();
     }
-    
-    public static Document toDocumentWithoutDTD(InputStream in) throws Exception {
-        Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(in);
-        DocumentType docType = doc.getDoctype();
-        if (docType != null) {
-            doc.removeChild(docType);
-        }
-        return doc;
-    }
 }
 

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/DOMCompatibilityTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/DOMCompatibilityTest.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/DOMCompatibilityTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/DOMCompatibilityTest.java Sun Jul 22 09:11:26 2012
@@ -50,7 +50,10 @@ public class DOMCompatibilityTest extend
                                         new MethodSignature("getNamespaceURI", new Class[0]),
                                         new MethodSignature("getLocalName", new Class[0]) }));
         suite.addTest(new MethodCollisionTestCase(OMComment.class, Comment.class));
-        suite.addTest(new MethodCollisionTestCase(OMDocType.class, DocumentType.class));
+        suite.addTest(new MethodCollisionTestCase(OMDocType.class, DocumentType.class,
+                new MethodSignature[] { new MethodSignature("getPublicId", new Class[0]),
+                                        new MethodSignature("getSystemId", new Class[0]),
+                                        new MethodSignature("getInternalSubset", new Class[0]) }));
         suite.addTest(new MethodCollisionTestCase(OMDocument.class, Document.class));
         suite.addTest(new MethodCollisionTestCase(OMProcessingInstruction.class, ProcessingInstruction.class,
                 new MethodSignature[] { new MethodSignature("getTarget", new Class[0]) }));

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/jaxp/StreamSourceToOMResultTestCase.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/jaxp/StreamSourceToOMResultTestCase.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/jaxp/StreamSourceToOMResultTestCase.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/jaxp/StreamSourceToOMResultTestCase.java Sun Jul 22 09:11:26 2012
@@ -29,6 +29,7 @@ import junit.framework.TestSuite;
 import org.apache.axiom.om.AbstractTestCase;
 import org.apache.axiom.om.OMMetaFactory;
 import org.apache.axiom.testutils.conformance.ConformanceTestFile;
+import org.xml.sax.InputSource;
 
 public class StreamSourceToOMResultTestCase extends AbstractTestCase {
     private final OMMetaFactory omMetaFactory;
@@ -50,8 +51,8 @@ public class StreamSourceToOMResultTestC
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         result.getDocument().serialize(out);
         assertXMLIdentical(compareXML(
-                toDocumentWithoutDTD(file.getAsStream()),
-                toDocumentWithoutDTD(new ByteArrayInputStream(out.toByteArray()))), true);
+                new InputSource(file.getAsStream()),
+                new InputSource(new ByteArrayInputStream(out.toByteArray()))), true);
     }
 
     public static TestSuite suite(OMMetaFactory omMetaFactory,

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/serialize/StreamingOMSerializerTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/serialize/StreamingOMSerializerTest.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/serialize/StreamingOMSerializerTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/serialize/StreamingOMSerializerTest.java Sun Jul 22 09:11:26 2012
@@ -33,6 +33,7 @@ import org.apache.axiom.om.AbstractTestC
 import org.apache.axiom.testutils.conformance.ConformanceTestFile;
 import org.apache.axiom.util.stax.dialect.StAXDialect;
 import org.apache.axiom.util.stax.dialect.StAXDialectDetector;
+import org.xml.sax.InputSource;
 
 public class StreamingOMSerializerTest extends AbstractTestCase {
     private final ConformanceTestFile file;
@@ -58,8 +59,8 @@ public class StreamingOMSerializerTest e
         serializer.serialize(reader, writer, false);
         writer.writeEndDocument();
         writer.flush();
-        assertXMLIdentical(compareXML(toDocumentWithoutDTD(file.getAsStream()),
-                toDocumentWithoutDTD(new ByteArrayInputStream(out.toByteArray()))), true);
+        assertXMLIdentical(compareXML(new InputSource(file.getAsStream()),
+                new InputSource(new ByteArrayInputStream(out.toByteArray()))), true);
     }
 
     public static TestSuite suite() throws Exception {

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java Sun Jul 22 09:11:26 2012
@@ -384,7 +384,7 @@ class SwitchingWrapper extends AbstractX
             if (currentEvent == DTD) {
                 // For a DTD event, only getText is allowed, but not getTextCharacters etc.
                 // (see the table in the Javadoc of XMLStreamReader)
-                return ((OMDocType)lastNode).getValue();
+                return ((OMDocType)lastNode).getInternalSubset();
             } else {
                 return getTextFromNode();
             }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/DOMXMLStreamReader.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/DOMXMLStreamReader.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/DOMXMLStreamReader.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/DOMXMLStreamReader.java Sun Jul 22 09:11:26 2012
@@ -23,14 +23,16 @@ import javax.xml.namespace.NamespaceCont
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 
+import org.apache.axiom.ext.stax.DTDReader;
 import org.apache.axiom.util.stax.AbstractXMLStreamReader;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
+import org.w3c.dom.DocumentType;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
 import org.w3c.dom.ProcessingInstruction;
 
-class DOMXMLStreamReader extends AbstractXMLStreamReader {
+class DOMXMLStreamReader extends AbstractXMLStreamReader implements DTDReader {
     private final Node root;
     private Node node;
     private int event;
@@ -47,7 +49,11 @@ class DOMXMLStreamReader extends Abstrac
     }
 
     public Object getProperty(String name) throws IllegalArgumentException {
-        return null;
+        if (DTDReader.PROPERTY.equals(name)) {
+            return this;
+        } else {
+            return null;
+        }
     }
 
     public int next() throws XMLStreamException {
@@ -77,8 +83,7 @@ class DOMXMLStreamReader extends Abstrac
                     break;
                 case Node.DOCUMENT_TYPE_NODE:
                     event = DTD;
-                    // There is no meaningful way to convert a DOM doctype node to StAX; skip the node
-                    continue;
+                    break;
                 case Node.ELEMENT_NODE:
                     if (visited) {
                         event = END_ELEMENT;
@@ -126,6 +131,18 @@ class DOMXMLStreamReader extends Abstrac
         return ((Document)node).getXmlStandalone();
     }
 
+    public String getRootName() {
+        return ((DocumentType)node).getName();
+    }
+
+    public String getPublicId() {
+        return ((DocumentType)node).getPublicId();
+    }
+
+    public String getSystemId() {
+        return ((DocumentType)node).getSystemId();
+    }
+
     public String getLocalName() {
         return node.getLocalName();
     }
@@ -214,7 +231,11 @@ class DOMXMLStreamReader extends Abstrac
     }
 
     public String getText() {
-        return node.getNodeValue();
+        if (event == DTD) {
+            return ((DocumentType)node).getInternalSubset();
+        } else {
+            return node.getNodeValue();
+        }
     }
 
     public String getPITarget() {

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/SAXOMXMLParserWrapper.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/SAXOMXMLParserWrapper.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/SAXOMXMLParserWrapper.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/SAXOMXMLParserWrapper.java Sun Jul 22 09:11:26 2012
@@ -56,12 +56,18 @@ public class SAXOMXMLParserWrapper imple
             SAXOMBuilder builder = new SAXOMBuilder(factory);
             XMLReader reader = source.getXMLReader();
             reader.setContentHandler(builder);
+            reader.setDTDHandler(builder);
             try {
                 reader.setProperty("http://xml.org/sax/properties/lexical-handler", builder);
             } catch (SAXException ex) {
                 // Ignore
             }
             try {
+                reader.setProperty("http://xml.org/sax/properties/declaration-handler", builder);
+            } catch (SAXException ex) {
+                // Ignore
+            }
+            try {
                 reader.parse(source.getInputSource());
             } catch (IOException ex) {
                 throw new OMException(ex);

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java Sun Jul 22 09:11:26 2012
@@ -68,6 +68,8 @@ public class DOMTestSuiteBuilder extends
         addTest(new org.apache.axiom.ts.dom.document.TestTransformerWithStylesheet(dbf, net.sf.saxon.TransformerFactoryImpl.class));
         addTest(new org.apache.axiom.ts.dom.document.TestValidator(dbf));
         addTest(new org.apache.axiom.ts.dom.documentfragment.TestCloneNode(dbf));
+        addTest(new org.apache.axiom.ts.dom.documenttype.TestWithParser1(dbf));
+        addTest(new org.apache.axiom.ts.dom.documenttype.TestWithParser2(dbf));
         addTest(new org.apache.axiom.ts.dom.element.TestAppendChild(dbf));
         addTest(new org.apache.axiom.ts.dom.element.TestAppendChildCyclic(dbf));
         addTest(new org.apache.axiom.ts.dom.element.TestAppendChildSelf(dbf));

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentTypeImpl.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentTypeImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentTypeImpl.java Sun Jul 22 09:11:26 2012
@@ -25,14 +25,23 @@ import javax.xml.stream.XMLStreamWriter;
 import org.apache.axiom.om.OMDocType;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.impl.OMNodeEx;
+import org.apache.axiom.util.stax.XMLStreamWriterUtils;
 import org.w3c.dom.DocumentType;
 import org.w3c.dom.NamedNodeMap;
 
 public class DocumentTypeImpl extends LeafNode implements DocumentType, OMDocType, OMNodeEx {
-    private String value;
+    private final String rootName;
+    private final String publicId;
+    private final String systemId;
+    private final String internalSubset;
     
-    public DocumentTypeImpl(OMFactory factory) {
+    public DocumentTypeImpl(String rootName, String publicId, String systemId,
+            String internalSubset, OMFactory factory) {
         super(factory);
+        this.rootName = rootName;
+        this.publicId = publicId;
+        this.systemId = systemId;
+        this.internalSubset = internalSubset;
     }
 
     public String getNodeName() {
@@ -44,7 +53,7 @@ public class DocumentTypeImpl extends Le
     }
 
     public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException {
-        throw new UnsupportedOperationException();
+        XMLStreamWriterUtils.writeDTD(writer, rootName, publicId, systemId, internalSubset);
     }
 
     public int getType() {
@@ -56,12 +65,15 @@ public class DocumentTypeImpl extends Le
     }
 
     public String getInternalSubset() {
-        throw new UnsupportedOperationException();
+        return internalSubset;
     }
 
     public String getName() {
-        // TODO Auto-generated method stub
-        return null;
+        return rootName;
+    }
+
+    public String getRootName() {
+        return rootName;
     }
 
     public NamedNodeMap getNotations() {
@@ -69,24 +81,14 @@ public class DocumentTypeImpl extends Le
     }
 
     public String getPublicId() {
-        throw new UnsupportedOperationException();
+        return publicId;
     }
 
     public String getSystemId() {
-        throw new UnsupportedOperationException();
-    }
-
-    public String getValue() {
-        return value;
-    }
-
-    public void setValue(String text) {
-        value = text;
+        return systemId;
     }
 
     LeafNode createClone() {
-        DocumentTypeImpl clone = new DocumentTypeImpl(factory);
-        clone.setValue(value);
-        return clone;
+        return new DocumentTypeImpl(rootName, publicId, systemId, internalSubset, factory);
     }
 }

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=1364242&r1=1364241&r2=1364242&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 Sun Jul 22 09:11:26 2012
@@ -312,13 +312,14 @@ public class OMDOMFactory implements OMF
         return new AttrImpl(null, localName, ns, value, this);
     }
 
-    public OMDocType createOMDocType(OMContainer parent, String content) {
-        return createOMDocType(parent, content, false);
+    public OMDocType createOMDocType(OMContainer parent, String rootName, String publicId,
+            String systemId, String internalSubset) {
+        return createOMDocType(parent, rootName, publicId, systemId, internalSubset, false);
     }
-    
-    public OMDocType createOMDocType(OMContainer parent, String content, boolean fromBuilder) {
-        DocumentTypeImpl docType = new DocumentTypeImpl(this);
-        docType.setValue(content);
+
+    public OMDocType createOMDocType(OMContainer parent, String rootName, String publicId,
+            String systemId, String internalSubset, boolean fromBuilder) {
+        DocumentTypeImpl docType = new DocumentTypeImpl(rootName, publicId, systemId, internalSubset, this);
         if (parent != null) {
             ((OMContainerEx)parent).addChild(docType, fromBuilder);
         }
@@ -403,8 +404,9 @@ public class OMDOMFactory implements OMF
             }
             case (OMNode.DTD_NODE): {
                 OMDocType importedDocType = (OMDocType) child;
-                OMDocType newDocType = createOMDocType(null, importedDocType.getValue());
-                return newDocType;
+                return createOMDocType(null, importedDocType.getRootName(),
+                        importedDocType.getPublicId(), importedDocType.getSystemId(),
+                        importedDocType.getInternalSubset());
             }
             default: {
                 throw new UnsupportedOperationException(

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java Sun Jul 22 09:11:26 2012
@@ -23,15 +23,10 @@ import junit.framework.TestSuite;
 
 import org.apache.axiom.om.impl.dom.factory.OMDOMMetaFactory;
 import org.apache.axiom.ts.dom.DOMTestSuiteBuilder;
-import org.apache.axiom.ts.dom.document.TestCloneNode;
 
 public class DOMImplementationTest extends TestCase {
     public static TestSuite suite() {
         DOMTestSuiteBuilder builder = new DOMTestSuiteBuilder(new OMDOMMetaFactory().newDocumentBuilderFactory());
-        
-        // DTDs are not handled correctly
-        builder.exclude(TestCloneNode.class, "(file=spaces.xml)");
-        
         return builder.build();
     }
 }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java Sun Jul 22 09:11:26 2012
@@ -51,9 +51,6 @@ public class OMImplementationTest extend
         builder.exclude(TestSerialize.class, "(&(file=iso-8859-1.xml)(container=document))");
         builder.exclude(TestCreateOMBuilderFromDOMSource.class, "(file=iso-8859-1.xml)");
         
-        // TODO: this case is not working because Axiom doesn't serialize the DTD
-        builder.exclude(TestSerialize.class, "(&(file=spaces.xml)(container=document))");
-        
         // TODO: investigate why this is not working with DOOM
         builder.exclude(TestGetChildrenWithName4.class);
 

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=1364242&r1=1364241&r2=1364242&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 Sun Jul 22 09:11:26 2012
@@ -24,23 +24,24 @@ import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMDocType;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNode;
+import org.apache.axiom.util.stax.XMLStreamWriterUtils;
 
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
 public class OMDocTypeImpl extends OMLeafNode implements OMDocType {
-    protected String value;
+    private final String rootName;
+    private final String publicId;
+    private final String systemId;
+    private final String internalSubset;
 
-    /**
-     * Constructor OMDocTypeImpl.
-     *
-     * @param parentNode
-     * @param contentText
-     */
-    public OMDocTypeImpl(OMContainer parentNode, String contentText,
-                         OMFactory factory, boolean fromBuilder) {
+    public OMDocTypeImpl(OMContainer parentNode, String rootName, String publicId, String systemId,
+            String internalSubset, OMFactory factory, boolean fromBuilder) {
         super(parentNode, factory, fromBuilder);
-        this.value = contentText;
+        this.rootName = rootName;
+        this.publicId = publicId;
+        this.systemId = systemId;
+        this.internalSubset = internalSubset;
     }
 
     public final int getType() {
@@ -48,28 +49,26 @@ public class OMDocTypeImpl extends OMLea
     }
 
     public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException {
-        writer.writeDTD(this.value);
+        XMLStreamWriterUtils.writeDTD(writer, rootName, publicId, systemId, internalSubset);
     }
 
-    /**
-     * Gets the value of this DocType.
-     *
-     * @return Returns String.
-     */
-    public String getValue() {
-        return value;
-    }
-
-    /**
-     * Sets the value of this DocType.
-     *
-     * @param text
-     */
-    public void setValue(String text) {
-        this.value = text;
+    public String getRootName() {
+        return rootName;
+    }
+
+    public String getPublicId() {
+        return publicId;
+    }
+
+    public String getSystemId() {
+        return systemId;
+    }
+
+    public String getInternalSubset() {
+        return internalSubset;
     }
 
     OMNode clone(OMCloneOptions options, OMContainer targetParent) {
-        return factory.createOMDocType(targetParent, value);
+        return factory.createOMDocType(targetParent, rootName, publicId, systemId, internalSubset);
     }
 }

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=1364242&r1=1364241&r2=1364242&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 Sun Jul 22 09:11:26 2012
@@ -294,19 +294,14 @@ public class OMLinkedListImplFactory imp
         return new OMAttributeImpl(localName, ns, value, this);
     }
 
-    /**
-     * Creates DocType/DTD.
-     *
-     * @param parent
-     * @param content
-     * @return Returns doctype.
-     */
-    public OMDocType createOMDocType(OMContainer parent, String content) {
-        return createOMDocType(parent, content, false);
+    public OMDocType createOMDocType(OMContainer parent, String rootName, String publicId,
+            String systemId, String internalSubset) {
+        return createOMDocType(parent, rootName, publicId, systemId, internalSubset, false);
     }
 
-    public OMDocType createOMDocType(OMContainer parent, String content, boolean fromBuilder) {
-        return new OMDocTypeImpl(parent, content, this, fromBuilder);
+    public OMDocType createOMDocType(OMContainer parent, String rootName, String publicId,
+            String systemId, String internalSubset, boolean fromBuilder) {
+        return new OMDocTypeImpl(parent, rootName, publicId, systemId, internalSubset, this, fromBuilder);
     }
 
     /**
@@ -401,7 +396,9 @@ public class OMLinkedListImplFactory imp
             }
             case (OMNode.DTD_NODE) : {
                 OMDocType importedDocType = (OMDocType) child;
-                return createOMDocType(null, importedDocType.getValue());
+                return createOMDocType(null, importedDocType.getRootName(),
+                        importedDocType.getPublicId(), importedDocType.getSystemId(),
+                        importedDocType.getInternalSubset());
             }
             default: {
                 throw new UnsupportedOperationException(

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java Sun Jul 22 09:11:26 2012
@@ -43,9 +43,6 @@ public class OMImplementationTest extend
         //       but uses another charset encoding to serialize the document
         builder.exclude(TestSerialize.class, "(&(file=iso-8859-1.xml)(container=document))");
         
-        // TODO: this case is not working because Axiom doesn't serialize the DTD
-        builder.exclude(TestSerialize.class, "(&(file=spaces.xml)(container=document))");
-        
         // TODO: if there is a comment node surrounded by text, then these text nodes need to be merged
         builder.exclude(TestDigest.class, "(|(file=digest3.xml)(file=digest4.xml))");
         

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-integration/src/test/java/org/apache/axiom/om/impl/builder/SAXOMBuilderSAXParserTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-integration/src/test/java/org/apache/axiom/om/impl/builder/SAXOMBuilderSAXParserTest.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-integration/src/test/java/org/apache/axiom/om/impl/builder/SAXOMBuilderSAXParserTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-integration/src/test/java/org/apache/axiom/om/impl/builder/SAXOMBuilderSAXParserTest.java Sun Jul 22 09:11:26 2012
@@ -49,7 +49,9 @@ public class SAXOMBuilderSAXParserTest e
         XMLReader reader = factory.newSAXParser().getXMLReader();
         SAXOMBuilder builder = new SAXOMBuilder();
         reader.setContentHandler(builder);
+        reader.setDTDHandler(builder);
         reader.setProperty("http://xml.org/sax/properties/lexical-handler", builder);
+        reader.setProperty("http://xml.org/sax/properties/declaration-handler", builder);
         InputStream in = file.getAsStream();
         try {
             reader.parse(new InputSource(in));
@@ -62,8 +64,8 @@ public class SAXOMBuilderSAXParserTest e
             builder.getDocument().serialize(baos);
             XMLUnit.setIgnoreAttributeOrder(true);
             assertXMLIdentical(compareXML(
-                    toDocumentWithoutDTD(in),
-                    toDocumentWithoutDTD(new ByteArrayInputStream(baos.toByteArray()))), true);
+                    new InputSource(in),
+                    new InputSource(new ByteArrayInputStream(baos.toByteArray()))), true);
         } finally {
             in.close();
         }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestCreateOMBuilderFromDOMSource.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestCreateOMBuilderFromDOMSource.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestCreateOMBuilderFromDOMSource.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestCreateOMBuilderFromDOMSource.java Sun Jul 22 09:11:26 2012
@@ -26,7 +26,6 @@ import javax.xml.parsers.DocumentBuilder
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.transform.dom.DOMSource;
 
-import org.apache.axiom.om.AbstractTestCase;
 import org.apache.axiom.om.OMMetaFactory;
 import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.apache.axiom.om.OMXMLParserWrapper;
@@ -34,6 +33,7 @@ import org.apache.axiom.testutils.confor
 import org.apache.axiom.ts.ConformanceTestCase;
 import org.custommonkey.xmlunit.XMLAssert;
 import org.custommonkey.xmlunit.XMLUnit;
+import org.xml.sax.InputSource;
 
 public class TestCreateOMBuilderFromDOMSource extends ConformanceTestCase {
     public TestCreateOMBuilderFromDOMSource(OMMetaFactory metaFactory, ConformanceTestFile file) {
@@ -51,8 +51,8 @@ public class TestCreateOMBuilderFromDOMS
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
             builder.getDocument().serialize(baos);
             XMLAssert.assertXMLIdentical(XMLUnit.compareXML(
-                    AbstractTestCase.toDocumentWithoutDTD(getFileAsStream()),
-                    AbstractTestCase.toDocumentWithoutDTD(new ByteArrayInputStream(baos.toByteArray()))), true);
+                    new InputSource(getFileAsStream()),
+                    new InputSource(new ByteArrayInputStream(baos.toByteArray()))), true);
         } finally {
             in.close();
         }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestCreateOMBuilderFromSAXSource.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestCreateOMBuilderFromSAXSource.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestCreateOMBuilderFromSAXSource.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestCreateOMBuilderFromSAXSource.java Sun Jul 22 09:11:26 2012
@@ -26,7 +26,6 @@ import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 import javax.xml.transform.sax.SAXSource;
 
-import org.apache.axiom.om.AbstractTestCase;
 import org.apache.axiom.om.OMMetaFactory;
 import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.apache.axiom.om.OMXMLParserWrapper;
@@ -53,8 +52,8 @@ public class TestCreateOMBuilderFromSAXS
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
             builder.getDocument().serialize(baos);
             XMLAssert.assertXMLIdentical(XMLUnit.compareXML(
-                    AbstractTestCase.toDocumentWithoutDTD(getFileAsStream()),
-                    AbstractTestCase.toDocumentWithoutDTD(new ByteArrayInputStream(baos.toByteArray()))), true);
+                    new InputSource(getFileAsStream()),
+                    new InputSource(new ByteArrayInputStream(baos.toByteArray()))), true);
         } finally {
             in.close();
         }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetSAXSource.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetSAXSource.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetSAXSource.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetSAXSource.java Sun Jul 22 09:11:26 2012
@@ -25,7 +25,6 @@ import java.io.InputStream;
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stream.StreamResult;
 
-import org.apache.axiom.om.AbstractTestCase;
 import org.apache.axiom.om.OMMetaFactory;
 import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.apache.axiom.om.OMXMLParserWrapper;
@@ -35,6 +34,7 @@ import org.apache.axiom.ts.ConformanceTe
 import org.apache.xalan.processor.TransformerFactoryImpl;
 import org.custommonkey.xmlunit.XMLAssert;
 import org.custommonkey.xmlunit.XMLUnit;
+import org.xml.sax.InputSource;
 
 public class TestGetSAXSource extends ConformanceTestCase {
     private final OMContainerFactory containerFactory;
@@ -61,7 +61,7 @@ public class TestGetSAXSource extends Co
             in.close();
         }
         XMLAssert.assertXMLIdentical(XMLUnit.compareXML(
-                AbstractTestCase.toDocumentWithoutDTD(getFileAsStream()),
-                AbstractTestCase.toDocumentWithoutDTD(new ByteArrayInputStream(out.toByteArray()))), true);
+                containerFactory.getControl(getFileAsStream()),
+                new InputSource(new ByteArrayInputStream(out.toByteArray()))), true);
     }
 }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMDocTypeWithoutParent.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMDocTypeWithoutParent.java?rev=1364242&r1=1364241&r2=1364242&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMDocTypeWithoutParent.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMDocTypeWithoutParent.java Sun Jul 22 09:11:26 2012
@@ -28,8 +28,11 @@ public class TestCreateOMDocTypeWithoutP
     }
 
     protected void runTest() throws Throwable {
-        OMDocType dtd = metaFactory.getOMFactory().createOMDocType(null, "content");
+        OMDocType dtd = metaFactory.getOMFactory().createOMDocType(null, "root", "publicId", "systemId", "internalSubset");
         assertNull(dtd.getParent());
-        assertEquals("content", dtd.getValue());
+        assertEquals("root", dtd.getRootName());
+        assertEquals("publicId", dtd.getPublicId());
+        assertEquals("systemId", dtd.getSystemId());
+        assertEquals("internalSubset", dtd.getInternalSubset());
     }
 }