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 20:40:12 UTC
svn commit: r1364145 - in /webservices/axiom/branches/AXIOM-437/modules:
axiom-api/src/main/java/org/apache/axiom/om/impl/builder/
axiom-api/src/test/java/org/apache/axiom/om/
axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documenttype/
Author: veithen
Date: Sat Jul 21 18:40:11 2012
New Revision: 1364145
URL: http://svn.apache.org/viewvc?rev=1364145&view=rev
Log:
Ascertain that the getPublicId, getSystemId and getInternalSubset methods defined by OMDocType have the same contract as the corresponding methods defined by DOM's DocumentType interface.
Modified:
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/test/java/org/apache/axiom/om/DOMCompatibilityTest.java
webservices/axiom/branches/AXIOM-437/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documenttype/TestWithParser1.java
webservices/axiom/branches/AXIOM-437/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documenttype/TestWithParser2.java
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=1364145&r1=1364144&r2=1364145&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 18:40:11 2012
@@ -456,8 +456,13 @@ public class StAXOMBuilder extends StAXB
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, dtdReader.getRootName(), dtdReader.getPublicId(),
- dtdReader.getSystemId(), getDTDText(), true);
+ dtdReader.getSystemId(), internalSubset, true);
}
/**
Modified: webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/test/java/org/apache/axiom/om/DOMCompatibilityTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/test/java/org/apache/axiom/om/DOMCompatibilityTest.java?rev=1364145&r1=1364144&r2=1364145&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/test/java/org/apache/axiom/om/DOMCompatibilityTest.java (original)
+++ webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/test/java/org/apache/axiom/om/DOMCompatibilityTest.java Sat Jul 21 18:40:11 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/axiom/branches/AXIOM-437/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documenttype/TestWithParser1.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-437/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documenttype/TestWithParser1.java?rev=1364145&r1=1364144&r2=1364145&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-437/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documenttype/TestWithParser1.java (original)
+++ webservices/axiom/branches/AXIOM-437/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documenttype/TestWithParser1.java Sat Jul 21 18:40:11 2012
@@ -30,7 +30,7 @@ public class TestWithParser1 extends DOM
}
protected void runTest() throws Throwable {
- Document document = dbf.newDocumentBuilder().parse(TestWithParser1.class.getResourceAsStream("test1.xml"));
+ Document document = dbf.newDocumentBuilder().parse(TestWithParser1.class.getResource("test1.xml").toString());
DocumentType doctype = document.getDoctype();
assertEquals("root", doctype.getName());
assertNull(doctype.getPublicId());
Modified: webservices/axiom/branches/AXIOM-437/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documenttype/TestWithParser2.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-437/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documenttype/TestWithParser2.java?rev=1364145&r1=1364144&r2=1364145&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-437/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documenttype/TestWithParser2.java (original)
+++ webservices/axiom/branches/AXIOM-437/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documenttype/TestWithParser2.java Sat Jul 21 18:40:11 2012
@@ -30,7 +30,7 @@ public class TestWithParser2 extends DOM
}
protected void runTest() throws Throwable {
- Document document = dbf.newDocumentBuilder().parse(TestWithParser2.class.getResourceAsStream("test2.xml"));
+ Document document = dbf.newDocumentBuilder().parse(TestWithParser2.class.getResource("test2.xml").toString());
DocumentType doctype = document.getDoctype();
assertEquals("root", doctype.getName());
assertEquals("dummy", doctype.getPublicId());