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 16:16:45 UTC
svn commit: r1364103 - in /webservices/axiom/branches/AXIOM-437/modules:
axiom-api/src/main/java/org/apache/axiom/om/
axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/
axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/
axiom-dom/src/test...
Author: veithen
Date: Sat Jul 21 14:16:44 2012
New Revision: 1364103
URL: http://svn.apache.org/viewvc?rev=1364103&view=rev
Log:
Completed the LLOM and DOOM implementations.
Modified:
webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/om/OMFactory.java
webservices/axiom/branches/AXIOM-437/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentTypeImpl.java
webservices/axiom/branches/AXIOM-437/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java
webservices/axiom/branches/AXIOM-437/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.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-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMDocTypeWithoutParent.java
Modified: webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/om/OMFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/om/OMFactory.java?rev=1364103&r1=1364102&r2=1364103&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/om/OMFactory.java (original)
+++ webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/om/OMFactory.java Sat Jul 21 14:16:44 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/axiom/branches/AXIOM-437/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-437/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentTypeImpl.java?rev=1364103&r1=1364102&r2=1364103&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-437/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentTypeImpl.java (original)
+++ webservices/axiom/branches/AXIOM-437/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentTypeImpl.java Sat Jul 21 14:16:44 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/axiom/branches/AXIOM-437/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-437/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java?rev=1364103&r1=1364102&r2=1364103&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-437/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java (original)
+++ webservices/axiom/branches/AXIOM-437/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java Sat Jul 21 14:16:44 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/axiom/branches/AXIOM-437/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-437/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java?rev=1364103&r1=1364102&r2=1364103&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-437/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java (original)
+++ webservices/axiom/branches/AXIOM-437/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java Sat Jul 21 14:16:44 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/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=1364103&r1=1364102&r2=1364103&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 14:16:44 2012
@@ -69,6 +69,6 @@ public class OMDocTypeImpl extends OMLea
}
OMNode clone(OMCloneOptions options, OMContainer targetParent) {
- return factory.createOMDocType(targetParent, value);
+ return factory.createOMDocType(targetParent, rootName, publicId, systemId, internalSubset);
}
}
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=1364103&r1=1364102&r2=1364103&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 14:16:44 2012
@@ -294,15 +294,9 @@ 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 rootName, String publicId,
@@ -402,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/axiom/branches/AXIOM-437/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMDocTypeWithoutParent.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-437/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMDocTypeWithoutParent.java?rev=1364103&r1=1364102&r2=1364103&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-437/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMDocTypeWithoutParent.java (original)
+++ webservices/axiom/branches/AXIOM-437/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMDocTypeWithoutParent.java Sat Jul 21 14:16:44 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());
}
}