diff -Nru xom-1.2.1/LICENSE.txt xom-1.2.10/LICENSE.txt --- xom-1.2.1/LICENSE.txt 2009-01-09 05:14:20.000000000 +0000 +++ xom-1.2.10/LICENSE.txt 2011-02-06 12:45:15.000000000 +0000 @@ -1,5 +1,5 @@ XOM is a dual streaming/tree-based API for processing XML with Java. -Copyright 2004, 2005, 2009 Elliotte Rusty Harold +Copyright 2004, 2005, 2009, 2010 Elliotte Rusty Harold This library is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public diff -Nru xom-1.2.1/README.txt xom-1.2.10/README.txt --- xom-1.2.1/README.txt 2009-01-09 05:15:59.000000000 +0000 +++ xom-1.2.10/README.txt 2013-04-24 11:11:50.000000000 +0000 @@ -2,10 +2,10 @@ only to be used by other programs. It requires Java 1.2 or later. To install it you'll need to place the XOM JAR archive somewhere in your -CLASSPATH. This archive is the file named something like xom-1.2.jar. +CLASSPATH. This archive is the file named something like xom-1.2.10.jar. (The version number may have changed if I've forgotten to update this document.) You can either put it in your jre/lib/ext -directory, add xom-1.2.jar to your CLASSPATH environment variable, or +directory, add xom-1.2.10.jar to your CLASSPATH environment variable, or use the -classpath option when invoking javac and java. To check your download you can run one of the sample programs found in @@ -14,7 +14,7 @@ around element boundaries. In Java 1.4 and later you can run it from the command line like this: -$ java -classpath xom-samples.jar:xom-1.2.jar nu.xom.samples.PrettyPrinter filename.xml +$ java -classpath xom-samples.jar:xom-1.2.10.jar nu.xom.samples.PrettyPrinter filename.xml Java 1.3 and earlier do not have a built-in XML parser so in these environments you'll also need to install XOM's supporting libraries. @@ -23,7 +23,7 @@ are quite a bit faster and less buggy than the ones bundled with the JDK, so you may well want to use them even in Java 1.4 and later. For example, -$ java -classpath xom-samples.jar:xom-1.2.jar:lib/xml-apis.jar:lib/xercesImpl.jar:lib/xalan.jar nu.xom.samples.PrettyPrinter filename.xml +$ java -classpath xom-samples.jar:xom-1.2.10.jar:lib/xml-apis.jar:lib/xercesImpl.jar:lib/xalan.jar nu.xom.samples.PrettyPrinter filename.xml You could leave out xalan.jar if you don't use any of the classes in nu.xom.xslt. junit.jar is only used for testing, and is @@ -54,6 +54,6 @@ Boston, MA 02111-1307 USA You can contact Elliotte Rusty Harold by sending e-mail to -elharo@metalab.unc.edu. Please include the word "XOM" in the +elharo@ibiblio.org. Please include the word "XOM" in the subject line. For more information see http://www.xom.nu/ or ask a question on the xom-interest mailing list. diff -Nru xom-1.2.1/Todo.txt xom-1.2.10/Todo.txt --- xom-1.2.1/Todo.txt 2009-02-21 14:42:08.000000000 +0000 +++ xom-1.2.10/Todo.txt 2013-04-24 11:09:13.000000000 +0000 @@ -53,9 +53,6 @@ add a NodeFactory section to the tutorial for processing big documents -check if we've accidentally sealed in jaxen -what should the manifest say about that? - Make a build target for non-LGPL, closed source version Sign up on Kagi or somewhere for software sales @@ -196,12 +193,69 @@ cvs [rtag aborted]: received abort signal lock.c:222: failed assertion `strncmp (repository, current_parsed_root->directory, strlen (current_parsed_root->directory)) == 0' + + +=============== +Done 1.2.10 Release +=============== + +Android support + +=============== +Done 1.2.9 Release +=============== + +Exclude UserDataHandler from Jaxen files we copy in to avoid problems with some application servers. + +=============== +Done 1.2.5 Release +=============== + +Throw NullPointerException instead of MalformedUriException when a null Reader is passed to Builder.build. + +Added a target that builds a maven2 jar archive. + +=============== +Done 1.2.4 Release +=============== + +More automatic deploy process + +Fixed maven targets + +Slight optimization to XPath by combining two loops. + + +=============== +Done 1.2.3 Release +=============== + +Bug fix for some obscure corner cases + + +=============== +Done 1.2.2 Release +=============== + +Support OSGI packaging + +Repackages the internal copy of org.jaxen into nu.xom.jaxen to avoid accidental conflicts and classloader problems + + +=============== +Done 1.2.1 Release +=============== + +Upgraded Info.java so java -jar xom.jar shows the right version number. + + =============== Done 1.2 Release =============== Fixed bug when escaping namespace URIs that contained ampersands in Element.toXML() + =============== Done 1.2b3 =============== diff -Nru xom-1.2.1/bin/nu/xom/benchmarks/package.html xom-1.2.10/bin/nu/xom/benchmarks/package.html --- xom-1.2.1/bin/nu/xom/benchmarks/package.html 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/bin/nu/xom/benchmarks/package.html 2011-02-06 12:45:06.000000000 +0000 @@ -0,0 +1,44 @@ + + + + + + + +

+nu.xom.benchmarks +includes some basic benchmarks to test the speed and +memory usage of XOM programs. +

+ +@since 1.0 + + + diff -Nru xom-1.2.1/bin/nu/xom/canonical/package.html xom-1.2.10/bin/nu/xom/canonical/package.html --- xom-1.2.1/bin/nu/xom/canonical/package.html 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/bin/nu/xom/canonical/package.html 2011-02-06 12:45:07.000000000 +0000 @@ -0,0 +1,47 @@ + + + + + + + +

+nu.xom.canonical +supports the output of +Canonical XML +from XOM. +For basic canonicalization of existing documents, this (or any other tree-based +solution) is likely not as efficient as a streaming, SAX-based solution. +However, this is useful for output from XOM in canonical form. +

+ +@since 1.0 + + + Binary files /tmp/8x7p6FWiJB/xom-1.2.1/bin/nu/xom/characters.dat and /tmp/8BQVzKG_Of/xom-1.2.10/bin/nu/xom/characters.dat differ Binary files /tmp/8x7p6FWiJB/xom-1.2.1/bin/nu/xom/compositions.dat and /tmp/8BQVzKG_Of/xom-1.2.10/bin/nu/xom/compositions.dat differ diff -Nru xom-1.2.1/bin/nu/xom/converters/package.html xom-1.2.10/bin/nu/xom/converters/package.html --- xom-1.2.1/bin/nu/xom/converters/package.html 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/bin/nu/xom/converters/package.html 2011-02-06 12:45:05.000000000 +0000 @@ -0,0 +1,44 @@ + + + + + + + +

+nu.xom.converters contains +classes that convert XOM documents to other +models such as SAX and DOM. +

+ +@since 1.0 + + + \ No newline at end of file Binary files /tmp/8x7p6FWiJB/xom-1.2.1/bin/nu/xom/doc-files/xom.png and /tmp/8BQVzKG_Of/xom-1.2.10/bin/nu/xom/doc-files/xom.png differ diff -Nru xom-1.2.1/bin/nu/xom/package.html xom-1.2.10/bin/nu/xom/package.html --- xom-1.2.1/bin/nu/xom/package.html 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/bin/nu/xom/package.html 2011-02-06 12:45:07.000000000 +0000 @@ -0,0 +1,48 @@ + + + + + + + +

+nu.xom is the core package of XOM +that contains all the basic classes representing the different kinds +of nodes: elements, attributes, comments, text nodes, and so forth. +It also contains the basic classes for parsing and serializing +XML documents, as well as the various exception classes +representing the different things that can go wrong while working +with XOM. +

+ + + +@since 1.0 + + + + diff -Nru xom-1.2.1/bin/nu/xom/samples/package.html xom-1.2.10/bin/nu/xom/samples/package.html --- xom-1.2.1/bin/nu/xom/samples/package.html 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/bin/nu/xom/samples/package.html 2011-02-06 12:45:11.000000000 +0000 @@ -0,0 +1,60 @@ + + + + + + + +

+nu.xom.samples includes several dozen example programs that +demonstrate different parts of the XOM API. +These are intended for tutorial purposes. They are not designed as reusable code +for the most part. Most of the examples are adapted +from Processing XML with Java +by Elliotte Rusty Harold. Please consult that book +(available in its entirety online) if you'd like more information +about what particular samples are intended to show. +That book provides SAX, DOM, and/or JDOM implementations +of most of these samples. +

+ +

+ These classes are not officially part of the XOM API. + They have not been extensively tested, and I make no promises + that they will be part of any future XOM release; or, if they are, + that their APIs will remain compatible. + Should you find any of them useful and wish to use them in your + own code, I recommend you copy the source code, and place it in your + own package. It probably wouldn't hurt to add a lot of unit tests as well. +

+ + +@since 1.0 + + + diff -Nru xom-1.2.1/bin/nu/xom/tests/package.html xom-1.2.10/bin/nu/xom/tests/package.html --- xom-1.2.1/bin/nu/xom/tests/package.html 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/bin/nu/xom/tests/package.html 2011-02-06 12:45:11.000000000 +0000 @@ -0,0 +1,83 @@ + + + + + + +

+nu.xom.tests contains the JUnit +based test suite for XOM. JUnit 3.7 or later is required. +(Earlier versions don't have the assertTrue method +these tests depend on.) +

+ +

+The XOMTests class runs all the tests, except those that +take an exceptionally long time to run (MegaTest). +Some of the tests, especially the builder tests, +depend on the underlying parser, and are known to fail +if the parser is buggy. Xerces 2.6.1 is the only parser which is currently +known to be able to run all the tests. Earlier versions of Xerces 2.x +cannot successfully run all the tests. +The IBM JVM 1.4.1 bundles an earlier version of Xerces which overrides the one bundled with XOM. +For this reason, a few tests will fail when using that VM. These tests should pass when using the +Sun VMs. +

+ +

+Similarly some of the XSLT tests depend on the +underlying TrAX engine. Xalan 2.7 and Saxon 6.5.4 both do a pretty good job, +but neither can pass all thne tests included with XOM. +testOASISMicrosoftConformanceSuite +is the most likely test to fail. +

+ + +

+A few tests rely on access to external network resources, + and may fail sproadically if the remote server is down or unreachable. +However, in general, they pass. +

+ +

+The only other test in this class which is known to fail is +testBuildFromFileThatContainsPlane1CharacterInName. This test fails on Mac OS X due to bugs in that platform's VM. However, it passes on other platforms. +

+ +

+There are numerous public classes and methods in this package because JUnit requires +all test cases to be public. However, the only published class is +XOMTestCase which provides methods for asserting the equality +of documents, elements, processing instructions, and other node types. +This may be useful for your own tests. The remainder of this package +should be treated as unstable and your code should not depend on it. +

+ +@since 1.0 + + + diff -Nru xom-1.2.1/bin/nu/xom/tools/package.html xom-1.2.10/bin/nu/xom/tools/package.html --- xom-1.2.1/bin/nu/xom/tools/package.html 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/bin/nu/xom/tools/package.html 2011-02-06 12:45:05.000000000 +0000 @@ -0,0 +1,41 @@ + + + + + + + +

+nu.xom.tools contains +classes that are used to build XOM. +They are not part of the published API. +

+ +@since 1.0 + + + \ No newline at end of file diff -Nru xom-1.2.1/bin/nu/xom/xinclude/package.html xom-1.2.10/bin/nu/xom/xinclude/package.html --- xom-1.2.1/bin/nu/xom/xinclude/package.html 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/bin/nu/xom/xinclude/package.html 2011-02-06 12:45:06.000000000 +0000 @@ -0,0 +1,44 @@ + + + + + + + +

+nu.xom.xinclude supports XInclude processing of XOM documents and elements. +It is conformant to the +final recommendation of XML Inclusions (XInclude) Version 1.0 +including fallbacks, XPointer bare names, the accept +and accept-language attributes, and the XPointer +element() scheme. +

+ +@since 1.0 + + + diff -Nru xom-1.2.1/bin/nu/xom/xslt/package.html xom-1.2.10/bin/nu/xom/xslt/package.html --- xom-1.2.1/bin/nu/xom/xslt/package.html 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/bin/nu/xom/xslt/package.html 2011-02-06 12:45:05.000000000 +0000 @@ -0,0 +1,40 @@ + + + + + + + +

+nu.xom.xslt connects +XOM documents to TrAX-based XSLT processors. +

+ +@since 1.0 + + + diff -Nru xom-1.2.1/build.xml xom-1.2.10/build.xml --- xom-1.2.1/build.xml 2009-03-04 13:31:18.000000000 +0000 +++ xom-1.2.10/build.xml 2013-04-25 00:23:59.000000000 +0000 @@ -1,5 +1,5 @@ - @@ -31,13 +31,25 @@ - - + + + + + + + + + + + + + - - + + @@ -73,10 +85,12 @@ - + - + + + @@ -147,18 +161,23 @@ available targets are: - help --> print this message - jar --> build the xom.jar file - samples --> build the xom-samples.jar file - compile --> compile the source code - compile15 --> compile the classes that depend on Java 1.5 - javadoc --> generate the API documentation - betterdoc --> better formatted API documentation (requires Ant 1.6) - test --> run JUnit test suite - testui --> run Junit test suite in GUI - clean --> clean up the build directory - dist --> the zip and .tar.gz files - + help --> print this message + jar --> build the xom.jar file + samples --> build the xom-samples.jar file + compile --> compile the source code + compile15 --> compile the classes that depend on Java 1.5 + javadoc --> generate the API documentation + betterdoc --> better formatted API documentation (requires Ant 1.6) + test --> run JUnit test suite + testui --> run JUnit test suite in GUI + clean --> clean up the build directory + dist --> the zip and .tar.gz files + uploaddocs --> upload API documentation and home page + uploadbetadocs --> upload unstable API documentation and home page + upload --> upload archive files + postbeta --> tag and upload a beta release + release --> tag and upload a final release + Use the option -Dfat=true to make Text objects bigger but faster. ------------------------------------------------------------- @@ -169,6 +188,8 @@ + + @@ -204,10 +225,14 @@ source="1.3" encoding="UTF-8" fork="true" + includeAntRuntime="false" excludes="nu/xom/pantry/* nu/xom/tools/* nu/xom/samples/*Servlet.java"> + + + ${version} @@ -230,7 +255,8 @@ deprecation="${deprecation}" target="1.2" source="1.3" - encoding="UTF-8"> + encoding="UTF-8" + includeAntRuntime="false"> @@ -247,7 +273,8 @@ target="1.2" source="1.3" encoding="UTF-8" - failonerror="false"> + failonerror="false" + includeAntRuntime="false"> @@ -295,16 +322,20 @@ - + - - + + + + @@ -315,17 +346,32 @@ + + + + + + + + + + + +
- - - - + + + +
-
+
- +
@@ -349,7 +395,11 @@
- + + + + @@ -396,7 +446,7 @@ link="http://www.junit.org/junit/javadoc/3.8.1" doctitle="${Name} ${version}" bottom="Copyright 2002-${year} <a href='http://www.elharo.com/'>Elliotte Rusty Harold</a> - <br /> <a href='mailto:elharo%40metalab%2Eunc%2Eedu?Subject=XOM'>elharo@metalab.unc.edu</a>"> + <br /> <a href='mailto:elharo%40ibiblio%2Eorg?Subject=XOM'>elharo@ibiblio.org</a>"> @@ -449,7 +499,7 @@ link="http://www.junit.org/junit/javadoc/3.8.1" doctitle="${Name} ${version}" bottom="Copyright 2002-${year} <a href='http://www.elharo.com/'>Elliotte Rusty Harold</a> - <br/> <a href='mailto:elharo@metalab.unc.edu?Subject=XOM'>elharo@metalab.unc.edu</a>"> + <br/> <a href='mailto:elharo%40ibiblio%2Eorg?Subject=XOM'>elharo@ibiblio.org</a>"> @@ -465,6 +515,7 @@ target="1.2" source="1.3" encoding="UTF-8" + includeAntRuntime="false" includes="nu/xom/tools/*"> @@ -479,9 +530,78 @@ + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -557,6 +677,7 @@ + @@ -580,8 +701,8 @@ - - + + @@ -676,31 +797,73 @@ - - + See http://maven.apache.org/maven-1.x/reference/repository-upload.html --> + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + diff -Nru xom-1.2.1/data/c14n11/xmlbase-c14n11spec-102.output xom-1.2.10/data/c14n11/xmlbase-c14n11spec-102.output --- xom-1.2.1/data/c14n11/xmlbase-c14n11spec-102.output 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/data/c14n11/xmlbase-c14n11spec-102.output 2011-02-21 19:35:48.000000000 +0000 @@ -0,0 +1 @@ + \ No newline at end of file diff -Nru xom-1.2.1/data/c14n11/xmlbase-c14n11spec-input.xml xom-1.2.10/data/c14n11/xmlbase-c14n11spec-input.xml --- xom-1.2.1/data/c14n11/xmlbase-c14n11spec-input.xml 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/data/c14n11/xmlbase-c14n11spec-input.xml 2011-02-21 19:33:08.000000000 +0000 @@ -0,0 +1,11 @@ + + +]> + + + + + + + \ No newline at end of file diff -Nru xom-1.2.1/data/c14n11/xmlbase-c14n11spec2-102.output xom-1.2.10/data/c14n11/xmlbase-c14n11spec2-102.output --- xom-1.2.1/data/c14n11/xmlbase-c14n11spec2-102.output 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/data/c14n11/xmlbase-c14n11spec2-102.output 2011-02-21 22:45:29.000000000 +0000 @@ -0,0 +1 @@ + \ No newline at end of file diff -Nru xom-1.2.1/data/c14n11/xmlbase-c14n11spec2-input.xml xom-1.2.10/data/c14n11/xmlbase-c14n11spec2-input.xml --- xom-1.2.1/data/c14n11/xmlbase-c14n11spec2-input.xml 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/data/c14n11/xmlbase-c14n11spec2-input.xml 2011-02-21 22:41:17.000000000 +0000 @@ -0,0 +1,11 @@ + + +]> + + + + + + + \ No newline at end of file diff -Nru xom-1.2.1/data/c14n11/xmlbase-c14n11spec3-103.output xom-1.2.10/data/c14n11/xmlbase-c14n11spec3-103.output --- xom-1.2.1/data/c14n11/xmlbase-c14n11spec3-103.output 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/data/c14n11/xmlbase-c14n11spec3-103.output 2011-02-21 22:48:33.000000000 +0000 @@ -0,0 +1,2 @@ + + \ No newline at end of file diff -Nru xom-1.2.1/data/c14n11/xmlbase-c14n11spec3-input.xml xom-1.2.10/data/c14n11/xmlbase-c14n11spec3-input.xml --- xom-1.2.1/data/c14n11/xmlbase-c14n11spec3-input.xml 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/data/c14n11/xmlbase-c14n11spec3-input.xml 2011-02-21 22:48:09.000000000 +0000 @@ -0,0 +1,9 @@ + + + + + + + + + diff -Nru xom-1.2.1/data/c14n11/xmlbase-prop-1.output xom-1.2.10/data/c14n11/xmlbase-prop-1.output --- xom-1.2.1/data/c14n11/xmlbase-prop-1.output 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/data/c14n11/xmlbase-prop-1.output 2011-02-21 23:01:37.000000000 +0000 @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff -Nru xom-1.2.1/data/c14n11/xmlbase-prop-2.output xom-1.2.10/data/c14n11/xmlbase-prop-2.output --- xom-1.2.1/data/c14n11/xmlbase-prop-2.output 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/data/c14n11/xmlbase-prop-2.output 2011-02-21 23:03:31.000000000 +0000 @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff -Nru xom-1.2.1/data/c14n11/xmlbase-prop-3.output xom-1.2.10/data/c14n11/xmlbase-prop-3.output --- xom-1.2.1/data/c14n11/xmlbase-prop-3.output 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/data/c14n11/xmlbase-prop-3.output 2011-02-22 00:42:53.000000000 +0000 @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff -Nru xom-1.2.1/data/c14n11/xmlbase-prop-4.output xom-1.2.10/data/c14n11/xmlbase-prop-4.output --- xom-1.2.1/data/c14n11/xmlbase-prop-4.output 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/data/c14n11/xmlbase-prop-4.output 2011-02-22 00:41:16.000000000 +0000 @@ -0,0 +1 @@ + \ No newline at end of file diff -Nru xom-1.2.1/data/c14n11/xmlbase-prop-5.output xom-1.2.10/data/c14n11/xmlbase-prop-5.output --- xom-1.2.1/data/c14n11/xmlbase-prop-5.output 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/data/c14n11/xmlbase-prop-5.output 2011-02-22 00:44:18.000000000 +0000 @@ -0,0 +1 @@ + \ No newline at end of file diff -Nru xom-1.2.1/data/c14n11/xmlbase-prop-6.output xom-1.2.10/data/c14n11/xmlbase-prop-6.output --- xom-1.2.1/data/c14n11/xmlbase-prop-6.output 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/data/c14n11/xmlbase-prop-6.output 2011-02-22 00:45:24.000000000 +0000 @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff -Nru xom-1.2.1/data/c14n11/xmlbase-prop-7.output xom-1.2.10/data/c14n11/xmlbase-prop-7.output --- xom-1.2.1/data/c14n11/xmlbase-prop-7.output 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/data/c14n11/xmlbase-prop-7.output 2011-02-22 00:46:54.000000000 +0000 @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff -Nru xom-1.2.1/data/c14n11/xmlbase-prop-input.xml xom-1.2.10/data/c14n11/xmlbase-prop-input.xml --- xom-1.2.1/data/c14n11/xmlbase-prop-input.xml 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/data/c14n11/xmlbase-prop-input.xml 2011-02-21 22:59:36.000000000 +0000 @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff -Nru xom-1.2.1/data/c14n11/xmlid-1.output xom-1.2.10/data/c14n11/xmlid-1.output --- xom-1.2.1/data/c14n11/xmlid-1.output 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/data/c14n11/xmlid-1.output 2011-02-21 19:09:55.000000000 +0000 @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff -Nru xom-1.2.1/data/c14n11/xmlid-2.output xom-1.2.10/data/c14n11/xmlid-2.output --- xom-1.2.1/data/c14n11/xmlid-2.output 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/data/c14n11/xmlid-2.output 2011-02-21 19:10:45.000000000 +0000 @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff -Nru xom-1.2.1/data/c14n11/xmlid-input.xml xom-1.2.10/data/c14n11/xmlid-input.xml --- xom-1.2.1/data/c14n11/xmlid-input.xml 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/data/c14n11/xmlid-input.xml 2011-02-21 19:10:02.000000000 +0000 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + \ No newline at end of file diff -Nru xom-1.2.1/data/c14n11/xmllang-1.output xom-1.2.10/data/c14n11/xmllang-1.output --- xom-1.2.1/data/c14n11/xmllang-1.output 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/data/c14n11/xmllang-1.output 2011-02-21 16:55:59.000000000 +0000 @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff -Nru xom-1.2.1/data/c14n11/xmllang-2.output xom-1.2.10/data/c14n11/xmllang-2.output --- xom-1.2.1/data/c14n11/xmllang-2.output 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/data/c14n11/xmllang-2.output 2011-02-21 17:14:02.000000000 +0000 @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff -Nru xom-1.2.1/data/c14n11/xmllang-3.output xom-1.2.10/data/c14n11/xmllang-3.output --- xom-1.2.1/data/c14n11/xmllang-3.output 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/data/c14n11/xmllang-3.output 2011-02-21 17:17:53.000000000 +0000 @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff -Nru xom-1.2.1/data/c14n11/xmllang-4.output xom-1.2.10/data/c14n11/xmllang-4.output --- xom-1.2.1/data/c14n11/xmllang-4.output 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/data/c14n11/xmllang-4.output 2011-02-21 18:45:30.000000000 +0000 @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff -Nru xom-1.2.1/data/c14n11/xmllang-input.xml xom-1.2.10/data/c14n11/xmllang-input.xml --- xom-1.2.1/data/c14n11/xmllang-input.xml 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/data/c14n11/xmllang-input.xml 2011-02-21 16:46:33.000000000 +0000 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + \ No newline at end of file diff -Nru xom-1.2.1/data/c14n11/xmlspace-1.output xom-1.2.10/data/c14n11/xmlspace-1.output --- xom-1.2.1/data/c14n11/xmlspace-1.output 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/data/c14n11/xmlspace-1.output 2011-02-21 18:55:05.000000000 +0000 @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff -Nru xom-1.2.1/data/c14n11/xmlspace-2.output xom-1.2.10/data/c14n11/xmlspace-2.output --- xom-1.2.1/data/c14n11/xmlspace-2.output 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/data/c14n11/xmlspace-2.output 2011-02-21 18:57:30.000000000 +0000 @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff -Nru xom-1.2.1/data/c14n11/xmlspace-3.output xom-1.2.10/data/c14n11/xmlspace-3.output --- xom-1.2.1/data/c14n11/xmlspace-3.output 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/data/c14n11/xmlspace-3.output 2011-02-21 18:57:36.000000000 +0000 @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff -Nru xom-1.2.1/data/c14n11/xmlspace-4.output xom-1.2.10/data/c14n11/xmlspace-4.output --- xom-1.2.1/data/c14n11/xmlspace-4.output 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/data/c14n11/xmlspace-4.output 2011-02-21 18:57:42.000000000 +0000 @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff -Nru xom-1.2.1/data/c14n11/xmlspace-input.xml xom-1.2.10/data/c14n11/xmlspace-input.xml --- xom-1.2.1/data/c14n11/xmlspace-input.xml 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/data/c14n11/xmlspace-input.xml 2011-02-21 18:50:37.000000000 +0000 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + \ No newline at end of file diff -Nru xom-1.2.1/data/nonquirky.xhtml xom-1.2.10/data/nonquirky.xhtml --- xom-1.2.1/data/nonquirky.xhtml 2007-06-03 13:52:01.000000000 +0000 +++ xom-1.2.10/data/nonquirky.xhtml 2011-02-06 12:45:25.000000000 +0000 @@ -1,5 +1,5 @@ + "http://www.cafeconleche.org/DTD/strict.dtd"> XOM Test diff -Nru xom-1.2.1/data/xmlid/catalog.xml xom-1.2.10/data/xmlid/catalog.xml --- xom-1.2.1/data/xmlid/catalog.xml 2005-04-02 15:34:11.000000000 +0000 +++ xom-1.2.10/data/xmlid/catalog.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,163 +0,0 @@ - - - - - ????? - 2005-03-28 - - - tests - ???? - 2005-03-28 - Normalize xml:id attributes - - - 001_normalize.xml - te st - - - - - tests - ???? - 2005-03-28 - Recognize xml:id attribute not declared in DTD - - - 002_undecl.xml - test - - - - - tests - ???? - 2005-03-28 - Recognize xml:id attribute declared as ID type in internal DTD subset - - - 003_dtd.xml - id - - - - - tests - ???? - 2005-03-28 - Recognize xml:id attribute declared as ID type in W3C XML schema langauge schema - - - 004_schema.xml - id - - - - - - tests - ???? - 2005-03-28 - Recognize duplicate xml:id attribute values on different elements - - - 005_errdup.xml - dup - dup - - - - - - tests - ???? - 2005-03-28 - Recognize xml:id attribute declared as NMTOKENS type in internal DTD subset - - - 005_errdtdbad.xml - id - - - - - - tests - ???? - 2005-03-28 - Recognize xml:id attribute declared as NMTOKENS type in W3C XML schema langauge schema - - - 006_errschemabad.xml - id - - - - - tests - ???? - 2005-03-28 - Recognize xml:id attribute value that duplciates the value of an ID type attribute declared in the internal DTD subset - - - 007_errdup.xml - id1 - id1 - - - - - tests - ???? - 2005-03-28 - Recognize xml:id attribute in document without a DTD - - - 008_ok10.xml - anid - - - - - tests - ???? - 2005-03-28 - Recognize xml:id attribute in XML 1.1 document without a DTD - - - 009_ok11.xml - - id?ok - - - - - tests - ???? - 2005-03-28 - An element can have both a DTD declared ID type attribute and an undeclared xml:id attribute. - - - 010_okxref.xml - id1 - id2 - - - - - tests - ???? - 2005-03-28 - xml:id attribute values are normalized - - - 011_oknormalize.xml - anid - - - - - - diff -Nru xom-1.2.1/data/xmlid/tests/001_normalize.xml xom-1.2.10/data/xmlid/tests/001_normalize.xml --- xom-1.2.1/data/xmlid/tests/001_normalize.xml 2005-04-02 14:46:15.000000000 +0000 +++ xom-1.2.10/data/xmlid/tests/001_normalize.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ - - MATCH - diff -Nru xom-1.2.1/data/xmlid/tests/002_undecl.xml xom-1.2.10/data/xmlid/tests/002_undecl.xml --- xom-1.2.1/data/xmlid/tests/002_undecl.xml 2005-04-02 14:46:21.000000000 +0000 +++ xom-1.2.10/data/xmlid/tests/002_undecl.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ - - MATCH - diff -Nru xom-1.2.1/data/xmlid/tests/003_dtd.xml xom-1.2.10/data/xmlid/tests/003_dtd.xml --- xom-1.2.1/data/xmlid/tests/003_dtd.xml 2005-04-02 14:46:25.000000000 +0000 +++ xom-1.2.10/data/xmlid/tests/003_dtd.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ - -]> - - MATCH - diff -Nru xom-1.2.1/data/xmlid/tests/004_schema.xml xom-1.2.10/data/xmlid/tests/004_schema.xml --- xom-1.2.1/data/xmlid/tests/004_schema.xml 2005-04-02 14:46:30.000000000 +0000 +++ xom-1.2.10/data/xmlid/tests/004_schema.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ - - MATCH - diff -Nru xom-1.2.1/data/xmlid/tests/005_errdtdbad.xml xom-1.2.10/data/xmlid/tests/005_errdtdbad.xml --- xom-1.2.1/data/xmlid/tests/005_errdtdbad.xml 2005-04-02 14:46:39.000000000 +0000 +++ xom-1.2.10/data/xmlid/tests/005_errdtdbad.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ - -]> - - BADDECL - diff -Nru xom-1.2.1/data/xmlid/tests/005_errdup.xml xom-1.2.10/data/xmlid/tests/005_errdup.xml --- xom-1.2.1/data/xmlid/tests/005_errdup.xml 2005-04-02 14:46:43.000000000 +0000 +++ xom-1.2.10/data/xmlid/tests/005_errdup.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ - - DUPLICATE - DUPLICATE - diff -Nru xom-1.2.1/data/xmlid/tests/006_errschemabad.xml xom-1.2.10/data/xmlid/tests/006_errschemabad.xml --- xom-1.2.1/data/xmlid/tests/006_errschemabad.xml 2005-04-02 14:46:49.000000000 +0000 +++ xom-1.2.10/data/xmlid/tests/006_errschemabad.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ - - MATCH - diff -Nru xom-1.2.1/data/xmlid/tests/007_errdup.xml xom-1.2.10/data/xmlid/tests/007_errdup.xml --- xom-1.2.1/data/xmlid/tests/007_errdup.xml 2005-04-02 14:46:55.000000000 +0000 +++ xom-1.2.10/data/xmlid/tests/007_errdup.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ - -]> - - - diff -Nru xom-1.2.1/data/xmlid/tests/008_ok10.xml xom-1.2.10/data/xmlid/tests/008_ok10.xml --- xom-1.2.1/data/xmlid/tests/008_ok10.xml 2005-04-02 14:47:02.000000000 +0000 +++ xom-1.2.10/data/xmlid/tests/008_ok10.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ - -

- diff -Nru xom-1.2.1/data/xmlid/tests/009_ok11.xml xom-1.2.10/data/xmlid/tests/009_ok11.xml --- xom-1.2.1/data/xmlid/tests/009_ok11.xml 2005-04-02 14:47:07.000000000 +0000 +++ xom-1.2.10/data/xmlid/tests/009_ok11.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ - - -

- diff -Nru xom-1.2.1/data/xmlid/tests/010_okxref.xml xom-1.2.10/data/xmlid/tests/010_okxref.xml --- xom-1.2.1/data/xmlid/tests/010_okxref.xml 2005-04-02 14:47:14.000000000 +0000 +++ xom-1.2.10/data/xmlid/tests/010_okxref.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ - -]> - - - - diff -Nru xom-1.2.1/data/xmlid/tests/011_oknormalize.xml xom-1.2.10/data/xmlid/tests/011_oknormalize.xml --- xom-1.2.1/data/xmlid/tests/011_oknormalize.xml 2005-04-02 14:47:19.000000000 +0000 +++ xom-1.2.10/data/xmlid/tests/011_oknormalize.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ - -

- diff -Nru xom-1.2.1/data/xmlid/tests/badschema.xsd xom-1.2.10/data/xmlid/tests/badschema.xsd --- xom-1.2.1/data/xmlid/tests/badschema.xsd 2005-04-02 15:16:36.000000000 +0000 +++ xom-1.2.10/data/xmlid/tests/badschema.xsd 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff -Nru xom-1.2.1/data/xmlid/tests/badxml.xsd xom-1.2.10/data/xmlid/tests/badxml.xsd --- xom-1.2.1/data/xmlid/tests/badxml.xsd 2005-04-02 15:16:45.000000000 +0000 +++ xom-1.2.10/data/xmlid/tests/badxml.xsd 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ - - - - diff -Nru xom-1.2.1/data/xmlid/tests/schema.xsd xom-1.2.10/data/xmlid/tests/schema.xsd --- xom-1.2.1/data/xmlid/tests/schema.xsd 2005-04-02 15:02:25.000000000 +0000 +++ xom-1.2.10/data/xmlid/tests/schema.xsd 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff -Nru xom-1.2.1/data/xmlid/tests/xml.xsd xom-1.2.10/data/xmlid/tests/xml.xsd --- xom-1.2.1/data/xmlid/tests/xml.xsd 2005-04-02 15:02:54.000000000 +0000 +++ xom-1.2.10/data/xmlid/tests/xml.xsd 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ - - - - diff -Nru xom-1.2.1/debian/changelog xom-1.2.10/debian/changelog --- xom-1.2.1/debian/changelog 2012-05-18 10:49:16.000000000 +0000 +++ xom-1.2.10/debian/changelog 2013-07-25 14:09:44.000000000 +0000 @@ -1,8 +1,21 @@ -xom (1.2.1-3build1) quantal; urgency=low +xom (1.2.10-1) unstable; urgency=low - * No-change rebuild with openjdk-7 as default-jdk. + * New upstream release + * Updated the Maven pom + * Refreshed the patches + * Added a patch to include the Ant runtime when compiling + * Added a patch to replace jarjar with the regular jar Ant task + * Removed 0004-Remove-sun-imports.patch since the JDK15XML1_0Parser is really + meant to be used with the parser provided by the JDK and not the standalone + version of Xerces. + * Moved the samples jar in the documentation package + * debian/control: + - Added the missing runtime dependency on libxerces2-java (Closes: #628142) + - Updated Standards-Version to 3.9.4 (no changes) + - Use canonical URLs for the Vcs-* fields + - Removed the article at the beginning of the short description - -- James Page Fri, 18 May 2012 11:49:16 +0100 + -- Emmanuel Bourg Thu, 25 Jul 2013 15:37:37 +0200 xom (1.2.1-3) unstable; urgency=low diff -Nru xom-1.2.1/debian/control xom-1.2.10/debian/control --- xom-1.2.1/debian/control 2011-04-25 12:11:03.000000000 +0000 +++ xom-1.2.10/debian/control 2013-07-25 12:58:10.000000000 +0000 @@ -2,20 +2,21 @@ Section: java Priority: optional Maintainer: Debian Java Maintainers -Uploaders: Stephan Michels , Varun Hiremath , Kumar Appaiah +Uploaders: Stephan Michels , Varun Hiremath , + Kumar Appaiah , Emmanuel Bourg Build-Depends: debhelper (>= 5), cdbs, maven-repo-helper Build-Depends-Indep: ant, default-jdk, junit (>= 3.8.1), libxerces2-java, libxalan2-java, libjaxen-java (>= 1.1) -Standards-Version: 3.9.2 -Homepage: http://www.xom.nu/ -Vcs-Svn: svn://svn.debian.org/svn/pkg-java/trunk/xom -Vcs-Browser: http://svn.debian.org/wsvn/pkg-java/trunk/xom +Standards-Version: 3.9.4 +Vcs-Svn: svn://anonscm.debian.org/pkg-java/trunk/xom +Vcs-Browser: http://anonscm.debian.org/viewvc/pkg-java/trunk/xom +Homepage: http://www.xom.nu Package: libxom-java Architecture: all Suggests: libxom-java-doc -Depends: ${misc:Depends}, libjaxen-java (>= 1.1~beta8) -Description: A new XML object model for Java +Depends: ${misc:Depends}, libjaxen-java (>= 1.1~beta8), libxerces2-java +Description: New XML object model for Java XOM(tm) is a new XML object model. It is an open source (LGPL), tree-based API for processing XML with Java that strives for correctness, simplicity, and performance, in that order. diff -Nru xom-1.2.1/debian/patches/0001-Remove-jaxen-from-build.patch xom-1.2.10/debian/patches/0001-Remove-jaxen-from-build.patch --- xom-1.2.1/debian/patches/0001-Remove-jaxen-from-build.patch 2010-02-25 19:11:31.000000000 +0000 +++ xom-1.2.10/debian/patches/0001-Remove-jaxen-from-build.patch 2013-07-25 11:22:08.000000000 +0000 @@ -1,16 +1,8 @@ -From: Varun Hiremath -Date: Thu, 25 Feb 2010 19:59:37 +0100 -Subject: [PATCH] Remove jaxen from build - ---- - build.xml | 50 +------------------------------------------------- - 1 files changed, 1 insertions(+), 49 deletions(-) - -diff --git a/build.xml b/build.xml -index b6992f7..6b77390 100644 +Description: Remove jaxen from build +Author: Varun Hiremath --- a/build.xml +++ b/build.xml -@@ -56,7 +56,6 @@ subject line. The XOM home page is http://www.xom.nu/ +@@ -68,7 +68,6 @@ @@ -18,7 +10,7 @@ -@@ -93,7 +92,6 @@ subject line. The XOM home page is http://www.xom.nu/ +@@ -107,7 +106,6 @@ @@ -26,7 +18,7 @@ -@@ -101,7 +99,6 @@ subject line. The XOM home page is http://www.xom.nu/ +@@ -115,7 +113,6 @@ @@ -34,8 +26,8 @@ -@@ -171,8 +168,6 @@ XOM Build file - +@@ -192,8 +189,6 @@ + - @@ -43,7 +35,7 @@ -@@ -193,7 +188,7 @@ XOM Build file +@@ -214,7 +209,7 @@ @@ -52,68 +44,29 @@ description="Compile the source code"> -- -- +- +- +- +- - -@@ -322,12 +313,6 @@ XOM Build file - - +@@ -368,12 +357,6 @@ + +

--
+-
- - -- +- - -
-@@ -699,39 +684,6 @@ location="${dist.dir}/xom-maven-${version}.jar" /> - - - -- -- -- -- -- -- -- -- -- -- - - - --- diff -Nru xom-1.2.1/debian/patches/0002-Remove-a-directory-during-cleaning.patch xom-1.2.10/debian/patches/0002-Remove-a-directory-during-cleaning.patch --- xom-1.2.1/debian/patches/0002-Remove-a-directory-during-cleaning.patch 2010-02-25 19:11:31.000000000 +0000 +++ xom-1.2.10/debian/patches/0002-Remove-a-directory-during-cleaning.patch 2013-07-25 11:22:51.000000000 +0000 @@ -1,16 +1,8 @@ -From: Varun Hiremath -Date: Thu, 25 Feb 2010 19:59:37 +0100 -Subject: [PATCH] Remove a directory during cleaning - ---- - build.xml | 1 + - 1 files changed, 1 insertions(+), 0 deletions(-) - -diff --git a/build.xml b/build.xml -index 6b77390..3a2c462 100644 +Description: Remove a directory during cleaning +Author: Varun Hiremath --- a/build.xml +++ b/build.xml -@@ -576,6 +576,7 @@ XOM Build file +@@ -695,6 +695,7 @@ @@ -18,4 +10,3 @@ --- diff -Nru xom-1.2.1/debian/patches/0003-Add-compile15-to-compile-core-depends.patch xom-1.2.10/debian/patches/0003-Add-compile15-to-compile-core-depends.patch --- xom-1.2.1/debian/patches/0003-Add-compile15-to-compile-core-depends.patch 2010-02-25 19:11:31.000000000 +0000 +++ xom-1.2.10/debian/patches/0003-Add-compile15-to-compile-core-depends.patch 2013-07-25 11:24:05.000000000 +0000 @@ -1,16 +1,8 @@ -From: Varun Hiremath -Date: Thu, 25 Feb 2010 19:59:37 +0100 -Subject: [PATCH] Add compile15 to compile-core depends - ---- - build.xml | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/build.xml b/build.xml -index 3a2c462..66ee3a7 100644 +Description: Add compile15 to compile-core depends +Author: Varun Hiremath --- a/build.xml +++ b/build.xml -@@ -188,7 +188,7 @@ XOM Build file +@@ -209,7 +209,7 @@ @@ -19,4 +11,3 @@ description="Compile the source code"> -Date: Thu, 25 Feb 2010 19:59:37 +0100 -Subject: [PATCH] Remove sun imports - ---- - src15/nu/xom/JDK15XML1_0Parser.java | 10 +++++----- - 1 files changed, 5 insertions(+), 5 deletions(-) - +Description: Remove sun imports +Author: Varun Hiremath diff --git a/src15/nu/xom/JDK15XML1_0Parser.java b/src15/nu/xom/JDK15XML1_0Parser.java index 389d5d7..9ba6056 100644 --- a/src15/nu/xom/JDK15XML1_0Parser.java diff -Nru xom-1.2.1/debian/patches/0005-Remove-external-links.patch xom-1.2.10/debian/patches/0005-Remove-external-links.patch --- xom-1.2.1/debian/patches/0005-Remove-external-links.patch 2010-02-25 19:11:31.000000000 +0000 +++ xom-1.2.10/debian/patches/0005-Remove-external-links.patch 2013-07-25 11:25:33.000000000 +0000 @@ -1,21 +1,12 @@ -From: Varun Hiremath -Date: Thu, 25 Feb 2010 19:59:37 +0100 -Subject: [PATCH] Remove external links - ---- - build.xml | 1 - - 1 files changed, 0 insertions(+), 1 deletions(-) - -diff --git a/build.xml b/build.xml -index 66ee3a7..8126f5e 100644 +Description: Remove external links +Author: Varun Hiremath --- a/build.xml +++ b/build.xml -@@ -378,7 +378,6 @@ XOM Build file +@@ -426,7 +426,6 @@ windowtitle="${Name} ${version} API" docencoding="UTF-8" charset="UTF-8" - link="http://www.junit.org/junit/javadoc/3.8.1" doctitle="${Name} ${version}" bottom="Copyright 2002-${year} <a href='http://www.elharo.com/'>Elliotte Rusty Harold</a> - <br /> <a href='mailto:elharo%40metalab%2Eunc%2Eedu?Subject=XOM'>elharo@metalab.unc.edu</a>"> --- + <br /> <a href='mailto:elharo%40ibiblio%2Eorg?Subject=XOM'>elharo@ibiblio.org</a>"> diff -Nru xom-1.2.1/debian/patches/0006-Compile-with-ant-runtime.patch xom-1.2.10/debian/patches/0006-Compile-with-ant-runtime.patch --- xom-1.2.1/debian/patches/0006-Compile-with-ant-runtime.patch 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/debian/patches/0006-Compile-with-ant-runtime.patch 2013-07-25 12:23:22.000000000 +0000 @@ -0,0 +1,14 @@ +Description: Include the Ant runtime when compiling +Author: Emmanuel Bourg +Forwarded: not-needed +--- a/build.xml ++++ b/build.xml +@@ -220,7 +220,7 @@ + source="1.3" + encoding="UTF-8" + fork="true" +- includeAntRuntime="false" ++ includeAntRuntime="true" + excludes="nu/xom/pantry/* nu/xom/tools/* nu/xom/samples/*Servlet.java"> + + diff -Nru xom-1.2.1/debian/patches/0007-Remove-jarjar.patch xom-1.2.10/debian/patches/0007-Remove-jarjar.patch --- xom-1.2.1/debian/patches/0007-Remove-jarjar.patch 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/debian/patches/0007-Remove-jarjar.patch 2013-07-25 12:28:52.000000000 +0000 @@ -0,0 +1,27 @@ +Description: Use the regular jar Atn yask instead of jarjar. jarjar is used + upstream to relocate the jaxen classes inside the xom jar, but we prefer + to keep it separate in Debian. +Author: Emmanuel Bourg +Forwarded: not-needed +--- a/build.xml ++++ b/build.xml +@@ -317,9 +317,7 @@ + + + +- +- +
+ +- ++ + + diff -Nru xom-1.2.1/debian/patches/series xom-1.2.10/debian/patches/series --- xom-1.2.1/debian/patches/series 2010-02-25 19:52:20.000000000 +0000 +++ xom-1.2.10/debian/patches/series 2013-07-25 12:23:54.000000000 +0000 @@ -1,5 +1,6 @@ 0001-Remove-jaxen-from-build.patch 0002-Remove-a-directory-during-cleaning.patch 0003-Add-compile15-to-compile-core-depends.patch -0004-Remove-sun-imports.patch 0005-Remove-external-links.patch +0006-Compile-with-ant-runtime.patch +0007-Remove-jarjar.patch diff -Nru xom-1.2.1/debian/poms/xom.pom xom-1.2.10/debian/poms/xom.pom --- xom-1.2.1/debian/poms/xom.pom 2011-04-25 12:11:03.000000000 +0000 +++ xom-1.2.10/debian/poms/xom.pom 2013-07-25 13:51:31.000000000 +0000 @@ -6,7 +6,7 @@ 4.0.0 jar XOM - 1.2.1 + 1.2.10 The XOM Dual Streaming/Tree API for Processing XML http://xom.nu diff -Nru xom-1.2.1/debian/rules xom-1.2.10/debian/rules --- xom-1.2.1/debian/rules 2011-04-25 12:11:03.000000000 +0000 +++ xom-1.2.10/debian/rules 2013-07-25 14:13:41.000000000 +0000 @@ -15,13 +15,13 @@ mh_clean install/libxom-java:: - cp build/xom-samples.jar build/xom-samples-$(DEB_UPSTREAM_VERSION).jar - dh_install -plibxom-java build/xom-samples-$(DEB_UPSTREAM_VERSION).jar /usr/share/java/ - dh_link -plibxom-java /usr/share/java/xom-samples-$(DEB_UPSTREAM_VERSION).jar /usr/share/java/xom-samples.jar mh_installpoms -plib$(PACKAGE)-java mh_installjar -plib$(PACKAGE)-java -l debian/poms/$(PACKAGE).pom build/$(PACKAGE)-$(DEB_UPSTREAM_VERSION).jar install/libxom-java-doc:: + cp build/xom-samples.jar build/xom-samples-$(DEB_UPSTREAM_VERSION).jar + dh_install -plibxom-java-doc build/xom-samples-$(DEB_UPSTREAM_VERSION).jar /usr/share/java/ + #dh_link -plibxom-java-doc /usr/share/java/xom-samples-$(DEB_UPSTREAM_VERSION).jar /usr/share/java/xom-samples.jar dh_installdocs -plibxom-java-doc build/apidocs get-orig-source: diff -Nru xom-1.2.1/project.xml xom-1.2.10/project.xml --- xom-1.2.1/project.xml 2009-02-21 14:44:03.000000000 +0000 +++ xom-1.2.10/project.xml 2011-02-06 12:45:15.000000000 +0000 @@ -25,7 +25,7 @@ Elliotte Rusty Harold elharo - elharo@metalab.unc.edu + elharo@ibiblio.org Cafe au Lait @@ -33,9 +33,9 @@ - xerces - xmlParserAPIs - 2.8.0 + xml-apis + xml-apis + 1.3.03 jar @@ -53,7 +53,7 @@ - elharo@metalab.unc.edu + elharo@ibiblio.org src src diff -Nru xom-1.2.1/project2.xml xom-1.2.10/project2.xml --- xom-1.2.1/project2.xml 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/project2.xml 2011-02-06 12:45:04.000000000 +0000 @@ -0,0 +1,70 @@ + + + 4.0.0 + jar + XOM + @VERSION@ + The XOM Dual Streaming/Tree API for Processing XML + http://xom.nu + + + The GNU Lesser General Public License, Version 2.1 + http://www.gnu.org/licenses/lgpl-2.1.html + repo + + + + https://xom.dev.java.net/source/browse/xom/ + + + xom + + xom + + 2002 + + + + XOM Interest Mailing List + http://lists.ibiblio.org/pipermail/xom-interest/ + + + + + + Elliotte Rusty Harold + elharo + elharo@ibiblio.org + Cafe au Lait + + + + + + xml-apis + xml-apis + 1.3.03 + jar + + + xerces + xercesImpl + 2.8.0 + jar + + + xalan + xalan + 2.7.0 + jar + + + + + src + + + \ No newline at end of file diff -Nru xom-1.2.1/src/nu/xom/Builder.java xom-1.2.10/src/nu/xom/Builder.java --- xom-1.2.1/src/nu/xom/Builder.java 2009-02-15 01:09:19.000000000 +0000 +++ xom-1.2.10/src/nu/xom/Builder.java 2013-04-24 10:50:52.000000000 +0000 @@ -1,4 +1,4 @@ -/* Copyright 2002-2006, 2009 Elliotte Rusty Harold +/* Copyright 2002-2006, 2009, 2010, 2013 Elliotte Rusty Harold This library is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public @@ -53,7 +53,7 @@ *

* * @author Elliotte Rusty Harold - * @version 1.2 + * @version 1.2.10 * */ public class Builder { @@ -184,7 +184,8 @@ "net.sf.saxon.aelfred.SAXDriver", "com.icl.saxon.aelfred.SAXDriver", "org.dom4j.io.aelfred2.SAXDriver", - "org.dom4j.io.aelfred.SAXDriver" + "org.dom4j.io.aelfred.SAXDriver", + "org.xmlpull.v1.sax2.Driver" // android }; @@ -261,6 +262,13 @@ private static void setupParser(XMLReader parser, boolean validate) throws SAXNotRecognizedException, SAXNotSupportedException { + // General configuration for all parsers + parser.setFeature( + "http://xml.org/sax/features/namespace-prefixes", true); + parser.setFeature( + "http://xml.org/sax/features/namespaces", true); + + // Parser specific configuration XMLReader baseParser = parser; while (baseParser instanceof XMLFilter) { XMLReader parent = ((XMLFilter) baseParser).getParent(); @@ -269,10 +277,6 @@ } String parserName = baseParser.getClass().getName(); - parser.setFeature( - "http://xml.org/sax/features/namespace-prefixes", true); - parser.setFeature( - "http://xml.org/sax/features/namespaces", true); if (!validate) { if (parserName.equals( // Crimson workaround "org.apache.crimson.parser.XMLReaderImpl")) { @@ -554,8 +558,7 @@ * that takes a java.io.File object as an argument. *

* - * @param systemID the URL (generally absolute) - * from which the document is read. + * @param systemID an absolute URL from which the document is read. * The URL's scheme must be one supported by the Java VM. * * @return the parsed Document @@ -609,7 +612,7 @@ *

* * @param in the input stream from which the document is read - * @param baseURI the base URI for this document + * @param baseURI an absolute URI for this document; may be null * * @return the parsed Document * @@ -622,9 +625,11 @@ public Document build(InputStream in, String baseURI) throws ParsingException, ValidityException, IOException { - baseURI = canonicalizeURL(baseURI); InputSource source = new InputSource(in); - source.setSystemId(baseURI); + if (baseURI != null) { + baseURI = canonicalizeURL(baseURI); + source.setSystemId(baseURI); + } return build(source); } @@ -1029,6 +1034,7 @@ public Document build(Reader in) throws ParsingException, ValidityException, IOException { + if (in == null) throw new NullPointerException("Attempted to build from null reader"); InputSource source = new InputSource(in); return build(source); @@ -1043,7 +1049,7 @@ * * @param in the reader from which the document * is read - * @param baseURI the base URI for this document + * @param baseURI the base URI for this document; may be null * * @return the parsed Document * @@ -1056,10 +1062,12 @@ */ public Document build(Reader in, String baseURI) throws ParsingException, ValidityException, IOException { - - baseURI = canonicalizeURL(baseURI); + InputSource source = new InputSource(in); - source.setSystemId(baseURI); + if (baseURI != null) { + baseURI = canonicalizeURL(baseURI); + source.setSystemId(baseURI); + } return build(source); } @@ -1070,9 +1078,8 @@ * Reads the document from the contents of a string. *

* - * @param document the string that contains - * the XML document. - * @param baseURI the base URI for this document + * @param document the string that contains the XML document + * @param baseURI the base URI for this document; may be null * * @return the parsed Document * @@ -1097,24 +1104,20 @@ // Also needed to work around a VM bug involving file URLs such as // file:///tmp/nosuchdirectory/../foo.xml // where "nosuchdirectory" does not exist. - // ???? should this move into the URIUtil class? private String canonicalizeURL(String uri) { try { URL u = new URL(uri); - String path = u.getFile(); + String path = u.getPath(); String scheme = u.getProtocol(); String authority = u.getHost(); String query = u.getQuery(); int port = u.getPort(); // fragment ID not needed - if (path == null || path.length() == 0 + if (path == null || path.length() == 0) { // We handle here the case where we have a URL such as // http://www.cafeaulait.org with no trailing slash. - // Java's URL class assigns the path "/" to this case - // but does not change the URL. - || ("/".equals(path) && !(uri.endsWith("/")))) { - path += '/'; + path = "/"; } // If this proves to be a hot spot we could probably take this path // only if the scheme is file; not in the more common case where @@ -1140,8 +1143,7 @@ * Reads the document from a SAX InputSource. *

* - * @param in the input source from - * which the document is read. + * @param in the input source from which the document is read * * @return the parsed Document * diff -Nru xom-1.2.1/src/nu/xom/Element.java xom-1.2.10/src/nu/xom/Element.java --- xom-1.2.1/src/nu/xom/Element.java 2009-02-12 03:09:55.000000000 +0000 +++ xom-1.2.10/src/nu/xom/Element.java 2013-05-13 22:48:48.000000000 +0000 @@ -1,4 +1,4 @@ -/* Copyright 2002-2006 Elliotte Rusty Harold +/* Copyright 2002-2006, 2011, 2013 Elliotte Rusty Harold This library is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public @@ -15,7 +15,7 @@ Boston, MA 02111-1307 USA You can contact Elliotte Rusty Harold by sending e-mail to - elharo@metalab.unc.edu. Please include the word "XOM" in the + elharo@ibiblio.org. Please include the word "XOM" in the subject line. The XOM home page is located at http://www.xom.nu/ */ @@ -26,8 +26,6 @@ import java.util.Iterator; import java.util.Map; import java.util.NoSuchElementException; -// ???? Why do I still need these imports? Could -// I get rid of them? import java.util.Set; import java.util.LinkedHashSet; @@ -48,7 +46,7 @@ * * * @author Elliotte Rusty Harold - * @version 1.2 + * @version 1.2.10 * */ public class Element extends ParentNode { @@ -1842,32 +1840,33 @@ } + private class AttributeIterator implements Iterator { + + private int next = 0; + + public boolean hasNext() { + return next < numAttributes; + } + + public Object next() throws NoSuchElementException { + + if (hasNext()) { + Attribute a = attributes[next]; + next++; + return a; + } + throw new NoSuchElementException("No such attribute"); + + } + + public void remove() { + throw new UnsupportedOperationException(); + } + } + Iterator attributeIterator() { - return new Iterator() { - - private int next = 0; - - public boolean hasNext() { - return next < numAttributes; - } - - public Object next() throws NoSuchElementException { - - if (hasNext()) { - Attribute a = attributes[next]; - next++; - return a; - } - throw new NoSuchElementException("No such attribute"); - - } - - public void remove() { - throw new UnsupportedOperationException(); - } - - }; + return new AttributeIterator(); } diff -Nru xom-1.2.1/src/nu/xom/Info.java xom-1.2.10/src/nu/xom/Info.java --- xom-1.2.1/src/nu/xom/Info.java 2009-03-04 13:30:27.000000000 +0000 +++ xom-1.2.10/src/nu/xom/Info.java 2011-02-06 12:45:07.000000000 +0000 @@ -21,6 +21,10 @@ package nu.xom; +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; + /** *

* A simple class used to make the JAR archive do something sensible @@ -28,15 +32,24 @@ *

* * @author Elliotte Rusty Harold - * @version 1.2.1 + * @version 1.2.4 * */ class Info { public static void main(String[] args) { - - System.out.println("This is XOM 1.2.1, a new XML Object Model."); + + String version = "1.2.4 or later"; + try { + InputStream stream = ClassLoader.getSystemResourceAsStream("nu/xom/version.txt"); + BufferedReader in = new BufferedReader(new InputStreamReader(stream, "UTF-8")); + version = in.readLine(); + } catch (Exception ex) { + version = "1.2.4b1 or later"; + } + + System.out.println("This is XOM " + version + ", a new XML Object Model."); System.out.println("Copyright 2002-2009 Elliotte Rusty Harold"); System.out.println("http://www.xom.nu/"); System.out.println(); diff -Nru xom-1.2.1/src/nu/xom/JaxenConnector.java xom-1.2.10/src/nu/xom/JaxenConnector.java --- xom-1.2.1/src/nu/xom/JaxenConnector.java 2005-12-02 15:11:01.000000000 +0000 +++ xom-1.2.10/src/nu/xom/JaxenConnector.java 2011-02-06 12:45:11.000000000 +0000 @@ -1,4 +1,4 @@ -/* Copyright 2005 Elliotte Rusty Harold +/* Copyright 2005, 2009 Elliotte Rusty Harold This library is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public @@ -34,7 +34,7 @@ /** * * @author Elliotte Rusty Harold - * @version 1.1.1b1 + * @version 1.2.4 * */ class JaxenConnector extends BaseXPath { @@ -72,8 +72,27 @@ } } } + else { + try { + Node node = (Node) next; + if (node.isDocumentFragment()) { + iterator.remove(); + // Want to allow // and //* and so forth + // but not / for rootless documents + if (result.isEmpty()) { + throw new XPathException("Tried to get document " + + "node of disconnected subtree"); + } + } + } + catch (ClassCastException ex) { + XPathTypeException qex = new XPathTypeException(result.get(0)); + throw qex; + } + } } return result; + } diff -Nru xom-1.2.1/src/nu/xom/Node.java xom-1.2.10/src/nu/xom/Node.java --- xom-1.2.1/src/nu/xom/Node.java 2005-09-11 13:42:54.000000000 +0000 +++ xom-1.2.10/src/nu/xom/Node.java 2011-02-06 12:45:11.000000000 +0000 @@ -430,30 +430,6 @@ } List queryResults = connector.selectNodes(this); - Iterator iterator = queryResults.iterator(); - while (iterator.hasNext()) { - Object o = iterator.next(); - try { - Node n = (Node) o; - if (n.isDocumentFragment()) { - iterator.remove(); - // Want to allow // and //* and so forth - // but not / for rootless documents - if (queryResults.isEmpty()) { - throw new XPathException("Tried to get document " - + "node of disconnected subtree"); - } - } - } - catch (ClassCastException ex) { - XPathTypeException qex = new XPathTypeException( - "XPath expression " + xpath + " did not return a node-set.", - queryResults.get(0)); - qex.setXPath(xpath); - throw qex; - } - } - return new Nodes(queryResults); } catch (XPathException ex) { diff -Nru xom-1.2.1/src/nu/xom/NonVerifyingHandler.java xom-1.2.10/src/nu/xom/NonVerifyingHandler.java --- xom-1.2.1/src/nu/xom/NonVerifyingHandler.java 2006-01-20 22:03:51.000000000 +0000 +++ xom-1.2.10/src/nu/xom/NonVerifyingHandler.java 2011-02-06 12:45:08.000000000 +0000 @@ -1,4 +1,4 @@ -/* Copyright 2002-2006 Elliotte Rusty Harold +/* Copyright 2002-2006, 2009 Elliotte Rusty Harold This library is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public @@ -15,7 +15,7 @@ Boston, MA 02111-1307 USA You can contact Elliotte Rusty Harold by sending e-mail to - elharo@metalab.unc.edu. Please include the word "XOM" in the + elharo@ibiblio.org. Please include the word "XOM" in the subject line. The XOM home page is located at http://www.xom.nu/ */ @@ -24,7 +24,7 @@ /** * @author Elliotte Rusty Harold - * @version 1.2d1 + * @version 1.2.3 * */ class NonVerifyingHandler extends XOMHandler { @@ -227,6 +227,17 @@ internalDTDSubset.append("\n"); } - } + } + + + public void endDTD() { + + inDTD = false; + if (doctype != null) { + doctype.fastSetInternalDTDSubset(internalDTDSubset.toString()); + } + + } + } \ No newline at end of file diff -Nru xom-1.2.1/src/nu/xom/ParentNode.java xom-1.2.10/src/nu/xom/ParentNode.java --- xom-1.2.1/src/nu/xom/ParentNode.java 2005-09-11 13:49:51.000000000 +0000 +++ xom-1.2.10/src/nu/xom/ParentNode.java 2011-02-06 12:45:08.000000000 +0000 @@ -40,7 +40,7 @@ * * * @author Elliotte Rusty Harold - * @version 1.1b4 + * @version 1.2.3 * */ public abstract class ParentNode extends Node { @@ -116,8 +116,12 @@ void fastInsertChild(Node child, int position) { - checkCapacity(this.childCount+1); + if (position > childCount) { + throw new IndexOutOfBoundsException("Inserted node at position " + position + " after children"); + } + checkCapacity(childCount+1); if (position < childCount) { + // make space in the middle for the new child; otherwise just add it at the end System.arraycopy(children, position, children, position+1, childCount-position); } children[position] = child; diff -Nru xom-1.2.1/src/nu/xom/Text.java xom-1.2.10/src/nu/xom/Text.java --- xom-1.2.1/src/nu/xom/Text.java 2005-09-04 11:01:20.000000000 +0000 +++ xom-1.2.10/src/nu/xom/Text.java 2011-02-06 12:45:05.000000000 +0000 @@ -1,4 +1,4 @@ -/* Copyright 2002-2005 Elliotte Rusty Harold +/* Copyright 2002-2005, 2010 Elliotte Rusty Harold This library is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public @@ -15,7 +15,7 @@ Boston, MA 02111-1307 USA You can contact Elliotte Rusty Harold by sending e-mail to - elharo@metalab.unc.edu. Please include the word "XOM" in the + elharo@ibiblio.org. Please include the word "XOM" in the subject line. The XOM home page is located at http://www.xom.nu/ */ @@ -30,9 +30,17 @@ * normal text. Text objects may be adjacent to other * Text objects. *

- + * + *

+ * The maximum size of a String or an array in Java limits the maximum + * size of a text node to about 2 gigabytes. If you're stuffing Base-64 + * encoded movies inside one node, you will have problems. Try breaking + * up the text into smaller, contiguous chunks. Even then you will + * probably not be able to use XPath on the result. + *

+ * * @author Elliotte Rusty Harold - * @version 1.1b3 + * @version 1.2.7 * */ public class Text extends Node { diff -Nru xom-1.2.1/src/nu/xom/URIUtil.java xom-1.2.10/src/nu/xom/URIUtil.java --- xom-1.2.1/src/nu/xom/URIUtil.java 2006-05-12 15:01:18.000000000 +0000 +++ xom-1.2.10/src/nu/xom/URIUtil.java 2011-02-06 12:45:11.000000000 +0000 @@ -1,4 +1,4 @@ -/* Copyright 2004-2006 Elliotte Rusty Harold +/* Copyright 2004-2006, 2009 Elliotte Rusty Harold This library is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public @@ -27,12 +27,12 @@ /** * These methods are not fully general. * You would need to uncomment some lines to make this a - * public API. Certain preconditons for these methods to + * public API. Certain preconditions for these methods to * operate correctly are true in the context of XOM, * but may well not be true in a more general context. * * @author Elliotte Rusty Harold - * @version 1.2d1 + * @version 1.2.3 * */ class URIUtil { diff -Nru xom-1.2.1/src/nu/xom/XML1_0Parser.java xom-1.2.10/src/nu/xom/XML1_0Parser.java --- xom-1.2.1/src/nu/xom/XML1_0Parser.java 2005-01-05 14:12:57.000000000 +0000 +++ xom-1.2.10/src/nu/xom/XML1_0Parser.java 2011-02-06 12:45:11.000000000 +0000 @@ -1,4 +1,4 @@ -/* Copyright 2004 Elliotte Rusty Harold +/* Copyright 2004, 2009 Elliotte Rusty Harold This library is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public @@ -30,10 +30,6 @@ * (org.apache.xerces.parsers.SAXParser) XOM verifies * everything. When using this subclass, XOM will rely on Xerces * to verify the rules, and skip its own verification checks. - * If you want to set custom SAX features and properties - * on the XMLReader before creating a - * Builder, you should use this class in preference - * to org.apache.xerces.parsers.SAXParser. *

* *

@@ -44,7 +40,7 @@ *

* * @author Elliotte Rusty Harold - * @version 1.0 + * @version 1.2.2b2 * */ class XML1_0Parser extends SAXParser { diff -Nru xom-1.2.1/src/nu/xom/XOMHandler.java xom-1.2.10/src/nu/xom/XOMHandler.java --- xom-1.2.1/src/nu/xom/XOMHandler.java 2007-09-27 08:59:01.000000000 +0000 +++ xom-1.2.10/src/nu/xom/XOMHandler.java 2011-02-06 12:45:06.000000000 +0000 @@ -1,4 +1,4 @@ -/* Copyright 2002-2006 Elliotte Rusty Harold +/* Copyright 2002-2006, 2009 Elliotte Rusty Harold This library is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public @@ -15,7 +15,7 @@ Boston, MA 02111-1307 USA You can contact Elliotte Rusty Harold by sending e-mail to - elharo@metalab.unc.edu. Please include the word "XOM" in the + elharo@ibiblio.org. Please include the word "XOM" in the subject line. The XOM home page is located at http://www.xom.nu/ */ @@ -32,7 +32,7 @@ /** * @author Elliotte Rusty Harold - * @version 1.2b1 + * @version 1.2.3 * */ class XOMHandler @@ -450,7 +450,7 @@ inDTD = false; if (doctype != null) { - doctype.fastSetInternalDTDSubset(internalDTDSubset.toString()); + doctype.setInternalDTDSubset(internalDTDSubset.toString()); } } @@ -524,6 +524,9 @@ } + // TODO(elharo) an untrusted parser could push in bad names and + // values in declaration in the internal DTD subset. + // Possibly declarations should be created in the factory too. public void elementDecl(String name, String model) { if (inInternalSubset() && doctype != null) { @@ -548,9 +551,12 @@ // It is not intended for use anywhere in the document. protected boolean inInternalSubset() { - if (!usingCrimson && !inExternalSubset) return true; + if (!usingCrimson) { + return !inExternalSubset; + } String currentURI = locator.getSystemId(); if (currentURI == this.documentBaseURI) return true; + if (currentURI == null) return false; if (currentURI.equals(this.documentBaseURI)) return true; return false; diff -Nru xom-1.2.1/src/nu/xom/XPathContext.java xom-1.2.10/src/nu/xom/XPathContext.java --- xom-1.2.1/src/nu/xom/XPathContext.java 2006-10-31 18:13:38.000000000 +0000 +++ xom-1.2.10/src/nu/xom/XPathContext.java 2012-05-05 15:58:52.000000000 +0000 @@ -1,4 +1,4 @@ -/* Copyright 2005, 2006 Elliotte Rusty Harold +/* Copyright 2005, 2006, 2012 Elliotte Rusty Harold This library is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public @@ -33,7 +33,7 @@ *

* * @author Elliotte Rusty Harold - * @version 1.2b2 + * @version 1.2.8 * */ public final class XPathContext { @@ -167,6 +167,7 @@ * this context or null */ public String lookup(String prefix) { + if ("".equals(prefix)) return null; return (String) namespaces.get(prefix); } diff -Nru xom-1.2.1/src/nu/xom/XPathTypeException.java xom-1.2.10/src/nu/xom/XPathTypeException.java --- xom-1.2.1/src/nu/xom/XPathTypeException.java 2005-09-25 14:58:18.000000000 +0000 +++ xom-1.2.10/src/nu/xom/XPathTypeException.java 2011-02-06 12:45:11.000000000 +0000 @@ -26,7 +26,7 @@ *

* * @author Elliotte Rusty Harold - * @version 1.1b4 + * @version 1.2.4 * */ public class XPathTypeException extends XPathException { @@ -36,15 +36,16 @@ private final Object returnValue; - XPathTypeException(String message, Object returnValue) { - super(message); + XPathTypeException(Object returnValue) { + // Irrelevant empty message because we override getMessage() below + super(""); this.returnValue = returnValue; } /** *

- * This method probably returns the actual object returned by the + * This method usually returns the actual object returned by the * query. However, XOM makes no guarantees about the type of this * object. *

@@ -55,5 +56,15 @@ return this.returnValue; } + public String getMessage() { + String xpath = getXPath(); + String type = returnValue.getClass().getName(); + if (xpath == null) { + return "XPath expression returned a " + type + " instead of a node-set."; + } else { + return "XPath expression " + xpath + " returned a " + type + " instead of a node-set."; + } + } + } diff -Nru xom-1.2.1/src/nu/xom/benchmarks/TreeWalker.java xom-1.2.10/src/nu/xom/benchmarks/TreeWalker.java --- xom-1.2.1/src/nu/xom/benchmarks/TreeWalker.java 2005-01-05 01:38:00.000000000 +0000 +++ xom-1.2.10/src/nu/xom/benchmarks/TreeWalker.java 2011-02-06 12:45:06.000000000 +0000 @@ -45,7 +45,7 @@ *

* * @author Elliotte Rusty Harold - * @version 1.0 + * @version 1.2.3 * */ class TreeWalker { @@ -104,7 +104,6 @@ System.out.println((postserialize - preserialize) + "ms to serialize the tree in UTF-8"); - out = new ByteArrayOutputStream(4000000); long preprettyserialize = System.currentTimeMillis(); prettyPrint(document, result); long postprettyserialize = System.currentTimeMillis(); diff -Nru xom-1.2.1/src/nu/xom/canonical/Canonicalizer.java xom-1.2.10/src/nu/xom/canonical/Canonicalizer.java --- xom-1.2.1/src/nu/xom/canonical/Canonicalizer.java 2009-01-17 14:18:04.000000000 +0000 +++ xom-1.2.10/src/nu/xom/canonical/Canonicalizer.java 2011-02-22 00:28:58.000000000 +0000 @@ -1,4 +1,4 @@ -/* Copyright 2002-2006, 2009 Elliotte Rusty Harold +/* Copyright 2002-2006, 2009, 2011 Elliotte Rusty Harold This library is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public @@ -15,7 +15,7 @@ Boston, MA 02111-1307 USA You can contact Elliotte Rusty Harold by sending e-mail to - elharo@metalab.unc.edu. Please include the word "XOM" in the + elharo@ibiblio.org. Please include the word "XOM" in the subject line. The XOM home page is located at http://www.xom.nu/ */ @@ -58,17 +58,18 @@ * href="http://www.w3.org/TR/2001/REC-xml-c14n-20010315">Canonical * XML Version 1.0 or Exclusive - * XML Canonicalization Version 1.0. + * XML Canonicalization Version 1.0. Canonical XML 1.1 support is in progress. *

* * @author Elliotte Rusty Harold - * @version 1.2b3 + * @version 1.2.7 * */ public class Canonicalizer { private boolean withComments; private boolean exclusive = false; + private boolean v11 = false; private CanonicalXMLSerializer serializer; private List inclusiveNamespacePrefixes = new ArrayList(); @@ -83,6 +84,10 @@ "http://www.w3.org/2001/10/xml-exc-c14n#"; public final static String EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS = "http://www.w3.org/2001/10/xml-exc-c14n#WithComments"; + public final static String CANONICAL_XML_11 = + "http://www.w3.org/2006/12/xml-c14n11"; + public final static String CANONICAL_XML_11_WITH_COMMENTS = + "http://www.w3.org/2006/12/xml-c14n11#WithComments"; private static class AttributeComparator implements Comparator { @@ -220,6 +225,16 @@ this.withComments = true; this.exclusive = true; } + else if (algorithm.equals(CANONICAL_XML_11)) { + this.withComments = false; + this.exclusive = false; + this.v11 = true; + } + else if (algorithm.equals(CANONICAL_XML_11_WITH_COMMENTS)) { + this.withComments = true; + this.exclusive = false; + this.v11 = true; + } else { throw new CanonicalizationException( "Unsupported canonicalization algorithm: " + algorithm); @@ -472,8 +487,8 @@ Attribute[] sorted = sortAttributes(element); for (int i = 0; i < sorted.length; i++) { if (nodes == null || nodes.contains(sorted[i]) - || (sorted[i].getNamespaceURI().equals(Namespace.XML_NAMESPACE) - && sorted[i].getParent() != element)) { + || (sorted[i].getNamespaceURI().equals(Namespace.XML_NAMESPACE) && sorted[i].getParent() != element) + ) { write(sorted[i]); } } @@ -608,7 +623,7 @@ Map nearest = new TreeMap(); // add in any inherited xml: attributes if (!exclusive && nodes != null && nodes.contains(element) - && ! nodes.contains(element.getParent())) { + && !nodes.contains(element.getParent())) { // grab all xml: attributes Nodes attributes = element.query("ancestor::*/@xml:*", xmlcontext); if (attributes.size() != 0) { @@ -622,14 +637,18 @@ if (element.getAttribute(name, Namespace.XML_NAMESPACE) != null) { // this element already has that attribute continue; + } else if (v11 && "id".equals(name)) { // Don't inherit xml:id in C14N 1.1 + continue; } if (! nearest.containsKey(name)) { - Element parent = (Element) a.getParent(); - if (! nodes.contains(parent)) { - nearest.put(name, a); - } - else { - nearest.put(name, null); + if (!v11 || "lang".equals(name) || "space".equals(name)) { + Element parent = (Element) a.getParent(); + if (! nodes.contains(parent)) { + nearest.put(name, a); + } + else { + nearest.put(name, null); + } } } } @@ -638,10 +657,29 @@ // remove null values Iterator iterator = nearest.values().iterator(); while (iterator.hasNext()) { - if (iterator.next() == null) iterator.remove(); + Attribute a = (Attribute) iterator.next(); + if (a == null) iterator.remove(); } + if (v11) { // fixup xml:base attributes + List bases = getOmittedBases(element); + Attribute baseAttribute = element.getAttribute("base", Namespace.XML_NAMESPACE); + String baseValue = ""; + if (baseAttribute != null) { + baseValue = baseAttribute.getValue(); + element.removeAttribute(baseAttribute); + } + if (!bases.isEmpty()) { + for (int i = 0; i < bases.size(); i++) { + baseValue = joinURIReferences((String) bases.get(i), baseValue); + } + } + if (baseValue != null && baseValue.length() > 0) { + nearest.put("base", new Attribute("xml:base", Namespace.XML_NAMESPACE, baseValue)); + } + } } + int localCount = element.getAttributeCount(); Attribute[] result @@ -660,8 +698,23 @@ return result; } - - + + + private List getOmittedBases(Element element) { + ArrayList bases = new ArrayList(); + // TODO(elharo): rework this to not need this next variable + ParentNode parent = element.getParent(); + while (parent != null && parent instanceof Element && !nodes.contains(parent)) { + Element parentElement = (Element) parent; + String base = parentElement.getAttributeValue("base", Namespace.XML_NAMESPACE); + if (base != null) bases.add(base); + parent = parentElement.getParent(); + } + + return bases; + } + + private String prepareAttributeValue(Attribute attribute) { String value = attribute.getValue(); @@ -1047,6 +1100,17 @@ } } + + private static String joinURIReferences(String parent, String child) { + if ("..".equals(parent)) parent = "../"; + if ("..".equals(child)) child = "../"; + + if (child == null) { + return parent; + } + //return parent + child; + return URIJoiner.absolutize(parent, child); + } private static void sort(List in, List namespaces, Nodes out, ParentNode parent) { diff -Nru xom-1.2.1/src/nu/xom/canonical/URIJoiner.java xom-1.2.10/src/nu/xom/canonical/URIJoiner.java --- xom-1.2.1/src/nu/xom/canonical/URIJoiner.java 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/src/nu/xom/canonical/URIJoiner.java 2011-02-22 00:37:50.000000000 +0000 @@ -0,0 +1,278 @@ +/* Copyright 2011 Elliotte Rusty Harold + + This library is free software; you can redistribute it and/or modify + it under the terms of version 2.1 of the GNU Lesser General Public + License as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA + + You can contact Elliotte Rusty Harold by sending e-mail to + elharo@ibiblio.org. Please include the word "XOM" in the + subject line. The XOM home page is located at http://www.xom.nu/ +*/ + +package nu.xom.canonical; + +import nu.xom.MalformedURIException; + + +/** + * This class implements the modified RFC 3986 algorithm for URI merging + * found in section 2.4 of the canonical XML 1.1 specification + * http://www.w3.org/TR/xml-c14n11/ + * + * @author Elliotte Rusty Harold + * @version 1.2.7 + * + */ +class URIJoiner { + + // This doesn't do enough error checking to be a public API. + static String absolutize(String baseURI, String spec) { + + if ("".equals(baseURI) || baseURI == null) return spec; + + ParsedURI base = new ParsedURI(baseURI); + + // This seems to be necessary to handle base URLs like + // http://www.example.com/test/data/.. + // but I don't think it's part of the 3986 algorithm. + // ???? It may be a bug in that algorithm. Check. + if (base.path.endsWith("/..")) base.path += '/'; + + // The variable names R and T violate Java naming conventions. + // They are taken from the pseudo-code in the RFC 3986 spec. + ParsedURI R = new ParsedURI(spec); + ParsedURI T = new ParsedURI(); + + if (R.scheme != null) { + T.scheme = R.scheme; + T.authority = R.authority; + T.query = R.query; + T.path = removeDotSegments(R.path); + } + else { + if (R.authority != null) { + T.authority = R.authority; + T.query = R.query; + T.path = removeDotSegments(R.path); + } + else { + if ("".equals(R.path)) { + T.path = base.path; + if (R.query != null) { + T.query = R.query; + } + else { + T.query = base.query; + } + } + else { + if (R.path.startsWith("/")) { + T.path = removeDotSegments(R.path); + } + else { + T.path = merge(base, R.path); + T.path = removeDotSegments(T.path); + } + T.query = R.query; + } + T.authority = base.authority; + } + T.scheme = base.scheme; + } + // Fragment ID of base URI is never considered + T.fragment = R.fragment; + + return T.toString(); + + } + + + static String merge(ParsedURI base, String relativePath) { + + if (base.authority != null && "".equals(base.path) + && !"".equals(base.authority)) { + return "/" + relativePath; + } + + int lastSlash = base.path.lastIndexOf('/'); + if (lastSlash == -1) return relativePath; + String topPath = base.path.substring(0, lastSlash+1); + return topPath + relativePath; + + } + + + static String removeDotSegments(String path) { + + StringBuffer output = new StringBuffer(); + + while (path.length() > 0) { + if (path.startsWith("/./")) { + path = '/' + path.substring(3); + } + else if (path.equals("/.")) { + path = "/"; + } + /* else if (path.startsWith("/../")) { + path = '/' + path.substring(4); + int lastSlash = output.toString().lastIndexOf('/'); + if (lastSlash != -1) output.setLength(lastSlash); + }*/ + else if (path.equals("/..")) { + path = "/"; + int lastSlash = output.toString().lastIndexOf('/'); + if (lastSlash != -1) output.setLength(lastSlash); + } + else if (path.equals(".") /*|| path.equals("..")*/) { + path = ""; + } + /*else if (path.startsWith("../")) { + path = path.substring(3); + }*/ + else if (path.startsWith("./")) { + path = path.substring(2); + } + else { + int nextSlash = path.indexOf('/'); + if (nextSlash == 0) nextSlash = path.indexOf('/', 1); + if (nextSlash == -1) { + output.append(path); + path = ""; + } + else { + output.append(path.substring(0, nextSlash)); + path = path.substring(nextSlash); + } + } + } + + return output.toString(); + + } + + + // really just a struct + static class ParsedURI { + + String scheme; + String schemeSpecificPart; + String query; + String fragment; + String authority; + String path = ""; + + ParsedURI(String spec) { + + int colon = spec.indexOf(':'); + int question; + + // URIs can only contain one sharp sign + int sharp = spec.lastIndexOf('#'); + + // Fragment IDs can contain question marks so we only read + // the question mark before the fragment ID, if any + if (sharp == -1) question = spec.indexOf('?'); + else question = spec.substring(0, sharp).indexOf('?'); + + if (colon != -1) scheme = spec.substring(0, colon); + + if (question == -1 && sharp == -1) { + schemeSpecificPart = spec.substring(colon+1); + } + else if (question != -1) { + if (question < colon) { + MalformedURIException ex + = new MalformedURIException("Unparseable URI"); + ex.setData(spec); + throw ex; + } + schemeSpecificPart = spec.substring(colon+1, question); + } + else { + if (sharp < colon) { + MalformedURIException ex + = new MalformedURIException("Unparseable URI"); + ex.setData(spec); + throw ex; + } + schemeSpecificPart = spec.substring(colon+1, sharp); + } + + if (sharp != -1) { + fragment = spec.substring(sharp+1); + } + + if (question != -1) { + if (sharp == -1) { + query = spec.substring(question+1); + } + else { + query = spec.substring(question+1, sharp); + } + } + + if (schemeSpecificPart.startsWith("//")) { + int authorityBegin = 2; + int authorityEnd = schemeSpecificPart.indexOf('/', authorityBegin); + if (authorityEnd == -1) { + authority = schemeSpecificPart.substring(2); + path = ""; + } + else { + authority = schemeSpecificPart.substring(authorityBegin, authorityEnd); + path = schemeSpecificPart.substring(authorityEnd); + } + } + else { + path = schemeSpecificPart; + } + + } + + ParsedURI() {} + + public String toString() { + + StringBuffer result = new StringBuffer(30); + + if (scheme != null) { + result.append(scheme); + result.append(':'); + } + + if (schemeSpecificPart != null) { + result.append(schemeSpecificPart); + } + else { + if (scheme != null) result.append("//"); + if (authority != null) result.append(authority); + result.append(path); + } + + if (query != null) { + result.append('?'); + result.append(query); + } + + if (fragment != null) { + result.append('#'); + result.append(fragment); + } + + return result.toString(); + + } + + } + +} diff -Nru xom-1.2.1/src/nu/xom/package.html xom-1.2.10/src/nu/xom/package.html --- xom-1.2.1/src/nu/xom/package.html 2005-02-15 15:49:23.000000000 +0000 +++ xom-1.2.10/src/nu/xom/package.html 2011-02-06 12:45:07.000000000 +0000 @@ -5,7 +5,7 @@ @(#)package.html - Copyright © 2002-2005 Elliotte Rusty Harold + Copyright © 2002-2005, 2009 Elliotte Rusty Harold This library is free software; you can redistribute it and/or modify it under the terms of version 2.1 of @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA You can contact Elliotte Rusty Harold by sending e-mail to - elharo@metalab.unc.edu. Please include the word "XOM" in the + elharo@ibiblio.org. Please include the word "XOM" in the subject line. The XOM home page is http://www.xom.nu/ --> diff -Nru xom-1.2.1/src/nu/xom/tests/AttributeTest.java xom-1.2.10/src/nu/xom/tests/AttributeTest.java --- xom-1.2.1/src/nu/xom/tests/AttributeTest.java 2006-12-31 13:08:38.000000000 +0000 +++ xom-1.2.10/src/nu/xom/tests/AttributeTest.java 2011-02-06 14:33:28.000000000 +0000 @@ -1,4 +1,4 @@ -/* Copyright 2002-2006 Elliotte Rusty Harold +/* Copyright 2002-2006, 2011 Elliotte Rusty Harold This library is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public @@ -15,7 +15,7 @@ Boston, MA 02111-1307 USA You can contact Elliotte Rusty Harold by sending e-mail to - elharo@metalab.unc.edu. Please include the word "XOM" in the + elharo@ibiblio.org. Please include the word "XOM" in the subject line. The XOM home page is located at http://www.xom.nu/ */ @@ -40,7 +40,7 @@ *

* * @author Elliotte Rusty Harold - * @version 1.2b2 + * @version 1.2.7 * */ public class AttributeTest extends XOMTestCase { @@ -718,7 +718,7 @@ f = new File(f, "xtest.xml"); Document input = builder.build(f); String s = input.toXML(); - Document output = builder.build(s, f.toURL().toExternalForm()); + Document output = builder.build(s, f.toURI().toASCIIString()); assertEquals(input, output); } diff -Nru xom-1.2.1/src/nu/xom/tests/BuilderTest.java xom-1.2.10/src/nu/xom/tests/BuilderTest.java --- xom-1.2.1/src/nu/xom/tests/BuilderTest.java 2007-06-03 14:04:26.000000000 +0000 +++ xom-1.2.10/src/nu/xom/tests/BuilderTest.java 2011-02-06 14:33:06.000000000 +0000 @@ -1,4 +1,4 @@ -/* Copyright 2002-2007 Elliotte Rusty Harold +/* Copyright 2002-2007, 2009, 2010, 2011 Elliotte Rusty Harold This library is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public @@ -15,7 +15,7 @@ Boston, MA 02111-1307 USA You can contact Elliotte Rusty Harold by sending e-mail to - elharo@metalab.unc.edu. Please include the word "XOM" in the + elharo@ibiblio.org. Please include the word "XOM" in the subject line. The XOM home page is located at http://www.xom.nu/ */ @@ -35,10 +35,12 @@ import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.UTFDataFormatException; +import java.io.UnsupportedEncodingException; import java.io.Writer; import java.lang.ref.WeakReference; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; +import java.net.URLEncoder; import org.apache.xerces.parsers.SAXParser; import org.xml.sax.Attributes; @@ -50,6 +52,7 @@ import org.xml.sax.SAXParseException; import org.xml.sax.XMLFilter; import org.xml.sax.XMLReader; +import org.xml.sax.ext.DeclHandler; import org.xml.sax.helpers.AttributesImpl; import org.xml.sax.helpers.LocatorImpl; import org.xml.sax.helpers.XMLFilterImpl; @@ -78,12 +81,11 @@ *

* * @author Elliotte Rusty Harold - * @version 1.2b2 + * @version 1.2.7 * */ public class BuilderTest extends XOMTestCase { - private File inputDir = new File("data"); // This class tests error conditions, which Xerces @@ -274,7 +276,7 @@ assertNotNull(doc.getRootElement()); } - + public void testStartOnlyParser() throws ParsingException, IOException { @@ -490,17 +492,32 @@ } + public void testBuildFromNullReader() + throws IOException, ParsingException { + + Reader reader = null; + try { + builder.build(reader); + fail("Built from null reader"); + } + catch (NullPointerException ex) { + assertEquals("Attempted to build from null reader", ex.getMessage()); + } + + } + + public void testBuildFromReader() throws IOException, ParsingException { - + Reader reader = new StringReader(source); Document document = builder.build(reader); verify(document); assertEquals("", document.getBaseURI()); - + } - - + + public void testBuildFromReaderWithBase() throws IOException, ParsingException { @@ -643,7 +660,7 @@ fail("Built from null input stream"); } catch (NullPointerException success) { - assertNotNull(success.getMessage()); + assertEquals("Null InputStream", success.getMessage()); } } @@ -1470,6 +1487,13 @@ } + public void testCanonicalizeURLWithQueryString() + throws IOException, ParsingException { + Document doc = builder.build("http://www.cafeconleche.org/?foo=bar"); + assertEquals("http://www.cafeconleche.org/?foo=bar", doc.getBaseURI()); + } + + public void testExternalEntityResolution() throws IOException, ParsingException { @@ -1486,8 +1510,8 @@ public void testExternalEntityRelativeURLResolution() throws IOException, ParsingException { - String url = "file://" + inputDir.getAbsolutePath(); - String docURL = url + "/base/../sib/content/pe.xml"; + String url = "file://" + escapePath(inputDir.getAbsolutePath()); + String docURL = url + "base/../sib/content/pe.xml"; Builder builder = new Builder(false); Document doc = builder.build(docURL); String subset = doc.getDocType().getInternalDTDSubset(); @@ -1496,11 +1520,24 @@ } + private String escapePath(String path) throws UnsupportedEncodingException { + String[] fragments = path.split("/"); + StringBuffer result = new StringBuffer(); + for (int i = 0; i < fragments.length; i++) { + String encoded = URLEncoder.encode(fragments[i], "UTF-8"); + encoded = encoded.replace("+", "%20"); + result.append(encoded); + result.append("/"); + } + return result.toString(); + } + + public void testExternalEntityRelativeURLResolution2() throws IOException, ParsingException { - String url = "file://" + inputDir.getAbsolutePath(); - String docURL = url + "/base/../sib/content/ep.xml"; + String url = "file://" + escapePath(inputDir.getAbsolutePath()); + String docURL = url + "base/../sib/content/ep.xml"; Builder builder = new Builder(false); Document doc = builder.build(docURL); String subset = doc.getDocType().getInternalDTDSubset(); @@ -1512,8 +1549,8 @@ public void testBuildFromURLThatContainsNonexistentPart() throws IOException, ParsingException { - String url = "file://" + inputDir.getAbsolutePath(); - String docURL = url + "/nonexistent/../test.xml"; + String url = "file://" + escapePath(inputDir.getAbsolutePath()); + String docURL = url + "nonexistent/../test.xml"; Builder builder = new Builder(false); Document doc = builder.build(docURL); assertNotNull(doc); @@ -1524,8 +1561,8 @@ public void testBuildFromURLThatContainsNonexistentPart2() throws IOException, ParsingException { - String url = "file://" + inputDir.getAbsolutePath(); - String docURL = url + "/nonexistent/../sib/content/pe.xml"; + String url = "file://" + escapePath(inputDir.getAbsolutePath()); + String docURL = url + "nonexistent/../sib/content/pe.xml"; Builder builder = new Builder(false); Document doc = builder.build(docURL); assertNotNull(doc); @@ -1536,8 +1573,8 @@ public void testExternalEntityRelativeURLResolutionIncludingNonexistentDirectoryInBaseURL() throws IOException, ParsingException { - String url = "file://" + inputDir.getAbsolutePath(); - String docURL = url + "/nonexistent/../sib/content/pe.xml"; + String url = "file://" + escapePath(inputDir.getAbsolutePath()); + String docURL = url + "nonexistent/../sib/content/pe.xml"; Builder builder = new Builder(false); Document doc = builder.build(docURL); String subset = doc.getDocType().getInternalDTDSubset(); @@ -1549,8 +1586,8 @@ public void testExternalEntityRelativeURLResolution3() throws IOException, ParsingException { - String url = "file://" + inputDir.getAbsolutePath(); - String docURL = url + "/sib/content/ep.xml"; + String url = "file://" + escapePath(inputDir.getAbsolutePath()); + String docURL = url + "sib/content/ep.xml"; Builder builder = new Builder(false); Document doc = builder.build(docURL); String subset = doc.getDocType().getInternalDTDSubset(); @@ -3411,17 +3448,82 @@ Builder builder = new Builder(reader); InputStream in = new FileInputStream("data/quirks.xhtml"); try { - builder.build(in); - fail("How did it find the DTD"); + builder.build(in); + fail("How did it find the DTD"); } catch (IOException success) { - assertNotNull(success.getMessage()); - // Here we expect that because there's no Locator - // there's no base URRL. As a result, the DTD is looked fo rin the - // current working directory, which is the wrong place. - // Therefore this IOException is thrown. + assertNotNull(success.getMessage()); + // Here we expect that because there's no Locator + // there's no base URL. As a result, the DTD is looked for in the + // current working directory, which is the wrong place. + // Therefore this IOException is thrown. } } + public void testChemistry() throws ValidityException, ParsingException, IOException { + String doc = ""; + StringReader s = new StringReader(doc); + builder.build(s); + } + + public void testMisbehavingParserInternalDTDSubset() throws IOException { + XMLReader reader = new SAXParser(); + reader = new MalformedDTDFilter(reader); + Builder builder = new Builder(reader); + try { + builder.build(validDoc, "http://www.example.com"); + fail("didn't catch malformed internal DTD subset"); + } + catch (ParsingException ex) { + assertNotNull(ex.getMessage()); + } + } + + private static class MalformedDTDFilter extends XMLFilterImpl implements + XMLReader { + + public MalformedDTDFilter(XMLReader reader) { + super.setParent(reader); + } + + public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { + if (name.equals("http://xml.org/sax/properties/declaration-handler")) { + value = new BadDeclHandler((DeclHandler) value); + } + super.setProperty(name, value); + } + + } + + private static class BadDeclHandler implements DeclHandler { + + private DeclHandler handler; + + public BadDeclHandler(DeclHandler handler) { + this.handler = handler; + } + + public void attributeDecl(String arg0, String arg1, String arg2, + String arg3, String arg4) throws SAXException { + handler.attributeDecl(arg0, arg1, arg2, arg3, arg4); + } + + // pass some malformed data here + public void elementDecl(String name, String model) throws SAXException { + handler.elementDecl("***()*" + name, model); + } + + public void externalEntityDecl(String arg0, String arg1, String arg2) + throws SAXException { + handler.externalEntityDecl(arg0, arg1, arg2); + } + + public void internalEntityDecl(String arg0, String arg1) + throws SAXException { + handler.internalEntityDecl(arg0, arg1); + } + + } + } diff -Nru xom-1.2.1/src/nu/xom/tests/Canonicalizer11Test.java xom-1.2.10/src/nu/xom/tests/Canonicalizer11Test.java --- xom-1.2.1/src/nu/xom/tests/Canonicalizer11Test.java 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/src/nu/xom/tests/Canonicalizer11Test.java 2011-02-22 00:46:25.000000000 +0000 @@ -0,0 +1,425 @@ +/* Copyright 2011 Elliotte Rusty Harold + + This library is free software; you can redistribute it and/or modify + it under the terms of version 2.1 of the GNU Lesser General Public + License as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA + + You can contact Elliotte Rusty Harold by sending e-mail to + elharo@ibiblio.org. Please include the word "XOM" in the + subject line. The XOM home page is located at http://www.xom.nu/ +*/ + +package nu.xom.tests; + +import java.io.ByteArrayOutputStream; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; + +import junit.framework.AssertionFailedError; +import junit.framework.TestCase; +import nu.xom.Builder; +import nu.xom.Document; +import nu.xom.ParsingException; +import nu.xom.XPathContext; +import nu.xom.canonical.Canonicalizer; + +/** + *

+ * Tests XML Canonicalization 1.1. + *

+ * + * @author Elliotte Rusty Harold + * @version 1.2.7 + * + */ +public class Canonicalizer11Test extends TestCase { + + + private File canonical; + private ByteArrayOutputStream out = new ByteArrayOutputStream(); + private Canonicalizer canonicalizer = new Canonicalizer(out, Canonicalizer.CANONICAL_XML_11); + private Document xmlSpaceInput; + private Document xmlBaseInput; + private XPathContext namespaces = new XPathContext(); + private Builder builder = new Builder(); + + + protected void setUp() throws ParsingException, IOException { + File data = new File("data"); + canonical = new File(data, "c14n11"); + File xmlSpaceFile = new File(canonical, "xmlspace-input.xml"); + xmlSpaceInput = builder.build(xmlSpaceFile); + File xmlBaseFile = new File(canonical, "xmlbase-prop-input.xml"); + xmlBaseInput = builder.build(xmlBaseFile); + namespaces.addNamespace("ietf", "http://www.ietf.org"); + } + + + // 3.2.1.1 Test case c14n11/xmllang-1 + public void testXMLLang_1() throws ParsingException, IOException { + File input = new File(canonical, "xmllang-input.xml"); + File expected = new File(canonical, "xmllang-1.output"); + + Document doc = builder.build(input); + String documentSubsetExpression = "(//. | //@* | //namespace::*)[ancestor-or-self::ietf:e1]"; + canonicalizer.write(doc.query(documentSubsetExpression, namespaces)); + + byte[] actualBytes = out.toByteArray(); + byte[] expectedBytes = readFile(expected); + assertEquals(expectedBytes, actualBytes); + } + + + // 3.2.1.2 Test case c14n11/xmllang-2 + public void testXMLLang_2() throws ParsingException, IOException { + File input = new File(canonical, "xmllang-input.xml"); + File expected = new File(canonical, "xmllang-2.output"); + + Document doc = builder.build(input); + String documentSubsetExpression = "(//. | //@* | //namespace::*)[ancestor-or-self::ietf:e2]"; + canonicalizer.write(doc.query(documentSubsetExpression, namespaces)); + + byte[] actualBytes = out.toByteArray(); + byte[] expectedBytes = readFile(expected); + assertEquals(expectedBytes, actualBytes); + } + + + // 3.2.1.3 Test case c14n11/xmllang-3 + public void testXMLLang_3() throws ParsingException, IOException { + File input = new File(canonical, "xmllang-input.xml"); + File expected = new File(canonical, "xmllang-3.output"); + + Document doc = builder.build(input); + String documentSubsetExpression = "(//. | //@* | //namespace::*)[ancestor-or-self::ietf:e11]"; + canonicalizer.write(doc.query(documentSubsetExpression, namespaces)); + + byte[] actualBytes = out.toByteArray(); + byte[] expectedBytes = readFile(expected); + assertEquals(expectedBytes, actualBytes); + } + + + // 3.2.1.4 Test case c14n11/xmllang-4 + public void testXMLLang_4() throws ParsingException, IOException { + File input = new File(canonical, "xmllang-input.xml"); + File expected = new File(canonical, "xmllang-4.output"); + + Document doc = builder.build(input); + String documentSubsetExpression = "(//. | //@* | //namespace::*)[ancestor-or-self::ietf:e11 or ancestor-or-self::ietf:e12]"; + canonicalizer.write(doc.query(documentSubsetExpression, namespaces)); + + byte[] actualBytes = out.toByteArray(); + byte[] expectedBytes = readFile(expected); + assertEquals(expectedBytes, actualBytes); + } + + + // 3.2.2.1 Test case c14n11/xmlspace-1 + public void testXMLSpace_1() throws ParsingException, IOException { + File expected = new File(canonical, "xmlspace-1.output"); + + String documentSubsetExpression = "(//. | //@* | //namespace::*) [ancestor-or-self::ietf:e1]"; + canonicalizer.write(xmlSpaceInput.query(documentSubsetExpression, namespaces)); + + byte[] actualBytes = out.toByteArray(); + byte[] expectedBytes = readFile(expected); + assertEquals(expectedBytes, actualBytes); + } + + + // 3.2.2.2 Test case c14n11/xmlspace-2 + public void testXMLSpace_2() throws ParsingException, IOException { + File expected = new File(canonical, "xmlspace-2.output"); + + String documentSubsetExpression = "(//. | //@* | //namespace::*) [ancestor-or-self::ietf:e2]"; + canonicalizer.write(xmlSpaceInput.query(documentSubsetExpression, namespaces)); + + byte[] actualBytes = out.toByteArray(); + byte[] expectedBytes = readFile(expected); + assertEquals(expectedBytes, actualBytes); + } + + + // 3.2.2.3 Test case c14n11/xmlspace-3 + public void testXMLSpace_3() throws ParsingException, IOException { + File expected = new File(canonical, "xmlspace-3.output"); + + String documentSubsetExpression = "(//. | //@* | //namespace::*) [ancestor-or-self::ietf:e11]"; + canonicalizer.write(xmlSpaceInput.query(documentSubsetExpression, namespaces)); + + byte[] actualBytes = out.toByteArray(); + byte[] expectedBytes = readFile(expected); + assertEquals(expectedBytes, actualBytes); + } + + + // 3.2.2.4 Test case c14n11/xmlspace-4 + public void testXMLSpace_4() throws ParsingException, IOException { + File expected = new File(canonical, "xmlspace-4.output"); + + String documentSubsetExpression = "(//. | //@* | //namespace::*) [ancestor-or-self::ietf:e11 or ancestor-or-self::ietf:e12]"; + canonicalizer.write(xmlSpaceInput.query(documentSubsetExpression, namespaces)); + + byte[] actualBytes = out.toByteArray(); + byte[] expectedBytes = readFile(expected); + assertEquals(expectedBytes, actualBytes); + } + + + // 3.2.3.1 Test case c14n11/xmlid-1 + public void testXMLID_1() throws ParsingException, IOException { + File expected = new File(canonical, "xmlid-1.output"); + File input = new File(canonical, "xmlid-input.xml"); + Document xmlIdInput = builder.build(input); + + String documentSubsetExpression = "(//. | //@* | //namespace::*) [ancestor-or-self::ietf:e1]"; + canonicalizer.write(xmlIdInput.query(documentSubsetExpression, namespaces)); + + byte[] actualBytes = out.toByteArray(); + byte[] expectedBytes = readFile(expected); + assertEquals(expectedBytes, actualBytes); + } + + + // 3.2.3.2 Test case c14n11/xmlid-2 + public void testXMLID_2() throws ParsingException, IOException { + File expected = new File(canonical, "xmlid-2.output"); + File input = new File(canonical, "xmlid-input.xml"); + Document xmlIdInput = builder.build(input); + + String documentSubsetExpression = "(//. | //@* | //namespace::*) [ancestor-or-self::ietf:e11 or ancestor-or-self::ietf:e12]"; + canonicalizer.write(xmlIdInput.query(documentSubsetExpression, namespaces)); + + byte[] actualBytes = out.toByteArray(); + byte[] expectedBytes = readFile(expected); + assertEquals(expectedBytes, actualBytes); + } + + + public void testNewXMLAttributesAreNotInherited() throws ParsingException, IOException { + String input = "" + + ""; + Document doc = builder.build(input, "http://www.w3.org/TR/2008/PR-xml-c14n11-20080129/"); + + String documentSubsetExpression = "(//. | //@* | //namespace::*)[ancestor-or-self::bar]"; + canonicalizer.write(doc.query(documentSubsetExpression)); + + String actual = new String(out.toByteArray(), "UTF-8"); + assertEquals("", actual); + } + + + // 3.2.4.1.1 Test case c14n11/xmlbase-prop-1 + public void testXMLBase_Prop_1() throws ParsingException, IOException { + File expected = new File(canonical, "xmlbase-prop-1.output"); + + String documentSubsetExpression + = "(//. | //@* | //namespace::*) [ancestor-or-self::ietf:c14n11XmlBaseDoc1 and not(ancestor-or-self::ietf:e2)]"; + canonicalizer.write(xmlBaseInput.query(documentSubsetExpression, namespaces)); + + byte[] actualBytes = out.toByteArray(); + byte[] expectedBytes = readFile(expected); + assertEquals(expectedBytes, actualBytes); + } + + + // 3.2.4.1.2 Test case c14n11/xmlbase-prop-2 + public void testXMLBase_Prop_2() throws ParsingException, IOException { + File expected = new File(canonical, "xmlbase-prop-2.output"); + + String documentSubsetExpression + = "(//. | //@* | //namespace::*) [ancestor-or-self::ietf:e1]"; + canonicalizer.write(xmlBaseInput.query(documentSubsetExpression, namespaces)); + + byte[] actualBytes = out.toByteArray(); + byte[] expectedBytes = readFile(expected); + assertEquals(expectedBytes, actualBytes); + } + + + // 3.2.4.1.3 Test case c14n11/xmlbase-prop-3 + public void testXMLBase_Prop_3() throws ParsingException, IOException { + File expected = new File(canonical, "xmlbase-prop-3.output"); + + String documentSubsetExpression + = "(//. | //@* | //namespace::*) [ancestor-or-self::ietf:e11]"; + canonicalizer.write(xmlBaseInput.query(documentSubsetExpression, namespaces)); + + byte[] actualBytes = out.toByteArray(); + byte[] expectedBytes = readFile(expected); + assertEquals(expectedBytes, actualBytes); + } + + + // 3.2.4.1.4 Test case c14n11/xmlbase-prop-4 + public void testXMLBase_Prop_4() throws ParsingException, IOException { + File expected = new File(canonical, "xmlbase-prop-4.output"); + + String documentSubsetExpression + = "(//. | //@* | //namespace::*) [ancestor-or-self::ietf:e111]"; + canonicalizer.write(xmlBaseInput.query(documentSubsetExpression, namespaces)); + + byte[] actualBytes = out.toByteArray(); + byte[] expectedBytes = readFile(expected); + assertEquals(expectedBytes, actualBytes); + } + + + // 3.2.4.1.5 Test case c14n11/xmlbase-prop-5 + public void testXMLBase_Prop_5() throws ParsingException, IOException { + File expected = new File(canonical, "xmlbase-prop-5.output"); + + String documentSubsetExpression + = "(//. | //@* | //namespace::*) [ancestor-or-self::ietf:e21]"; + canonicalizer.write(xmlBaseInput.query(documentSubsetExpression, namespaces)); + + byte[] actualBytes = out.toByteArray(); + byte[] expectedBytes = readFile(expected); + assertEquals(expectedBytes, actualBytes); + } + + + // 3.2.4.1.6 Test case c14n11/xmlbase-prop-6 + public void testXMLBase_Prop_6() throws ParsingException, IOException { + File expected = new File(canonical, "xmlbase-prop-6.output"); + + String documentSubsetExpression + = "(//. | //@* | //namespace::*) [ancestor-or-self::ietf:e3]"; + canonicalizer.write(xmlBaseInput.query(documentSubsetExpression, namespaces)); + + byte[] actualBytes = out.toByteArray(); + byte[] expectedBytes = readFile(expected); + assertEquals(expectedBytes, actualBytes); + } + + + // 3.2.4.1.7 Test case c14n11/xmlbase-prop-7 + public void testXMLBase_Prop_7() throws ParsingException, IOException { + File expected = new File(canonical, "xmlbase-prop-7.output"); + + String documentSubsetExpression + = "(//. | //@* | //namespace::*) [ancestor-or-self::ietf:c14n11XmlBaseDoc1 and not(ancestor-or-self::ietf:e1 or ancestor-or-self::ietf:e2)]"; + canonicalizer.write(xmlBaseInput.query(documentSubsetExpression, namespaces)); + + byte[] actualBytes = out.toByteArray(); + byte[] expectedBytes = readFile(expected); + assertEquals(expectedBytes, actualBytes); + } + + // 3.2.4.2.1 Test case c14n11/xmlbase-c14n11spec-102 + public void testXMLBase_1() throws ParsingException, IOException { + File expected = new File(canonical, "xmlbase-c14n11spec-102.output"); + File xmlBaseFile = new File(canonical, "xmlbase-c14n11spec-input.xml"); + Document doc = builder.build(xmlBaseFile); + + String documentSubsetExpression + = "(//. | //@* | //namespace::*)[self::ietf:e1 or (parent::ietf:e1 and not(self::text() or self::e2)) or count(id(\"E3\")|ancestor-or-self::node()) = count(ancestor-or-self::node())]"; + canonicalizer.write(doc.query(documentSubsetExpression, namespaces)); + + byte[] actualBytes = out.toByteArray(); + byte[] expectedBytes = readFile(expected); + assertEquals(expectedBytes, actualBytes); + } + + + // 3.2.4.2.2 Test case c14n11/xmlbase-c14n11spec2-102 + public void testXMLBase_2() throws ParsingException, IOException { + File input = new File(canonical, "xmlbase-c14n11spec2-input.xml"); + Document doc = builder.build(input); + File expected = new File(canonical, "xmlbase-c14n11spec2-102.output"); + + String documentSubsetExpression + = "(//. | //@* | //namespace::*)[self::ietf:e1 or (parent::ietf:e1 and not(self::text() or self::e2)) or count(id(\"E3\")|ancestor-or-self::node()) = count(ancestor-or-self::node())]"; + canonicalizer.write(doc.query(documentSubsetExpression, namespaces)); + + byte[] actualBytes = out.toByteArray(); + byte[] expectedBytes = readFile(expected); + assertEquals(expectedBytes, actualBytes); + } + + + // 3.2.4.2.3 Test case c14n11/xmlbase-c14n11spec3-103 + public void testXMLBase_3() throws ParsingException, IOException { + File input = new File(canonical, "xmlbase-c14n11spec3-input.xml"); + Document doc = builder.build(input); + File expected = new File(canonical, "xmlbase-c14n11spec3-103.output"); + + String documentSubsetExpression = "(//. | //@* | //namespace::*) [self::a or ancestor-or-self::d]"; + canonicalizer.write(doc.query(documentSubsetExpression, namespaces)); + + byte[] actualBytes = out.toByteArray(); + byte[] expectedBytes = readFile(expected); + assertEquals(expectedBytes, actualBytes); + } + + + private byte[] readFile(File expected) throws IOException { + byte[] expectedBytes = new byte[(int) expected.length()]; + InputStream fin = new FileInputStream(expected); + DataInputStream in = new DataInputStream(fin); + try { + in.readFully(expectedBytes); + } + finally { + in.close(); + } + return expectedBytes; + } + + + /** + *

+ * Asserts that two byte arrays are equal. If the two arrays are + * not equal a ComparisonFailure is thrown. Two + * arrays are equal if and only if they have the same length, + * and each item in the expected array is equal to the + * corresponding item in the actual array. + *

+ * + * @param expected the byte array the test should produce + * @param actual the byte array the test does produce + */ + private void assertEquals(byte[] expected, byte[] actual) { + + if (expected == null && actual == null) { + return; + } + // what if one is null and the other isn't???? + try { + assertEquals(expected.length, actual.length); + for (int i = 0; i < actual.length; i++) { + assertEquals(expected[i], actual[i]); + } + } catch (AssertionFailedError error) { + fail(getComparisonMessage(expected, actual)); + } + + + } + + private String getComparisonMessage(byte[] expected, byte[] actual) { + try { + return "Expected\n" + new String(expected, "UTF-8") + "\n\n but was \n\n" + new String(actual, "UTF-8"); + } catch (UnsupportedEncodingException e) { + return "Broken VM"; + } + } + + +} diff -Nru xom-1.2.1/src/nu/xom/tests/CanonicalizerTest.java xom-1.2.10/src/nu/xom/tests/CanonicalizerTest.java --- xom-1.2.1/src/nu/xom/tests/CanonicalizerTest.java 2008-12-19 14:22:38.000000000 +0000 +++ xom-1.2.10/src/nu/xom/tests/CanonicalizerTest.java 2011-02-21 16:14:26.000000000 +0000 @@ -1,4 +1,4 @@ -/* Copyright 2002-2005, 2008 Elliotte Rusty Harold +/* Copyright 2002-2005, 2008, 2011 Elliotte Rusty Harold This library is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public @@ -15,7 +15,7 @@ Boston, MA 02111-1307 USA You can contact Elliotte Rusty Harold by sending e-mail to - elharo@metalab.unc.edu. Please include the word "XOM" in the + elharo@ibiblio.org. Please include the word "XOM" in the subject line. The XOM home page is located at http://www.xom.nu/ */ @@ -67,6 +67,8 @@ private File canonical; private File input; private File output; + private ByteArrayOutputStream out = new ByteArrayOutputStream(); + private Canonicalizer canonicalizer = new Canonicalizer(out); public CanonicalizerTest(String name) { super(name); @@ -91,8 +93,6 @@ pdu.addAttribute(new Attribute("a2", "v2")); String expected = " a1=\"v1\" a2=\"v2\""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); - Canonicalizer canonicalizer = new Canonicalizer(out); Document doc = new Document(pdu); canonicalizer.write(doc.query("//@*")); @@ -114,8 +114,6 @@ pdu.addAttribute(a2); String expected = " a1=\"v1\" a2=\"v2\""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); - Canonicalizer canonicalizer = new Canonicalizer(out); Document doc = new Document(pdu); Nodes subset = doc.query("//@*"); @@ -136,8 +134,6 @@ Element pdu = new Element("doc", "http://www.example.com"); String expected = " xmlns=\"http://www.example.com\""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); - Canonicalizer canonicalizer = new Canonicalizer(out); Document doc = new Document(pdu); canonicalizer.write(doc.query("//namespace::node()")); @@ -156,8 +152,6 @@ Element pdu = new Element("pre:doc", "http://www.example.com"); String expected = " xmlns:pre=\"http://www.example.com\""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); - Canonicalizer canonicalizer = new Canonicalizer(out); Document doc = new Document(pdu); canonicalizer.write(doc.query("//namespace::node()")); @@ -173,7 +167,6 @@ public void testCanonicalizeWithNullAlgorithm() throws IOException { - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { new Canonicalizer(out, null); fail("Allowed null algorithm"); @@ -196,8 +189,6 @@ doc.appendChild(new Comment("comment 4")); String expected = "\n\n\n\n"; - ByteArrayOutputStream out = new ByteArrayOutputStream(); - Canonicalizer canonicalizer = new Canonicalizer(out); canonicalizer.write(doc.query("//comment()")); @@ -214,9 +205,6 @@ String input = ""; Document doc = builder.build(input, null); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - Canonicalizer canonicalizer = new Canonicalizer(out); - canonicalizer.write(doc); byte[] result = out.toByteArray(); @@ -238,8 +226,6 @@ doc.appendChild(new ProcessingInstruction("target", "value")); String expected = "\n\n\n\n"; - ByteArrayOutputStream out = new ByteArrayOutputStream(); - Canonicalizer canonicalizer = new Canonicalizer(out); canonicalizer.write(doc); @@ -261,8 +247,6 @@ pdu.appendChild(child); String expected = " a2=\"v1\" a1=\"v2\""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); - Canonicalizer canonicalizer = new Canonicalizer(out); Document doc = new Document(pdu); canonicalizer.write(doc.query("//@*")); @@ -281,8 +265,6 @@ pdu.addAttribute(new Attribute("a2", "v1&<>\"\t\r\n")); String expected = " a2=\"v1&<>" \""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); - Canonicalizer canonicalizer = new Canonicalizer(out); Document doc = new Document(pdu); canonicalizer.write(doc.query("//@*")); @@ -300,7 +282,6 @@ Element pdu = new Element("doc"); String expected = ""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); Canonicalizer canonicalizer = new Canonicalizer(out, Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS); @@ -322,7 +303,6 @@ pdu.addAttribute(new Attribute("a2", "v2")); String expected = ""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); Canonicalizer canonicalizer = new Canonicalizer(out, Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS); @@ -342,7 +322,6 @@ pdu.addNamespaceDeclaration("pre", "http://www.example.org/"); String expected = ""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); Canonicalizer canonicalizer = new Canonicalizer(out, Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS); @@ -366,7 +345,6 @@ grandchild.addAttribute(new Attribute("Attribute", "something")); String expected = ""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); Canonicalizer canonicalizer = new Canonicalizer(out, Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS); @@ -390,7 +368,6 @@ grandchild.addAttribute(new Attribute("Attribute", "something")); String expected = ""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); Canonicalizer canonicalizer = new Canonicalizer(out, Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS); @@ -409,7 +386,6 @@ Element pdu = new Element("tuck", "http://www.example.org/"); String expected = " xmlns=\"http://www.example.org/\""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); Canonicalizer canonicalizer = new Canonicalizer(out, Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS); @@ -437,7 +413,6 @@ middle.appendChild(child); String expected = ""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); Canonicalizer canonicalizer = new Canonicalizer(out, Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS); @@ -461,7 +436,6 @@ pdu.appendChild(child); String expected = ""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); Canonicalizer canonicalizer = new Canonicalizer(out, Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS); @@ -485,7 +459,6 @@ String expected = ""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); Canonicalizer canonicalizer = new Canonicalizer(out, Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS); @@ -506,7 +479,6 @@ pdu.addAttribute(new Attribute("pre:foo", "http://www.example.org/", "test")); String expected = ""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); Canonicalizer canonicalizer = new Canonicalizer(out, Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS); @@ -707,7 +679,6 @@ String expected = ""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out, false); serializer.write(doc.query("/*/child312")); @@ -735,7 +706,6 @@ String expected = ""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out, false); Nodes result = doc.query("/*/*/child312"); @@ -764,7 +734,6 @@ String expected = ""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out, false); serializer.write(doc.query("/* | //child312 | /*/@* | //child312/@*")); @@ -791,7 +760,6 @@ String expected = ""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out, false); serializer.write(doc.query("/* | //child312 | /*/@* | //child312/@*")); @@ -820,7 +788,6 @@ String expected = ""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out, false); serializer.write(doc.query("/*/child312 | /*/*/@*")); @@ -849,7 +816,6 @@ String expected = ""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out, false); serializer.write(doc.query("/*/child312 ")); @@ -874,7 +840,6 @@ String expected = ""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out, Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION); @@ -899,7 +864,6 @@ String expected = ""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out, Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION); @@ -926,7 +890,6 @@ String expected = ""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { XPathContext context = new XPathContext("pre", "http://www.example.org/"); Canonicalizer serializer = new Canonicalizer(out, @@ -952,7 +915,6 @@ String expected = ""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out, false); serializer.write(doc); @@ -995,7 +957,6 @@ String expected = ""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out, false); serializer.write(doc.query(xpath, context)); @@ -1028,7 +989,6 @@ Document doc = builder.build(input, null); XPathContext context = new XPathContext("ietf", "http://www.ietf.org"); String xpath = "//aaa"; - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out, false); serializer.write(doc.query(xpath, context)); @@ -1069,7 +1029,6 @@ XPathContext context = new XPathContext("ietf", "http://www.ietf.org"); String xpath = "//* | //text() | //@* | //namespace::*"; - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out, false); serializer.write(doc.query(xpath, context)); @@ -1112,7 +1071,6 @@ String expected = ""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out, Canonicalizer.CANONICAL_XML_WITH_COMMENTS); serializer.write(doc.query(xpath, context)); @@ -1139,7 +1097,6 @@ String expected = input; - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out, false); serializer.write(doc.query(xpath)); @@ -1176,7 +1133,6 @@ String expected = ""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out, false); serializer.write(doc.query(xpath, context)); @@ -1200,7 +1156,6 @@ String expected = ""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out, false); Nodes subset = doc.query("//."); @@ -1221,7 +1176,6 @@ Document doc = new Document(new Element("root")); - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out, false); Nodes subset = doc.query("/"); @@ -1258,7 +1212,6 @@ String expected = ""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out, false); serializer.write(doc.query(xpath, context)); @@ -1279,9 +1232,7 @@ try { String data = "data"; Document doc = builder.build(data, "http://www.ex.org/"); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - Canonicalizer serializer - = new Canonicalizer(out, false); + Canonicalizer serializer = new Canonicalizer(out, false); serializer.write(doc); fail("Canonicalized document with relative namespace URI"); } @@ -1400,7 +1351,6 @@ Document doc = builder.build(in); // make a Unicode normalized version of the same document - ByteArrayOutputStream out = new ByteArrayOutputStream(); Serializer serializer = new Serializer(out); serializer.setUnicodeNormalizationFormC(true); serializer.write(doc); @@ -1437,7 +1387,6 @@ Document doc = builder.build(in); // make a Unicode normalized version of the same document - ByteArrayOutputStream out = new ByteArrayOutputStream(); Serializer serializer = new Serializer(out); serializer.setUnicodeNormalizationFormC(true); serializer.write(doc); @@ -1456,8 +1405,6 @@ public void testNullDocument() throws IOException { - ByteArrayOutputStream out = new ByteArrayOutputStream(); - Canonicalizer canonicalizer = new Canonicalizer(out); try { canonicalizer.write((Document) null); fail("Wrote null document"); @@ -1479,8 +1426,6 @@ Element root = new Element("root"); root.addAttribute(attribute); Document doc = new Document(root); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - Canonicalizer canonicalizer = new Canonicalizer(out); canonicalizer.write(doc); out.close(); String result = new String(out.toByteArray(), "UTF8"); @@ -1582,7 +1527,6 @@ pdu.appendChild(elem1); String expected = "content"; - ByteArrayOutputStream out = new ByteArrayOutputStream(); Canonicalizer canonicalizer = new Canonicalizer(out, Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS); @@ -1596,13 +1540,12 @@ } - public static void testAustB() throws IOException { + public void testAustB() throws IOException { Element e1 = new Element("a:a", "urn:a"); Element e2 = new Element("b"); e1.appendChild(e2); - ByteArrayOutputStream out = new ByteArrayOutputStream(); Canonicalizer c = new Canonicalizer(out, Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION); c.write(e1); @@ -1612,13 +1555,12 @@ } - public static void testAustB2() throws IOException { + public void testAustB2() throws IOException { Element e1 = new Element("a:a", "urn:a"); Element e2 = new Element("b"); e1.appendChild(e2); - ByteArrayOutputStream out = new ByteArrayOutputStream(); Canonicalizer c = new Canonicalizer(out); c.write(e1); String s = out.toString("UTF8"); @@ -1627,12 +1569,11 @@ } - public static void testAust() throws Exception { + public void testAust() throws Exception { Element e1 = new Element("a:a", "urn:a"); Element e2 = new Element("a:b", "urn:a"); e1.appendChild(e2); - ByteArrayOutputStream out = new ByteArrayOutputStream(); Canonicalizer c = new Canonicalizer(out, Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION); c.write(e2); @@ -1642,12 +1583,11 @@ } - public static void testAust4() throws Exception { + public void testAust4() throws Exception { Element e1 = new Element("a:a", "urn:a"); Element e2 = new Element("a:b", "urn:a"); e1.appendChild(e2); - ByteArrayOutputStream out = new ByteArrayOutputStream(); Canonicalizer canonicalizer = new Canonicalizer(out, Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS); XPathContext context = new XPathContext("a", "urn:a"); @@ -1660,12 +1600,11 @@ } - public static void testAust5() throws Exception { + public void testAust5() throws Exception { Element e1 = new Element("a:a", "urn:a"); Element e2 = new Element("a:b", "urn:a"); e1.appendChild(e2); - ByteArrayOutputStream out = new ByteArrayOutputStream(); Canonicalizer canonicalizer = new Canonicalizer(out, Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS); new Document(e1); @@ -1680,27 +1619,25 @@ } - public static void testAust3() throws Exception { + public void testAust3() throws Exception { Element e2 = new Element("a:b", "urn:a"); - ByteArrayOutputStream os = new ByteArrayOutputStream(); - new Canonicalizer(os, + new Canonicalizer(out, Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION).write(e2); - String s = os.toString("UTF8"); + String s = out.toString("UTF8"); assertEquals("", s); } - public static void testAust2() throws Exception { + public void testAust2() throws Exception { Element e1 = new Element("a:a", "urn:a"); Element e2 = new Element("a:b", "urn:a"); e1.appendChild(e2); - ByteArrayOutputStream os = new ByteArrayOutputStream(); - new Canonicalizer(os, + new Canonicalizer(out, Canonicalizer.CANONICAL_XML).write(e2); - String s = os.toString("UTF8"); + String s = out.toString("UTF8"); assertEquals("", s); } @@ -1716,7 +1653,6 @@ String expected = "content"; - ByteArrayOutputStream out = new ByteArrayOutputStream(); Canonicalizer canonicalizer = new Canonicalizer(out, Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS); @@ -1749,7 +1685,6 @@ root.appendChild(a); String expected = "test"; - ByteArrayOutputStream out = new ByteArrayOutputStream(); Canonicalizer canonicalizer = new Canonicalizer(out, Canonicalizer.CANONICAL_XML); Document doc = new Document(root); @@ -1772,7 +1707,6 @@ String expected = "content"; - ByteArrayOutputStream out = new ByteArrayOutputStream(); Canonicalizer canonicalizer = new Canonicalizer(out, Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS); @@ -1801,7 +1735,6 @@ String expected = "content"; - ByteArrayOutputStream out = new ByteArrayOutputStream(); Canonicalizer canonicalizer = new Canonicalizer(out, Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS); @@ -1831,7 +1764,6 @@ String expected = "" + ""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); Canonicalizer canonicalizer = new Canonicalizer(out, Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS); @@ -1858,7 +1790,6 @@ String expected = "" + ""; - ByteArrayOutputStream out = new ByteArrayOutputStream(); Canonicalizer canonicalizer = new Canonicalizer(out, Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS); @@ -1960,7 +1891,6 @@ public void testCanonicalizeAttribute() throws IOException { Attribute att = new Attribute("pre:foo", "http://www.example.org", "value"); - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out); serializer.write(att); @@ -1980,7 +1910,6 @@ Element element = new Element("pre:foo", "http://www.example.org"); Nodes namespaces = element.query("namespace::pre"); Namespace ns = (Namespace) namespaces.get(0); - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out); serializer.write(ns); @@ -2002,7 +1931,6 @@ Nodes namespaces = element.query("namespace::*"); Namespace ns = (Namespace) namespaces.get(0); if (ns.getPrefix().equals("xml")) ns = (Namespace) namespaces.get(1); - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out); serializer.write(ns); @@ -2022,7 +1950,6 @@ Element element = new Element("foo"); Nodes namespaces = element.query("namespace::*"); Namespace ns = (Namespace) namespaces.get(0); - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out); serializer.write(ns); @@ -2042,7 +1969,6 @@ Element element = new Element("pre:foo", "http://www.example.org"); element.appendChild(" value \n value"); - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out); serializer.write(element); @@ -2060,11 +1986,9 @@ public void testDontPutElementInDocument() throws IOException { - Element element = new Element("pre:foo", "http://www.example.org"); assertNull(element.getDocument()); - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out); serializer.write(element); @@ -2080,11 +2004,10 @@ public void testCanonicalizeElementInDocument() throws IOException { Element root = new Element("root"); - Document doc = new Document(root); + new Document(root); Element element = new Element("pre:foo", "http://www.example.org"); root.appendChild(element); element.appendChild(" value \n value"); - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out); serializer.write(element); @@ -2109,7 +2032,6 @@ Element b = new Element("b"); a.appendChild(b); - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out); serializer.write(b); @@ -2133,7 +2055,6 @@ Element element = new Element("pre:foo", "http://www.example.org"); root.appendChild(element); element.appendChild(" value \n value"); - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out, Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION); serializer.write(element); @@ -2153,7 +2074,6 @@ public void testCanonicalizeDocumentTypeDeclaration() throws IOException { DocType doctype = new DocType("root", "http://www.example.org"); - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out); serializer.write(doctype); @@ -2170,7 +2090,6 @@ public void testCanonicalizeProcessingInstruction() throws IOException { ProcessingInstruction pi = new ProcessingInstruction("target", "value \n value"); - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out); serializer.write(pi); @@ -2188,7 +2107,6 @@ public void testCanonicalizeText() throws IOException { Text c = new Text(" pre:foo \n "); - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out); serializer.write(c); @@ -2207,7 +2125,6 @@ public void testCanonicalizeComment() throws IOException { Comment c = new Comment("pre:foo"); - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { Canonicalizer serializer = new Canonicalizer(out); serializer.write(c); @@ -2224,7 +2141,6 @@ public void testUnsupportedAlgorithm() throws IOException { - ByteArrayOutputStream out = new ByteArrayOutputStream(); try { new Canonicalizer(out, "http://www.example.org/canonical"); fail("Allowed unrecognized algorithm"); @@ -2241,7 +2157,6 @@ public void testCanonicalizeDetachedNodes() throws IOException { - ByteArrayOutputStream out = new ByteArrayOutputStream(); Element e = new Element("test"); Nodes nodes = new Nodes(e); Canonicalizer serializer = new Canonicalizer(out); @@ -2261,7 +2176,6 @@ public void testCanonicalizeNodesFromTwoDocuments() throws IOException { - ByteArrayOutputStream out = new ByteArrayOutputStream(); Element e1 = new Element("test"); new Document(e1); Element e2 = new Element("test"); diff -Nru xom-1.2.1/src/nu/xom/tests/DocTypeTest.java xom-1.2.10/src/nu/xom/tests/DocTypeTest.java --- xom-1.2.1/src/nu/xom/tests/DocTypeTest.java 2009-01-04 01:37:20.000000000 +0000 +++ xom-1.2.10/src/nu/xom/tests/DocTypeTest.java 2011-02-06 12:45:10.000000000 +0000 @@ -225,7 +225,7 @@ // illegal name try { name = "try MyName"; - doctype = new DocType(name); + new DocType(name); fail("allowed root element name to contain spaces"); } catch (IllegalNameException success) { diff -Nru xom-1.2.1/src/nu/xom/tests/DocumentTest.java xom-1.2.10/src/nu/xom/tests/DocumentTest.java --- xom-1.2.1/src/nu/xom/tests/DocumentTest.java 2005-01-05 01:48:50.000000000 +0000 +++ xom-1.2.10/src/nu/xom/tests/DocumentTest.java 2011-02-06 14:33:53.000000000 +0000 @@ -1,4 +1,4 @@ -/* Copyright 2002-2004 Elliotte Rusty Harold +/* Copyright 2002-2004, 2011 Elliotte Rusty Harold This library is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public @@ -15,7 +15,7 @@ Boston, MA 02111-1307 USA You can contact Elliotte Rusty Harold by sending e-mail to - elharo@metalab.unc.edu. Please include the word "XOM" in the + elharo@ibiblio.org. Please include the word "XOM" in the subject line. The XOM home page is located at http://www.xom.nu/ */ @@ -576,7 +576,7 @@ f = new File(f, "test.xml"); Document input = builder.build(f); String s = input.toXML(); - Document output = builder.build(s, f.toURL().toExternalForm()); + Document output = builder.build(s, f.toURI().toString()); assertEquals(input, output); } diff -Nru xom-1.2.1/src/nu/xom/tests/ElementTest.java xom-1.2.10/src/nu/xom/tests/ElementTest.java --- xom-1.2.1/src/nu/xom/tests/ElementTest.java 2009-02-12 03:09:47.000000000 +0000 +++ xom-1.2.10/src/nu/xom/tests/ElementTest.java 2011-02-06 14:34:26.000000000 +0000 @@ -1,4 +1,4 @@ -/* Copyright 2002-2004 Elliotte Rusty Harold +/* Copyright 2002-2004, 2011 Elliotte Rusty Harold This library is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public @@ -15,7 +15,7 @@ Boston, MA 02111-1307 USA You can contact Elliotte Rusty Harold by sending e-mail to - elharo@metalab.unc.edu. Please include the word "XOM" in the + elharo@mibiblio.org. Please include the word "XOM" in the subject line. The XOM home page is located at http://www.xom.nu/ */ @@ -50,7 +50,7 @@ *

* * @author Elliotte Rusty Harold - * @version 1.2 + * @version 1.2.7 * */ public class ElementTest extends XOMTestCase { @@ -285,7 +285,7 @@ Element root = doc.getRootElement(); String form = root.toXML(); Document doc2 - = builder.build(form, f.toURL().toExternalForm()); + = builder.build(form, f.toURI().toString()); Element root2 = doc2.getRootElement(); assertEquals(root, root2); @@ -316,6 +316,64 @@ assertEquals("", e.getNamespaceURI()); } + + + public void testInsertChildAfterEnd() { + + Element parent = new Element("p"); + for (int i = 0; i < 3; i++) { + Element c = new Element("c"); + parent.appendChild(c); + } + assertEquals(3, parent.getChildCount()); + Element d = new Element("d"); + + try { + parent.insertChild(d, 5); + fail("Inserted child too far"); + } + catch (IndexOutOfBoundsException ex) { + assertNotNull(ex.getMessage()); + } + + } + + + public void testInsertChildAtEnd() { + + Element parent = new Element("p"); + for (int i = 0; i < 3; i++) { + Element c = new Element("c"); + parent.appendChild(c); + } + assertEquals(3, parent.getChildCount()); + Element d = new Element("d"); + + parent.insertChild(d, 3); + assertEquals(4, parent.getChildCount()); + + } + + + public void testInsertChildNegative() { + + Element parent = new Element("p"); + for (int i = 0; i < 3; i++) { + Element c = new Element("c"); + parent.appendChild(c); + } + assertEquals(3, parent.getChildCount()); + Element d = new Element("d"); + + try { + parent.insertChild(d, -1); + fail("Inserted child with negative index"); + } + catch (IndexOutOfBoundsException ex) { + assertNotNull(ex); + } + + } public void testCantInsertDoctype() { diff -Nru xom-1.2.1/src/nu/xom/tests/ParentNodeTest.java xom-1.2.10/src/nu/xom/tests/ParentNodeTest.java --- xom-1.2.1/src/nu/xom/tests/ParentNodeTest.java 2006-03-30 14:42:54.000000000 +0000 +++ xom-1.2.10/src/nu/xom/tests/ParentNodeTest.java 2011-02-06 12:45:08.000000000 +0000 @@ -40,7 +40,7 @@ *

* * @author Elliotte Rusty Harold - * @version 1.2d1 + * @version 1.2.3 * */ public class ParentNodeTest extends XOMTestCase { @@ -89,6 +89,20 @@ } + public void testAppendNull() { + + Element child = null; + try { + empty.appendChild(child); + fail("Inserted null"); + } + catch (NullPointerException ex) { + assertNotNull(ex.getMessage()); + } + + } + + public void testAppendChildToItself() { Element child = new Element("test"); diff -Nru xom-1.2.1/src/nu/xom/tests/XIncludeTest.java xom-1.2.10/src/nu/xom/tests/XIncludeTest.java --- xom-1.2.1/src/nu/xom/tests/XIncludeTest.java 2007-06-03 23:17:38.000000000 +0000 +++ xom-1.2.10/src/nu/xom/tests/XIncludeTest.java 2011-02-06 14:34:44.000000000 +0000 @@ -1,4 +1,4 @@ -/* Copyright 2002-2005 Elliotte Rusty Harold +/* Copyright 2002-2005, 2011 Elliotte Rusty Harold This library is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public @@ -15,7 +15,7 @@ Boston, MA 02111-1307 USA You can contact Elliotte Rusty Harold by sending e-mail to - elharo@metalab.unc.edu. Please include the word "XOM" in the + elharo@ibiblio.org. Please include the word "XOM" in the subject line. The XOM home page is located at http://www.xom.nu/ */ @@ -31,6 +31,8 @@ import java.io.Reader; import java.io.StringReader; import java.io.Writer; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import junit.framework.AssertionFailedError; @@ -65,7 +67,7 @@ *

* * @author Elliotte Rusty Harold - * @version 1.1b3 + * @version 1.2.7 * */ public class XIncludeTest extends XOMTestCase { @@ -602,7 +604,7 @@ File input = new File(inputDir, "disclaimer.xml"); String data = "" + "\n

120 Mz is adequate for an average home user.

" - + "\n \n
"; + + "\n \n"; Reader reader = new StringReader(data); Document doc = builder.build(reader); Document result = XIncluder.resolve(doc); @@ -1285,7 +1287,7 @@ } catch (InclusionLoopException success) { assertNotNull(success.getMessage()); - assertEquals(input.toURL().toExternalForm(), success.getURI()); + assertEquals(input.toURI().toString(), success.getURI()); } } @@ -1301,9 +1303,9 @@ fail("allowed circular include, cycle length 1"); } catch (InclusionLoopException success) { - assertTrue(success.getMessage().indexOf(errorFile.toURL().toExternalForm()) > 1); - assertTrue(success.getMessage().indexOf(input.toURL().toExternalForm()) > 1); - assertEquals(errorFile.toURL().toExternalForm(), success.getURI()); + assertTrue(success.getMessage().indexOf(errorFile.toURI().toString()) > 1); + assertTrue(success.getMessage().indexOf(input.toURI().toString()) > 1); + assertEquals(errorFile.toURI().toString(), success.getURI()); } } @@ -1327,7 +1329,7 @@ public void testBadParseAttribute() - throws ParsingException, IOException, XIncludeException { + throws ParsingException, IOException, XIncludeException, URISyntaxException { File input = new File(inputDir, "badparseattribute.xml"); Document doc = builder.build(input); @@ -1337,8 +1339,8 @@ } catch (BadParseAttributeException success) { assertNotNull(success.getMessage()); - URL u1 = input.toURL(); - URL u2 = new URL(success.getURI()); + URI u1 = input.toURI(); + URI u2 = new URI(success.getURI()); assertEquals(u1, u2); } @@ -1431,7 +1433,7 @@ public void testShorthandXPointerMatchesNothing() - throws ParsingException, IOException { + throws ParsingException, IOException, URISyntaxException { File input = new File(inputDir, "xptridtest2.xml"); Document doc = builder.build(input); @@ -1444,8 +1446,8 @@ assertNotNull(success.getMessage()); // Must compare URLs instead of strings here to avoid // issues of whether a file URL begins file:/ or file:/// - URL u1 = input.toURL(); - URL u2 = new URL(success.getURI()); + URI u1 = input.toURI(); + URI u2 = new URI(success.getURI()); assertEquals(u1, u2); } @@ -1694,7 +1696,7 @@ public void testXPointerTumblerMatchesNothing() - throws ParsingException, IOException { + throws ParsingException, IOException, URISyntaxException { File input = new File( "data/xinclude/input/xptrtumblertest2.xml" @@ -1706,16 +1708,16 @@ } catch (XIncludeException success) { assertNotNull(success.getMessage()); - URL u1 = input.toURL(); - URL u2 = new URL(success.getURI()); - assertEquals(u1, u2); + URI u1 = input.toURI(); + URI u2 = new URI(success.getURI()); + assertEquals(u1, u2); } } public void testMalformedXPointer() - throws ParsingException, IOException { + throws ParsingException, IOException, URISyntaxException { File input = new File(inputDir, "badxptr.xml"); Document doc = builder.build(input); @@ -1725,8 +1727,8 @@ } catch (XIncludeException success) { assertNotNull(success.getMessage()); - URL u1 = input.toURL(); - URL u2 = new URL(success.getURI()); + URI u1 = input.toURI(); + URI u2 = new URI(success.getURI()); assertEquals(u1, u2); } @@ -1777,7 +1779,7 @@ public void testAnotherMalformedXPointer() - throws ParsingException, IOException { + throws ParsingException, IOException, URISyntaxException { // testing use of non NCNAME as ID File input = new File(inputDir, "badxptr2.xml"); @@ -1788,9 +1790,9 @@ } catch (XIncludeException success) { assertNotNull(success.getMessage()); - URL u1 = input.toURL(); - URL u2 = new URL(success.getURI()); - assertEquals(u1, u2); + URI u1 = input.toURI(); + URI u2 = new URI(success.getURI()); + assertEquals(u1, u2); } } @@ -1966,7 +1968,7 @@ File testDescription = new File("data"); testDescription = new File(testDescription, "XInclude-Test-Suite"); testDescription = new File(testDescription, "testdescr.xml"); - URL baseURL = testDescription.toURL(); + URL baseURL = testDescription.toURI().toURL(); if (!testDescription.exists()) { baseURL = new URL( "http://dev.w3.org/cvsweb/~checkout~/2001/" + @@ -2102,7 +2104,7 @@ // and B encounters the error (e.g. a missing href) // to make sure B's URL is in the error message, not A's public void testChildDocumentSetsErrorURI() - throws ParsingException, IOException, XIncludeException { + throws ParsingException, IOException, XIncludeException, URISyntaxException { File input = new File(inputDir, "toplevel.xml"); File error = new File(inputDir, "onedown.xml"); @@ -2113,9 +2115,9 @@ } catch (NoIncludeLocationException success) { assertNotNull(success.getMessage()); - URL u1 = error.toURL(); - URL u2 = new URL(success.getURI()); - assertEquals(u1, u2); + URI u1 = error.toURI(); + URI u2 = new URI(success.getURI()); + assertEquals(u1, u2); } } diff -Nru xom-1.2.1/src/nu/xom/tests/XPathTest.java xom-1.2.10/src/nu/xom/tests/XPathTest.java --- xom-1.2.1/src/nu/xom/tests/XPathTest.java 2009-01-17 14:15:56.000000000 +0000 +++ xom-1.2.10/src/nu/xom/tests/XPathTest.java 2012-05-12 16:04:04.000000000 +0000 @@ -1,4 +1,4 @@ -/* Copyright 2005, 2006 Elliotte Rusty Harold +/* Copyright 2005, 2006, 2012 Elliotte Rusty Harold This library is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public @@ -15,7 +15,7 @@ Boston, MA 02111-1307 USA You can contact Elliotte Rusty Harold by sending e-mail to - elharo@metalab.unc.edu. Please include the word "XOM" in the + elharo@ibiblio.org. Please include the word "XOM" in the subject line. The XOM home page is located at http://www.xom.nu/ */ @@ -52,7 +52,7 @@ *

* * @author Elliotte Rusty Harold - * @version 1.2b3 + * @version 1.2.8 * */ public class XPathTest extends XOMTestCase { @@ -2214,6 +2214,18 @@ } } + + + public void testFunctionWithDefaultNamespace() throws ParsingException, IOException { + + Element root = new Element("root", "http://www.example.org"); + Document doc = new Document(root); + XPathContext context = XPathContext.makeNamespaceContext(doc.getRootElement()); + context.addNamespace("pre", doc.getRootElement().getNamespaceURI()); + Nodes query = doc.query("//*[not(self::pre:test)]", context); + assertEquals(1, query.size()); + + } public void testWhiteSpaceIsAllowedBetweenTokens() { diff -Nru xom-1.2.1/www/index.html xom-1.2.10/www/index.html --- xom-1.2.1/www/index.html 1970-01-01 00:00:00.000000000 +0000 +++ xom-1.2.10/www/index.html 2011-02-06 12:45:04.000000000 +0000 @@ -0,0 +1,5 @@ + + + This is the default project content. + +