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/21 13:05:30 UTC
svn commit: r1364065 - in /webservices/axiom/branches/AXIOM-437/modules:
axiom-api/src/main/java/org/apache/axiom/ext/stax/
axiom-api/src/main/java/org/apache/axiom/om/
axiom-api/src/main/java/org/apache/axiom/om/impl/builder/
axiom-api/src/main/java/o...
Author: veithen
Date: Sat Jul 21 11:05:29 2012
New Revision: 1364065
URL: http://svn.apache.org/viewvc?rev=1364065&view=rev
Log:
Partial implementation of correct DTD serialization.
Added:
webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/ext/stax/DTDReader.java (with props)
webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/StAX2StreamReaderWrapper.java (with props)
Modified:
webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/om/OMDocType.java
webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/OMFactoryEx.java
webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java
webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamingOMSerializer.java
webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamWriterUtils.java
webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/Woodstox3StreamReaderWrapper.java
webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/Woodstox4StreamReaderWrapper.java
webservices/axiom/branches/AXIOM-437/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java
webservices/axiom/branches/AXIOM-437/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java
webservices/axiom/branches/AXIOM-437/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocTypeImpl.java
webservices/axiom/branches/AXIOM-437/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java
webservices/axiom/branches/AXIOM-437/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java
Added: webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/ext/stax/DTDReader.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/ext/stax/DTDReader.java?rev=1364065&view=auto
==============================================================================
--- webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/ext/stax/DTDReader.java (added)
+++ webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/ext/stax/DTDReader.java Sat Jul 21 11:05:29 2012
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.axiom.ext.stax;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+/**
+ * Optional interface implemented by {@link XMLStreamReader} implementations that provide additional
+ * data about {@link XMLStreamConstants#DTD} events.
+ * <p>
+ * All the requirements outlined in {@link org.apache.axiom.ext.stax} apply to this extension
+ * interface. In particular, to get a reference to the extension, the consumer MUST call
+ * {@link XMLStreamReader#getProperty(String)} with {@link #PROPERTY} as the property name.
+ */
+public interface DTDReader {
+ /**
+ * The name of the property used to look up this extension interface from a
+ * {@link XMLStreamReader} implementation.
+ */
+ String PROPERTY = DTDReader.class.getName();
+
+ /**
+ * Get the root name of the DTD, i.e. the name immediately following the <tt>DOCTYPE</tt> keyword.
+ *
+ * @return the root name; must not be <code>null</code>
+ * @throws IllegalStateException
+ * if the current event is not {@link XMLStreamConstants#DTD}
+ */
+ String getRootName();
+
+ /**
+ * 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
+ * @throws IllegalStateException
+ * if the current event is not {@link XMLStreamConstants#DTD}
+ */
+ String getPublicId();
+
+ /**
+ * Get the system ID of the external subset.
+ *
+ * @return the system ID, or <code>null</code> if there is no external subset
+ * @throws IllegalStateException
+ * if the current event is not {@link XMLStreamConstants#DTD}
+ */
+ String getSystemId();
+}
Propchange: webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/ext/stax/DTDReader.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/om/OMDocType.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/om/OMDocType.java?rev=1364065&r1=1364064&r2=1364065&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/om/OMDocType.java (original)
+++ webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/om/OMDocType.java Sat Jul 21 11:05:29 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/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/OMFactoryEx.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/OMFactoryEx.java?rev=1364065&r1=1364064&r2=1364065&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/OMFactoryEx.java (original)
+++ webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/OMFactoryEx.java Sat Jul 21 11:05:29 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/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java?rev=1364065&r1=1364064&r2=1364065&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java (original)
+++ webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java Sat Jul 21 11:05:29 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,17 @@ 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");
}
- return omfactory.createOMDocType(target, getDTDText(), true);
+ return omfactory.createOMDocType(target, dtdReader.getRootName(), dtdReader.getPublicId(),
+ dtdReader.getSystemId(), getDTDText(), true);
}
/**
Modified: webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamingOMSerializer.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamingOMSerializer.java?rev=1364065&r1=1364064&r2=1364065&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamingOMSerializer.java (original)
+++ webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamingOMSerializer.java Sat Jul 21 11:05:29 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/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamWriterUtils.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamWriterUtils.java?rev=1364065&r1=1364064&r2=1364065&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamWriterUtils.java (original)
+++ webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamWriterUtils.java Sat Jul 21 11:05:29 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());
+ }
}
Added: webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/StAX2StreamReaderWrapper.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/StAX2StreamReaderWrapper.java?rev=1364065&view=auto
==============================================================================
--- webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/StAX2StreamReaderWrapper.java (added)
+++ webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/StAX2StreamReaderWrapper.java Sat Jul 21 11:05:29 2012
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.axiom.util.stax.dialect;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.ext.stax.DTDReader;
+import org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper;
+import org.codehaus.stax2.DTDInfo;
+
+/**
+ * {@link XMLStreamReaderWrapper} implementation that exposes the {@link DTDReader} extension
+ * based on the {@link DTDInfo} defined by "StAX2".
+ */
+class StAX2StreamReaderWrapper extends XMLStreamReaderWrapper implements DTDReader {
+ public StAX2StreamReaderWrapper(XMLStreamReader parent) {
+ super(parent);
+ }
+
+ public Object getProperty(String name) throws IllegalArgumentException {
+ if (DTDReader.PROPERTY.equals(name)) {
+ return this;
+ } else {
+ return super.getProperty(name);
+ }
+ }
+
+ public String getRootName() {
+ return ((DTDInfo)getParent()).getDTDRootName();
+ }
+
+ public String getPublicId() {
+ return ((DTDInfo)getParent()).getDTDPublicId();
+ }
+
+ public String getSystemId() {
+ return ((DTDInfo)getParent()).getDTDSystemId();
+ }
+}
Propchange: webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/StAX2StreamReaderWrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/Woodstox3StreamReaderWrapper.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/Woodstox3StreamReaderWrapper.java?rev=1364065&r1=1364064&r2=1364065&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/Woodstox3StreamReaderWrapper.java (original)
+++ webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/Woodstox3StreamReaderWrapper.java Sat Jul 21 11:05:29 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/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/Woodstox4StreamReaderWrapper.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/Woodstox4StreamReaderWrapper.java?rev=1364065&r1=1364064&r2=1364065&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/Woodstox4StreamReaderWrapper.java (original)
+++ webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/Woodstox4StreamReaderWrapper.java Sat Jul 21 11:05:29 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/axiom/branches/AXIOM-437/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-437/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java?rev=1364065&r1=1364064&r2=1364065&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-437/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java (original)
+++ webservices/axiom/branches/AXIOM-437/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java Sat Jul 21 11:05:29 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/axiom/branches/AXIOM-437/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-437/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java?rev=1364065&r1=1364064&r2=1364065&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-437/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java (original)
+++ webservices/axiom/branches/AXIOM-437/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java Sat Jul 21 11:05:29 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/axiom/branches/AXIOM-437/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-437/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocTypeImpl.java?rev=1364065&r1=1364064&r2=1364065&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-437/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocTypeImpl.java (original)
+++ webservices/axiom/branches/AXIOM-437/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocTypeImpl.java Sat Jul 21 11:05:29 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,25 +49,23 @@ 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) {
Modified: webservices/axiom/branches/AXIOM-437/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-437/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java?rev=1364065&r1=1364064&r2=1364065&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-437/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java (original)
+++ webservices/axiom/branches/AXIOM-437/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java Sat Jul 21 11:05:29 2012
@@ -305,8 +305,9 @@ public class OMLinkedListImplFactory imp
return createOMDocType(parent, content, 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);
}
/**
Modified: webservices/axiom/branches/AXIOM-437/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-437/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java?rev=1364065&r1=1364064&r2=1364065&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-437/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java (original)
+++ webservices/axiom/branches/AXIOM-437/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java Sat Jul 21 11:05:29 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))");