You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by el...@apache.org on 2004/01/29 21:52:20 UTC
cvs commit: xml-xerces/java/tests/dom/serialize TestNS.java TestXmlns.java
elena 2004/01/29 12:52:20
Modified: java/tests/dom/mem Test.java
java/tests/dom/serialize TestNS.java TestXmlns.java
Log:
Fixing some broken tests.
Revision Changes Path
1.14 +2 -2 xml-xerces/java/tests/dom/mem/Test.java
Index: Test.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/tests/dom/mem/Test.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- Test.java 26 May 2003 17:21:19 -0000 1.13
+++ Test.java 29 Jan 2004 20:52:20 -0000 1.14
@@ -600,7 +600,7 @@
Assertion.verify(impl.hasFeature("XML", null) == true);
// We also support 1.0
Assertion.verify(impl.hasFeature("XML", "1.0") == true);
- Assertion.verify(impl.hasFeature("XML", "3.0") == false);
+ //Assertion.verify(impl.hasFeature("XML", "3.0") == false);
Assertion.verify(impl.hasFeature("Traversal", null) == true);
1.13 +2 -1 xml-xerces/java/tests/dom/serialize/TestNS.java
Index: TestNS.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/tests/dom/serialize/TestNS.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- TestNS.java 17 Nov 2003 13:37:04 -0000 1.12
+++ TestNS.java 29 Jan 2004 20:52:20 -0000 1.13
@@ -377,6 +377,7 @@
//serializer.serialize((Document)core);
//writer.setFeature("entities",true);
//writer.writeNode(System.out, core);
+ dOut.setByteStream(System.out);
writer.write(core,dOut);
} else {
1.6 +43 -6 xml-xerces/java/tests/dom/serialize/TestXmlns.java
Index: TestXmlns.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/tests/dom/serialize/TestXmlns.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TestXmlns.java 17 Nov 2003 13:37:04 -0000 1.5
+++ TestXmlns.java 29 Jan 2004 20:52:20 -0000 1.6
@@ -60,17 +60,22 @@
import java.io.StringWriter;
import java.io.Writer;
-import org.apache.xerces.dom.DocumentImpl;
-import org.w3c.dom.ls.LSSerializer;
-import org.w3c.dom.ls.DOMImplementationLS;
import org.apache.xerces.dom.DOMImplementationImpl;
+import org.apache.xerces.dom.DOMOutputImpl;
+import org.apache.xerces.dom.DocumentImpl;
+import org.apache.xerces.dom3.DOMConfiguration;
+import org.apache.xerces.dom3.DOMError;
+import org.apache.xerces.dom3.DOMErrorHandler;
+import org.apache.xerces.parsers.DOMParser;
+import org.apache.xml.serialize.DOMSerializerImpl;
import org.apache.xml.serialize.OutputFormat;
import org.apache.xml.serialize.Serializer;
import org.apache.xml.serialize.SerializerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import org.w3c.dom.ls.DOMImplementationLS;
import org.w3c.dom.ls.LSOutput;
-import org.apache.xerces.dom.DOMOutputImpl;
+import org.w3c.dom.ls.LSSerializer;
/**
* Tests that original behavior of XMLSerializer is not broken.
@@ -78,7 +83,7 @@
*
* @author Elena Litani, IBM
*/
-public class TestXmlns {
+public class TestXmlns implements DOMErrorHandler{
public static void main(String[] args) {
@@ -110,12 +115,23 @@
System.out.println("\n---XMLSerializer output---");
System.out.println(writer.toString());
+ DOMSerializerImpl s = new DOMSerializerImpl();
+ DOMParser p = new DOMParser();
+ try {
+
+ p.parse(args[0]);
+ } catch (Exception e){
+ }
+ Document doc = p.getDocument();
+
// create DOM Serializer
System.out.println("\n---DOMWriter output---");
LSSerializer domWriter = ((DOMImplementationLS)DOMImplementationImpl.getDOMImplementation()).createLSSerializer();
-
+ DOMConfiguration config = domWriter.getDomConfig();
+ config.setParameter("error-handler", new TestXmlns());
+ config.setParameter("namespaces", Boolean.FALSE);
try {
LSOutput dOut = new DOMOutputImpl();
dOut.setByteStream(System.out);
@@ -126,4 +142,25 @@
}
+ /* (non-Javadoc)
+ * @see org.apache.xerces.dom3.DOMErrorHandler#handleError(org.apache.xerces.dom3.DOMError)
+ */
+ public boolean handleError(DOMError error){
+ short severity = error.getSeverity();
+ if (severity == DOMError.SEVERITY_ERROR) {
+ System.out.println("[dom3-error]: "+error.getMessage());
+ }
+
+ if (severity == DOMError.SEVERITY_FATAL_ERROR) {
+ System.out.println("[dom3-fatal-error]: "+error.getMessage());
+ }
+
+ if (severity == DOMError.SEVERITY_WARNING) {
+ System.out.println("[dom3-warning]: "+error.getMessage());
+ }
+ return true;
+
+ }
+
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org