Fridrich Strba 2023-08-23 11:11:51 +00:00 committed by Git OBS Bridge
parent 0447b3772c
commit cbd002ab9a
14 changed files with 265 additions and 1341 deletions

15
_service Normal file
View File

@ -0,0 +1,15 @@
<services>
<service name="tar_scm" mode="disabled">
<param name="scm">git</param>
<param name="url">https://github.com/dom4j/dom4j.git</param>
<param name="revision">version-2.0.3</param>
<param name="match-tag">version-*</param>
<param name="versionformat">@PARENT_TAG@</param>
<param name="versionrewrite-pattern">version-(.*)</param>
</service>
<service name="recompress" mode="disabled">
<param name="file">*.tar</param>
<param name="compression">xz</param>
</service>
<service name="set_version" mode="disabled"/>
</services>

View File

@ -1,12 +0,0 @@
--- dom4j/src/java/org/dom4j/util/SimpleSingleton.java
+++ dom4j/src/java/org/dom4j/util/SimpleSingleton.java
@@ -35,8 +35,7 @@
if (singletonClassName != null) {
Class clazz = null;
try {
- clazz = Thread.currentThread().getContextClassLoader().loadClass(
- singletonClassName);
+ clazz = Class.forName(singletonClassName);
singletonInstance = clazz.newInstance();
} catch (Exception ignore) {
try {

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d72427a11a23df97f8957331269df7fde4fcc982ac3b9d399a49e4df8598b94a
size 1962425

View File

@ -1,221 +0,0 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<name>dom4j</name>
<version>1.6.1</version>
<description>dom4j: the flexible XML framework for Java</description>
<url>http://dom4j.org</url>
<issueManagement>
<url>http://sourceforge.net/tracker/?group_id=16035</url>
</issueManagement>
<ciManagement>
<notifiers>
<notifier>
<address>dom4j-dev@lists.sourceforge.net</address>
</notifier>
</notifiers>
</ciManagement>
<inceptionYear>2001</inceptionYear>
<mailingLists>
<mailingList>
<name>dom4j user list</name>
<subscribe>http://lists.sourceforge.net/lists/listinfo/dom4j-user</subscribe>
<unsubscribe>http://lists.sourceforge.net/lists/listinfo/dom4j-user</unsubscribe>
<archive>http://www.mail-archive.com/dom4j-user%40lists.sourceforge.net/</archive>
</mailingList>
<mailingList>
<name>dom4j developer list</name>
<subscribe>http://lists.sourceforge.net/lists/listinfo/dom4j-dev</subscribe>
<unsubscribe>http://lists.sourceforge.net/lists/listinfo/dom4j-dev</unsubscribe>
<archive>http://www.mail-archive.com/dom4j-dev%40lists.sourceforge.net/</archive>
</mailingList>
<mailingList>
<name>dom4j commits list</name>
<subscribe>http://lists.sourceforge.net/lists/listinfo/dom4j-commits</subscribe>
<unsubscribe>http://lists.sourceforge.net/lists/listinfo/dom4j-commits</unsubscribe>
</mailingList>
</mailingLists>
<developers>
<developer>
<id>carnold</id>
<name>Curt Arnold</name>
<email>carnold@users.sourceforge.net</email>
</developer>
<developer>
<id>ddlucas</id>
<name>David Lucas</name>
<email>ddlucas@users.sourceforge.net</email>
</developer>
<developer>
<id>drwhite</id>
<name>David White</name>
<email>drwhite@users.sourceforge.net</email>
</developer>
<developer>
<id>jjenkov</id>
<name>Jakob Jenkov</name>
<email>jjenkov@users.sourceforge.net</email>
</developer>
<developer>
<id>jstrachan</id>
<name>James Strachan</name>
<email>jstrachan@apache.org</email>
<organization>SpiritSoft, Inc.</organization>
</developer>
<developer>
<id>laramiec</id>
<name>Laramie Crocker</name>
<email>laramiec@users.sourceforge.net</email>
</developer>
<developer>
<id>maartenc</id>
<name>Maarten Coene</name>
<email>maartenc@users.sourceforge.net</email>
<organization>Cronos</organization>
</developer>
<developer>
<id>mskells</id>
<name>Michael Skells</name>
<email>mskells@users.sourceforge.net</email>
</developer>
<developer>
<id>nicksanderson</id>
<name>Nick Sanderson</name>
<email>nicksanderson@users.sourceforge.net</email>
</developer>
<developer>
<id>slehmann</id>
<name>Steen Lehmann</name>
<email>slehmann@users.sourceforge.net</email>
</developer>
<developer>
<id>tradem</id>
<name>Tobias Rademacher</name>
<email>tradem@users.sourceforge.net</email>
</developer>
<developer>
<id>werken</id>
<name>Bob McWhirter</name>
<email>werken@users.sourceforge.net</email>
</developer>
<developer>
<id>wolfftw</id>
<name>Todd Wolff</name>
<email>wolfftw@users.sourceforge.net</email>
</developer>
<developer>
<id>yeekee</id>
<name>OuYang Chen</name>
<email>yeekee@users.sourceforge.net</email>
</developer>
<developer>
<id>yruan2</id>
<name>Yuxin Ruan</name>
<email>yruan2@users.sourceforge.net</email>
</developer>
</developers>
<scm>
<connection>scm:cvs:pserver:anonymous@cvs.sourceforge.net:/cvsroot/dom4j:dom4j</connection>
<developerConnection>scm:cvs:ext:${maven.username}@cvs.sourceforge.net:/cvsroot/dom4j:dom4j</developerConnection>
<url>http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/dom4j/dom4j/</url>
</scm>
<organization>
<name>MetaStuff Ltd.</name>
<url>http://sourceforge.net/projects/dom4j</url>
</organization>
<build>
<sourceDirectory>src/java</sourceDirectory>
<testSourceDirectory>src/test</testSourceDirectory>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>jaxme</groupId>
<artifactId>jaxme-api</artifactId>
<version>0.3</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.1-beta-6</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>msv</groupId>
<artifactId>xsdlib</artifactId>
<version>20030807</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>msv</groupId>
<artifactId>relaxngDatatype</artifactId>
<version>20030807</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>pull-parser</groupId>
<artifactId>pull-parser</artifactId>
<version>2</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>xpp3</groupId>
<artifactId>xpp3</artifactId>
<version>1.1.3.3</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>stax</groupId>
<artifactId>stax-api</artifactId>
<version>1.0</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.0.b2</version>
</dependency>
<dependency>
<groupId>junitperf</groupId>
<artifactId>junitperf</artifactId>
<version>1.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>stax</groupId>
<artifactId>stax-ri</artifactId>
<version>1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.6.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.5.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<distributionManagement>
<site>
<id>default</id>
<name>Default Site</name>
<url>scp://dom4j.org//home/groups/d/do/dom4j/htdocs</url>
</site>
</distributionManagement>
</project>

77
dom4j-2.0.3.pom Normal file
View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- This module was also published with a richer model, Gradle metadata, -->
<!-- which should be used instead. Do not delete the following line which -->
<!-- is to indicate to Gradle or any Gradle module metadata file consumer -->
<!-- that they should prefer consuming it instead. -->
<!-- do_not_remove: published-with-gradle-metadata -->
<modelVersion>4.0.0</modelVersion>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>2.0.3</version>
<name>dom4j</name>
<description>flexible XML framework for Java</description>
<url>http://dom4j.github.io/</url>
<licenses>
<license>
<name>BSD 3-clause New License</name>
<url>https://github.com/dom4j/dom4j/blob/master/LICENSE</url>
</license>
</licenses>
<developers>
<developer>
<name>Filip Jirsák</name>
<email>filip@jirsak.org</email>
<url>https://github.com/FilipJirsak</url>
</developer>
</developers>
<scm>
<connection>scm:git:git@github.com:dom4j/dom4j.git</connection>
<developerConnection>scm:git:git@github.com:dom4j/dom4j.git</developerConnection>
<url>git@github.com:dom4j/dom4j.git</url>
</scm>
<dependencies>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.1.6</version>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>javax.xml.stream</groupId>
<artifactId>stax-api</artifactId>
<version>1.0-2</version>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>net.java.dev.msv</groupId>
<artifactId>xsdlib</artifactId>
<version>2013.6.1</version>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.12</version>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>pull-parser</groupId>
<artifactId>pull-parser</artifactId>
<version>2</version>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>xpp3</groupId>
<artifactId>xpp3</artifactId>
<version>1.1.4c</version>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
</dependencies>
</project>

3
dom4j-2.0.3.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2befe87fb264f5f04fa420414d5b35d2d3bc90937312078142021210e2633c12
size 396540

View File

@ -1,259 +0,0 @@
Index: dom4j/src/java/org/dom4j/Namespace.java
===================================================================
--- dom4j.orig/src/java/org/dom4j/Namespace.java
+++ dom4j/src/java/org/dom4j/Namespace.java
@@ -51,6 +51,10 @@ public class Namespace extends AbstractN
public Namespace(String prefix, String uri) {
this.prefix = (prefix != null) ? prefix : "";
this.uri = (uri != null) ? uri : "";
+
+ if (!this.prefix.isEmpty()) {
+ QName.validateNCName(this.prefix);
+ }
}
/**
Index: dom4j/src/java/org/dom4j/QName.java
===================================================================
--- dom4j.orig/src/java/org/dom4j/QName.java
+++ dom4j/src/java/org/dom4j/QName.java
@@ -11,6 +11,7 @@ import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
+import java.util.regex.Pattern;
import org.dom4j.tree.QNameCache;
import org.dom4j.util.SingletonStrategy;
@@ -20,6 +21,7 @@ import org.dom4j.util.SingletonStrategy;
* <code>QName</code> represents a qualified name value of an XML element or
* attribute. It consists of a local name and a {@link Namespace}instance. This
* object is immutable.
+ * @author Filip Jirsak
* </p>
*
* @author <a href="mailto:jstrachan@apache.org">James Strachan </a>
@@ -28,6 +30,81 @@ public class QName implements Serializab
/** The Singleton instance */
private static SingletonStrategy singleton = null;
+ /**
+ * {@code NameStartChar} without colon.
+ *
+ * <pre>NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]</pre>
+ *
+ * @see <a href="https://www.w3.org/TR/xml/#sec-common-syn">XML 1.0 - 2.3 Common Syntactic Constructs</a>
+ * @see <a href="https://www.w3.org/TR/2006/REC-xml11-20060816/#sec-common-syn">XML 1.1 - 2.3 Common Syntactic Constructs</a>
+ */
+ private static final String NAME_START_CHAR = "_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD";
+
+ /**
+ * {@code NameChar} without colon.
+ *
+ * <pre>NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]</pre>
+ *
+ * @see <a href="https://www.w3.org/TR/xml/#sec-common-syn">XML 1.0 - 2.3 Common Syntactic Constructs</a>
+ * @see <a href="https://www.w3.org/TR/2006/REC-xml11-20060816/#sec-common-syn">XML 1.1 - 2.3 Common Syntactic Constructs</a>
+ */
+ private static final String NAME_CHAR = NAME_START_CHAR + "-.0-9\u00B7\u0300-\u036F\u203F-\u2040";
+
+ /**
+ * {@code NCName}
+ * {@code NCName}
+ *
+ * <pre>
+ * NCName ::= NCNameStartChar NCNameChar* (An XML Name, minus the ":")
+ * NCNameChar ::= NameChar -':'
+ * NCNameStartChar ::= NameStartChar -':'
+ * </pre>
+ *
+ * @see <a href="https://www.w3.org/TR/xml-names/#ns-qualnames">Namespaces in XML 1.0 - 4 Qualified Names</a>
+ * @see <a href="https://www.w3.org/TR/2006/REC-xml-names11-20060816/#ns-qualnames">Namespaces in XML 1.1 - 4 Qualified Names</a>
+ */
+ private static final String NCNAME = "["+NAME_START_CHAR+"]["+NAME_CHAR+"]*";
+
+ /**
+ * Regular expression for {@code Name} (with colon).
+ *
+ * <pre>Name ::= NameStartChar (NameChar)*</pre>
+ *
+ * @see <a href="https://www.w3.org/TR/xml/#sec-common-syn">XML 1.0 - 2.3 Common Syntactic Constructs</a>
+ * @see <a href="https://www.w3.org/TR/2006/REC-xml11-20060816/#sec-common-syn">XML 1.1 - 2.3 Common Syntactic Constructs</a>
+ */
+ private static final Pattern RE_NAME = Pattern.compile("[:"+NAME_START_CHAR+"][:"+NAME_CHAR+"]*");
+
+ /**
+ * Regular expression for {@code NCName}.
+ *
+ * <pre>
+ * NCName ::= NCNameStartChar NCNameChar* (An XML Name, minus the ":")
+ * NCNameChar ::= NameChar -':'
+ * NCNameStartChar ::= NameStartChar -':'
+ * </pre>
+ *
+ * @see <a href="https://www.w3.org/TR/xml-names/#ns-qualnames">Namespaces in XML 1.0 - 4 Qualified Names</a>
+ * @see <a href="https://www.w3.org/TR/2006/REC-xml-names11-20060816/#ns-qualnames">Namespaces in XML 1.1 - 4 Qualified Names</a>
+ */
+ private static final Pattern RE_NCNAME = Pattern.compile(NCNAME);
+
+ /**
+ * Regular expression for {@code QName}.
+ *
+ * <pre>
+ * QName ::= PrefixedName | UnprefixedName
+ * PrefixedName ::= Prefix ':' LocalPart
+ * UnprefixedName ::= LocalPart
+ * Prefix ::= NCName
+ * LocalPart ::= NCName
+ * </pre>
+ *
+ * @see <a href="https://www.w3.org/TR/xml-names/#ns-qualnames">Namespaces in XML 1.0 - 4 Qualified Names</a>
+ * @see <a href="https://www.w3.org/TR/2006/REC-xml-names11-20060816/#ns-qualnames">Namespaces in XML 1.1 - 4 Qualified Names</a>
+ */
+ private static final Pattern RE_QNAME = Pattern.compile("(?:"+NCNAME+":)?"+NCNAME);
+
static {
try {
String defaultSingletonClass = "org.dom4j.util.SimpleSingleton";
@@ -73,6 +150,11 @@ public class QName implements Serializab
this.name = (name == null) ? "" : name;
this.namespace = (namespace == null) ? Namespace.NO_NAMESPACE
: namespace;
+ if (this.namespace.equals(Namespace.NO_NAMESPACE)) {
+ validateName(this.name);
+ } else {
+ validateNCName(this.name);
+ }
}
public QName(String name, Namespace namespace, String qualifiedName) {
@@ -80,6 +162,8 @@ public class QName implements Serializab
this.qualifiedName = qualifiedName;
this.namespace = (namespace == null) ? Namespace.NO_NAMESPACE
: namespace;
+ validateNCName(this.name);
+ validateQName(this.qualifiedName);
}
public static QName get(String name) {
@@ -253,6 +337,24 @@ public class QName implements Serializab
QNameCache cache = (QNameCache) singleton.instance();
return cache;
}
+
+ private static void validateName(String name) {
+ if (!RE_NAME.matcher(name).matches()) {
+ throw new IllegalArgumentException(String.format("Illegal character in name: '%s'.", name));
+ }
+ }
+
+ protected static void validateNCName(String ncname) {
+ if (!RE_NCNAME.matcher(ncname).matches()) {
+ throw new IllegalArgumentException(String.format("Illegal character in local name: '%s'.", ncname));
+ }
+ }
+
+ private static void validateQName(String qname) {
+ if (!RE_QNAME.matcher(qname).matches()) {
+ throw new IllegalArgumentException(String.format("Illegal character in qualified name: '%s'.", qname));
+ }
+ }
}
Index: dom4j/src/java/org/dom4j/tree/QNameCache.java
===================================================================
--- dom4j.orig/src/java/org/dom4j/tree/QNameCache.java
+++ dom4j/src/java/org/dom4j/tree/QNameCache.java
@@ -164,6 +164,8 @@ public class QNameCache {
if (index < 0) {
return get(qualifiedName, Namespace.get(uri));
+ } else if (index == 0){
+ throw new IllegalArgumentException("Qualified name cannot start with ':'.");
} else {
String name = qualifiedName.substring(index + 1);
String prefix = qualifiedName.substring(0, index);
Index: dom4j/src/test/org/dom4j/AllowedCharsTest.java
===================================================================
--- /dev/null
+++ dom4j/src/test/org/dom4j/AllowedCharsTest.java
@@ -0,0 +1,78 @@
+package org.dom4j;^M
+^M
+import org.testng.annotations.Test;^M
+^M
+/**^M
+ * @author Filip Jirsak^M
+ */^M
+public class AllowedCharsTest {^M
+ @Test^M
+ public void localName() {^M
+ QName.get("element");^M
+ QName.get(":element");^M
+ QName.get("elem:ent");^M
+ }^M
+^M
+ @Test(expectedExceptions = IllegalArgumentException.class)^M
+ public void localNameFail() {^M
+ QName.get("!element");^M
+ }^M
+^M
+ @Test^M
+ public void qname() {^M
+ QName.get("element", "http://example.com/namespace");^M
+ QName.get("ns:element", "http://example.com/namespace");^M
+ }^M
+^M
+ @Test(expectedExceptions = IllegalArgumentException.class)^M
+ public void qnameFail1() {^M
+ QName.get("ns:elem:ent", "http://example.com/namespace");^M
+ }^M
+^M
+ @Test(expectedExceptions = IllegalArgumentException.class)^M
+ public void qnameFail2() {^M
+ QName.get(":nselement", "http://example.com/namespace");^M
+ }^M
+^M
+ @Test(expectedExceptions = IllegalArgumentException.class)^M
+ public void createElementLT() {^M
+ DocumentHelper.createElement("element<name");^M
+ }^M
+^M
+ @Test(expectedExceptions = IllegalArgumentException.class)^M
+ public void createElementGT() {^M
+ DocumentHelper.createElement("element>name");^M
+ }^M
+^M
+ @Test(expectedExceptions = IllegalArgumentException.class)^M
+ public void createElementAmpersand() {^M
+ DocumentHelper.createElement("element&name");^M
+ }^M
+^M
+ @Test(expectedExceptions = IllegalArgumentException.class)^M
+ public void addElement() {^M
+ Element root = DocumentHelper.createElement("root");^M
+ root.addElement("element>name");^M
+ }^M
+^M
+ @Test(expectedExceptions = IllegalArgumentException.class)^M
+ public void addElementQualified() {^M
+ Element root = DocumentHelper.createElement("root");^M
+ root.addElement("element>name", "http://example.com/namespace");^M
+ }^M
+^M
+ @Test(expectedExceptions = IllegalArgumentException.class)^M
+ public void addElementQualifiedPrefix() {^M
+ Element root = DocumentHelper.createElement("root");^M
+ root.addElement("ns:element>name", "http://example.com/namespace");^M
+ }^M
+^M
+ @Test(expectedExceptions = IllegalArgumentException.class)^M
+ public void addElementPrefix() {^M
+ Element root = DocumentHelper.createElement("root");^M
+ root.addElement("ns>:element", "http://example.com/namespace");^M
+ }^M
+^M
+ //TODO It is illegal to create element or attribute with namespace prefix and empty namespace IRI.^M
+ //See https://www.w3.org/TR/2006/REC-xml-names11-20060816/#scoping^M
+}^M

View File

@ -1,484 +0,0 @@
From a8228522a99a02146106672a34c104adbda5c658 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Filip=20Jirs=C3=A1k?= <filip@jirsak.org>
Date: Sat, 11 Apr 2020 19:06:44 +0200
Subject: [PATCH] SAXReader uses system default XMLReader with its defaults.
New factory method SAXReader.createDefault() sets more secure defaults.
---
src/java/org/dom4j/DocumentHelper.java | 65 +-
src/java/org/dom4j/io/SAXHelper.java | 37 +-
src/java/org/dom4j/io/SAXReader.java | 1824 ++++++++++---------
3 files changed, 973 insertions(+), 953 deletions(-)
Index: dom4j/src/java/org/dom4j/io/SAXHelper.java
===================================================================
--- dom4j.orig/src/java/org/dom4j/io/SAXHelper.java
+++ dom4j/src/java/org/dom4j/io/SAXHelper.java
@@ -13,6 +13,8 @@ import org.xml.sax.SAXNotSupportedExcept
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
+import javax.xml.parsers.SAXParserFactory;
+
/**
* <p>
* <code>SAXHelper</code> contains some helper methods for working with SAX
@@ -59,9 +61,18 @@ class SAXHelper {
}
/**
- * Creats a default XMLReader via the org.xml.sax.driver system property or
+ * Creates a default XMLReader via the org.xml.sax.driver system property or
* JAXP if the system property is not set.
*
+ * This method internally calls {@link SAXParserFactory}{@code .newInstance().newSAXParser().getXMLReader()} or {@link XMLReaderFactory#createXMLReader()}.
+ * Be sure to configure returned reader if the default configuration does not suit you. Consider setting the following properties:
+ *
+ * <pre>
+ * reader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
+ * reader.setFeature("http://xml.org/sax/features/external-general-entities", false);
+ * reader.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
+ * </pre>
+ *
* @param validating
* DOCUMENT ME!
*
Index: dom4j/src/java/org/dom4j/io/SAXReader.java
===================================================================
--- dom4j.orig/src/java/org/dom4j/io/SAXReader.java
+++ dom4j/src/java/org/dom4j/io/SAXReader.java
@@ -30,6 +30,8 @@ import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
import org.xml.sax.helpers.XMLReaderFactory;
+import javax.xml.parsers.SAXParserFactory;
+
/**
* <p>
* <code>SAXReader</code> creates a DOM4J tree from SAX parsing events.
@@ -135,17 +137,76 @@ public class SAXReader {
/** The SAX filter used to filter SAX events */
private XMLFilter xmlFilter;
+ public static SAXReader createDefault() {
+ SAXReader reader = new SAXReader();
+ try {
+ reader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
+ reader.setFeature("http://xml.org/sax/features/external-general-entities", false);
+ reader.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
+ } catch (SAXException e) {
+ // nothing to do, incompatible reader
+ }
+ return reader;
+ }
+
+ /**
+ * This method internally calls {@link SAXParserFactory}{@code .newInstance().newSAXParser().getXMLReader()} or {@link XMLReaderFactory#createXMLReader()}.
+ * Be sure to configure returned reader if the default configuration does not suit you. Consider setting the following properties:
+ *
+ * <pre>
+ * reader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
+ * reader.setFeature("http://xml.org/sax/features/external-general-entities", false);
+ * reader.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
+ * </pre>
+ */
public SAXReader() {
}
+ /**
+ * This method internally calls {@link SAXParserFactory}{@code .newInstance().newSAXParser().getXMLReader()} or {@link XMLReaderFactory#createXMLReader()}.
+ * Be sure to configure returned reader if the default configuration does not suit you. Consider setting the following properties:
+ *
+ * <pre>
+ * reader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
+ * reader.setFeature("http://xml.org/sax/features/external-general-entities", false);
+ * reader.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
+ * </pre>
+ *
+ * @param validating
+ */
public SAXReader(boolean validating) {
this.validating = validating;
}
+ /**
+ * This method internally calls {@link SAXParserFactory}{@code .newInstance().newSAXParser().getXMLReader()} or {@link XMLReaderFactory#createXMLReader()}.
+ * Be sure to configure returned reader if the default configuration does not suit you. Consider setting the following properties:
+ *
+ * <pre>
+ * reader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
+ * reader.setFeature("http://xml.org/sax/features/external-general-entities", false);
+ * reader.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
+ * </pre>
+ *
+ * @param factory
+ */
public SAXReader(DocumentFactory factory) {
this.factory = factory;
}
+ /**
+ * This method internally calls {@link SAXParserFactory}{@code .newInstance().newSAXParser().getXMLReader()} or {@link XMLReaderFactory#createXMLReader()}.
+ * Be sure to configure returned reader if the default configuration does not suit you. Consider setting the following properties:
+ *
+ * <pre>
+ * reader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
+ * reader.setFeature("http://xml.org/sax/features/external-general-entities", false);
+ * reader.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
+ * </pre>
+ *
+ * @param factory
+ * @param validating
+ */
public SAXReader(DocumentFactory factory, boolean validating) {
this.factory = factory;
this.validating = validating;
@@ -185,14 +246,10 @@ public class SAXReader {
* this method is to correctly configure an XMLReader object instance and
* call the {@link #setXMLReader(XMLReader)}method
*
- * @param name
- * is the SAX property name
- * @param value
- * is the value of the SAX property
- *
- * @throws SAXException
- * if the XMLReader could not be created or the property could
- * not be changed.
+ * @param name is the SAX property name
+ * @param value is the value of the SAX property
+ * @throws SAXException if the XMLReader could not be created or the property could
+ * not be changed.
*/
public void setProperty(String name, Object value) throws SAXException {
getXMLReader().setProperty(name, value);
@@ -205,14 +262,10 @@ public class SAXReader {
* calling this method is to correctly configure an XMLReader object
* instance and call the {@link #setXMLReader(XMLReader)}method
*
- * @param name
- * is the SAX feature name
- * @param value
- * is the value of the SAX feature
- *
- * @throws SAXException
- * if the XMLReader could not be created or the feature could
- * not be changed.
+ * @param name is the SAX feature name
+ * @param value is the value of the SAX feature
+ * @throws SAXException if the XMLReader could not be created or the feature could
+ * not be changed.
*/
public void setFeature(String name, boolean value) throws SAXException {
getXMLReader().setFeature(name, value);
@@ -223,13 +276,9 @@ public class SAXReader {
* Reads a Document from the given <code>File</code>
* </p>
*
- * @param file
- * is the <code>File</code> to read from.
- *
+ * @param file is the <code>File</code> to read from.
* @return the newly created Document instance
- *
- * @throws DocumentException
- * if an error occurs during parsing.
+ * @throws DocumentException if an error occurs during parsing.
*/
public Document read(File file) throws DocumentException {
try {
@@ -272,13 +321,9 @@ public class SAXReader {
* Reads a Document from the given <code>URL</code> using SAX
* </p>
*
- * @param url
- * <code>URL</code> to read from.
- *
+ * @param url <code>URL</code> to read from.
* @return the newly created Document instance
- *
- * @throws DocumentException
- * if an error occurs during parsing.
+ * @throws DocumentException if an error occurs during parsing.
*/
public Document read(URL url) throws DocumentException {
String systemID = url.toExternalForm();
@@ -304,13 +349,9 @@ public class SAXReader {
* String} to denote the source of the document.
* </p>
*
- * @param systemId
- * is a URL for a document or a file name.
- *
+ * @param systemId is a URL for a document or a file name.
* @return the newly created Document instance
- *
- * @throws DocumentException
- * if an error occurs during parsing.
+ * @throws DocumentException if an error occurs during parsing.
*/
public Document read(String systemId) throws DocumentException {
InputSource source = new InputSource(systemId);
@@ -326,13 +367,9 @@ public class SAXReader {
* Reads a Document from the given stream using SAX
* </p>
*
- * @param in
- * <code>InputStream</code> to read from.
- *
+ * @param in <code>InputStream</code> to read from.
* @return the newly created Document instance
- *
- * @throws DocumentException
- * if an error occurs during parsing.
+ * @throws DocumentException if an error occurs during parsing.
*/
public Document read(InputStream in) throws DocumentException {
InputSource source = new InputSource(in);
@@ -348,13 +385,9 @@ public class SAXReader {
* Reads a Document from the given <code>Reader</code> using SAX
* </p>
*
- * @param reader
- * is the reader for the input
- *
+ * @param reader is the reader for the input
* @return the newly created Document instance
- *
- * @throws DocumentException
- * if an error occurs during parsing.
+ * @throws DocumentException if an error occurs during parsing.
*/
public Document read(Reader reader) throws DocumentException {
InputSource source = new InputSource(reader);
@@ -370,15 +403,10 @@ public class SAXReader {
* Reads a Document from the given stream using SAX
* </p>
*
- * @param in
- * <code>InputStream</code> to read from.
- * @param systemId
- * is the URI for the input
- *
+ * @param in <code>InputStream</code> to read from.
+ * @param systemId is the URI for the input
* @return the newly created Document instance
- *
- * @throws DocumentException
- * if an error occurs during parsing.
+ * @throws DocumentException if an error occurs during parsing.
*/
public Document read(InputStream in, String systemId)
throws DocumentException {
@@ -396,13 +424,9 @@ public class SAXReader {
* Reads a Document from the given <code>Reader</code> using SAX
* </p>
*
- * @param reader
- * is the reader for the input
- * @param systemId
- * is the URI for the input
- *
+ * @param reader is the reader for the input
+ * @param systemId is the URI for the input
* @return the newly created Document instance
- *
* @throws DocumentException
* if an error occurs during parsing.
*/
@@ -422,13 +446,9 @@ public class SAXReader {
* Reads a Document from the given <code>InputSource</code> using SAX
* </p>
*
- * @param in
- * <code>InputSource</code> to read from.
- *
+ * @param in <code>InputSource</code> to read from.
* @return the newly created Document instance
- *
- * @throws DocumentException
- * if an error occurs during parsing.
+ * @throws DocumentException if an error occurs during parsing.
*/
public Document read(InputSource in) throws DocumentException {
try {
@@ -695,8 +715,7 @@ public class SAXReader {
/**
* Sets the entity resolver used to resolve entities.
*
- * @param entityResolver
- * DOCUMENT ME!
+ * @param entityResolver DOCUMENT ME!
*/
public void setEntityResolver(EntityResolver entityResolver) {
this.entityResolver = entityResolver;
@@ -706,9 +725,7 @@ public class SAXReader {
* DOCUMENT ME!
*
* @return the <code>XMLReader</code> used to parse SAX events
- *
- * @throws SAXException
- * DOCUMENT ME!
+ * @throws SAXException DOCUMENT ME!
*/
public XMLReader getXMLReader() throws SAXException {
if (xmlReader == null) {
@@ -721,8 +738,7 @@ public class SAXReader {
/**
* Sets the <code>XMLReader</code> used to parse SAX events
*
- * @param reader
- * is the <code>XMLReader</code> to parse SAX events
+ * @param reader is the <code>XMLReader</code> to parse SAX events
*/
public void setXMLReader(XMLReader reader) {
this.xmlReader = reader;
@@ -742,8 +758,7 @@ public class SAXReader {
/**
* Sets encoding used for InputSource (null means system default encoding)
*
- * @param encoding
- * is encoding used for InputSource
+ * @param encoding is encoding used for InputSource
*/
public void setEncoding(String encoding) {
this.encoding = encoding;
@@ -753,12 +768,9 @@ public class SAXReader {
* Sets the class name of the <code>XMLReader</code> to be used to parse
* SAX events.
*
- * @param xmlReaderClassName
- * is the class name of the <code>XMLReader</code> to parse SAX
- * events
- *
- * @throws SAXException
- * DOCUMENT ME!
+ * @param xmlReaderClassName is the class name of the <code>XMLReader</code>
+ * to parse SAX events
+ * @throws SAXException DOCUMENT ME!
*/
public void setXMLReaderClassName(String xmlReaderClassName)
throws SAXException {
@@ -769,11 +781,9 @@ public class SAXReader {
* Adds the <code>ElementHandler</code> to be called when the specified
* path is encounted.
*
- * @param path
- * is the path to be handled
- * @param handler
- * is the <code>ElementHandler</code> to be called by the event
- * based processor.
+ * @param path is the path to be handled
+ * @param handler is the <code>ElementHandler</code> to be called by the event
+ * based processor.
*/
public void addHandler(String path, ElementHandler handler) {
getDispatchHandler().addHandler(path, handler);
@@ -783,8 +793,7 @@ public class SAXReader {
* Removes the <code>ElementHandler</code> from the event based processor,
* for the specified path.
*
- * @param path
- * is the path to remove the <code>ElementHandler</code> for.
+ * @param path is the path to remove the <code>ElementHandler</code> for.
*/
public void removeHandler(String path) {
getDispatchHandler().removeHandler(path);
@@ -795,9 +804,8 @@ public class SAXReader {
* registered, this will set a default <code>ElementHandler</code> to be
* called for any path which does <b>NOT </b> have a handler registered.
*
- * @param handler
- * is the <code>ElementHandler</code> to be called by the event
- * based processor.
+ * @param handler is the <code>ElementHandler</code> to be called by the event
+ * based processor.
*/
public void setDefaultHandler(ElementHandler handler) {
getDispatchHandler().setDefaultHandler(handler);
@@ -824,8 +832,7 @@ public class SAXReader {
/**
* Sets the SAX filter to be used when filtering SAX events
*
- * @param filter
- * is the SAX filter to use or null to disable filtering
+ * @param filter is the SAX filter to use or null to disable filtering
*/
public void setXMLFilter(XMLFilter filter) {
this.xmlFilter = filter;
@@ -838,9 +845,7 @@ public class SAXReader {
* Installs any XMLFilter objects required to allow the SAX event stream to
* be filtered and preprocessed before it gets to dom4j.
*
- * @param reader
- * DOCUMENT ME!
- *
+ * @param reader DOCUMENT ME!
* @return the new XMLFilter if applicable or the original XMLReader if no
* filter is being used.
*/
@@ -886,9 +891,7 @@ public class SAXReader {
* XMLReader objects
*
* @return DOCUMENT ME!
- *
- * @throws SAXException
- * DOCUMENT ME!
+ * @throws SAXException DOCUMENT ME!
*/
protected XMLReader createXMLReader() throws SAXException {
return SAXHelper.createXMLReader(isValidating());
@@ -897,13 +900,9 @@ public class SAXReader {
/**
* Configures the XMLReader before use
*
- * @param reader
- * DOCUMENT ME!
- * @param handler
- * DOCUMENT ME!
- *
- * @throws DocumentException
- * DOCUMENT ME!
+ * @param reader DOCUMENT ME!
+ * @param handler DOCUMENT ME!
+ * @throws DocumentException DOCUMENT ME!
*/
protected void configureReader(XMLReader reader, DefaultHandler handler)
throws DocumentException {
@@ -918,10 +917,11 @@ public class SAXReader {
SAXHelper.setParserProperty(reader, SAX_DECL_HANDLER, handler);
}
- // configure namespace support
- SAXHelper.setParserFeature(reader, SAX_NAMESPACES, true);
+ // // configure namespace support
+ // SAXHelper.setParserFeature(reader, SAX_NAMESPACES, true);
- SAXHelper.setParserFeature(reader, SAX_NAMESPACE_PREFIXES, false);
+ // string interning
+ // SAXHelper.setParserFeature(reader, SAX_NAMESPACE_PREFIXES, false);
// string interning
SAXHelper.setParserFeature(reader, SAX_STRING_INTERNING,
@@ -936,8 +936,8 @@ public class SAXReader {
* includeExternalParameterEntities );
*/
// use Locator2 if possible
- SAXHelper.setParserFeature(reader,
- "http://xml.org/sax/features/use-locator2", true);
+ // SAXHelper.setParserFeature(reader,
+ // "http://xml.org/sax/features/use-locator2", true);
try {
// configure validation support
@@ -960,9 +960,7 @@ public class SAXReader {
/**
* Factory Method to allow user derived SAXContentHandler objects to be used
*
- * @param reader
- * DOCUMENT ME!
- *
+ * @param reader DOCUMENT ME!
* @return DOCUMENT ME!
*/
protected SAXContentHandler createContentHandler(XMLReader reader) {

113
dom4j-build.xml Normal file
View File

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="dom4j" default="package" basedir=".">
<!-- ====================================================================== -->
<!-- Build environment properties -->
<!-- ====================================================================== -->
<property name="project.groupId" value="org.dom4j"/>
<property name="project.artifactId" value="dom4j"/>
<property name="project.version" value="2.0.3"/>
<property name="compiler.source" value="1.8"/>
<property name="compiler.target" value="${compiler.source}"/>
<property name="build.finalName" value="${project.artifactId}-${project.version}"/>
<property name="build.dir" value="target"/>
<property name="build.outputDir" value="${build.dir}/classes"/>
<property name="build.srcDir" value="src/main/java"/>
<property name="build.resourceDir" value="src/main/resources"/>
<property name="reporting.outputDirectory" value="${build.dir}/site"/>
<!-- ====================================================================== -->
<!-- Defining classpaths -->
<!-- ====================================================================== -->
<path id="build.classpath">
<fileset dir="lib">
<include name="**/*"/>
</fileset>
</path>
<!-- ====================================================================== -->
<!-- Cleaning up target -->
<!-- ====================================================================== -->
<target name="clean" description="Clean the output directory">
<delete dir="${build.dir}"/>
</target>
<!-- ====================================================================== -->
<!-- Compilation target -->
<!-- ====================================================================== -->
<target name="compile" description="Compile the code">
<mkdir dir="${build.outputDir}"/>
<javac destdir="${build.outputDir}"
nowarn="false"
debug="true"
encoding="utf-8"
optimize="false"
deprecation="true"
target="${compiler.target}"
verbose="false"
fork="false"
source="${compiler.source}">
<src>
<pathelement location="${build.srcDir}"/>
</src>
<classpath refid="build.classpath"/>
</javac>
</target>
<!-- ====================================================================== -->
<!-- Javadoc target -->
<!-- ====================================================================== -->
<target name="javadoc" description="Generates the Javadoc of the application">
<javadoc sourcepath="${build.srcDir}"
packagenames="*"
destdir="${reporting.outputDirectory}/apidocs"
access="protected"
encoding="utf-8"
source="${compiler.source}"
verbose="false"
version="true"
use="true"
author="true"
splitindex="false"
nodeprecated="false"
nodeprecatedlist="false"
notree="false"
noindex="false"
nohelp="false"
nonavbar="false"
serialwarn="false"
charset="ISO-8859-1"
linksource="false"
breakiterator="false">
<classpath refid="build.classpath"/>
</javadoc>
</target>
<!-- ====================================================================== -->
<!-- Package target -->
<!-- ====================================================================== -->
<target name="package" depends="compile" description="Package the application">
<jar jarfile="${build.dir}/${build.finalName}.jar"
compress="true"
index="false"
basedir="${build.outputDir}"
excludes="**/package.html"/>
</target>
<!-- ====================================================================== -->
<!-- A dummy target for the package named after the type it creates -->
<!-- ====================================================================== -->
<target name="jar" depends="package" description="Builds the jar for the application"/>
</project>

View File

@ -1,14 +0,0 @@
Index: dom4j/build.xml
===================================================================
--- dom4j.orig/build.xml
+++ dom4j/build.xml
@@ -146,9 +146,6 @@
source="8"
deprecation="${deprecation}"
classpathref="compile.classpath">
- <exclude name="org/dom4j/datatype/**"/>
- <exclude name="org/dom4j/io/STAXEventReader.java"/>
- <exclude name="org/dom4j/io/STAXEventWriter.java"/>
</javac>
</target>

View File

@ -1,19 +0,0 @@
--- dom4j/build.xml 2009-05-12 15:04:18.000000000 +0200
+++ dom4j/build.xml 2018-07-10 10:51:51.814095475 +0200
@@ -224,7 +224,6 @@
doctitle="${Name}"
bottom="Copyright &#169; ${year} MetaStuff Ltd. All Rights Reserved. Hosted by &lt;p&gt; &lt;img src='http://sourceforge.net/sflogo.php?group_id=16035' width='88' height='31' border='0' alt='SourceForge Logo' /&gt;"
stylesheetfile="${doc.dir}/style/javadoc.css">
- <link href="file:///usr/share/doc/classpath-doc/api"/>
</javadoc>
<mkdir dir="${build.apidocs}"/>
@@ -240,8 +239,6 @@
doctitle="${Name}"
bottom="Copyright &#169; ${year} MetaStuff Ltd. All Rights Reserved. Hosted by &lt;p&gt; &lt;img src='http://sourceforge.net/sflogo.php?group_id=16035' width='88' height='31' border='0' alt='SourceForge Logo' /&gt;"
stylesheetfile="${doc.dir}/style/javadoc.css">
- <link href="file:///usr/share/doc/classpath-doc/api"/>
- <link href="${build.javadocs}"/>
</javadoc>
</target>

View File

@ -1,37 +0,0 @@
--- dom4j/build.xml 2009-05-12 15:04:18.000000000 +0200
+++ dom4j/build.xml 2017-09-11 13:36:05.252661089 +0200
@@ -142,8 +142,8 @@
destdir="${build.dest}"
debug="${debug}"
optimize="${optimize}"
- target="1.3"
- source="1.3"
+ target="8"
+ source="8"
deprecation="${deprecation}"
classpathref="compile.classpath">
<exclude name="org/dom4j/datatype/**"/>
@@ -195,6 +195,7 @@
<mkdir dir="${build.javadocs}"/>
<javadoc packagenames="${packages}"
sourcepath="${build.src}"
+ source="8"
destdir="${build.javadocs}"
author="true"
version="true"
@@ -214,6 +215,7 @@
<mkdir dir="${build.javadocs}"/>
<javadoc packagenames="${packages}"
sourcepath="${build.src}"
+ source="8"
destdir="${build.javadocs}"
author="true"
version="true"
@@ -230,6 +232,7 @@
<mkdir dir="${build.apidocs}"/>
<javadoc packagenames="${api.packages}"
sourcepath="${build.src}"
+ source="8"
destdir="${build.apidocs}"
author="true"
version="true"

View File

@ -2,6 +2,7 @@
# spec file for package dom4j
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2000-2007, JPackage Project
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -17,207 +18,99 @@
Name: dom4j
Version: 1.6.1
Version: 2.0.3
Release: 0
Summary: JarJar of dom4j for JBoss
License: Apache-1.1
Group: Development/Libraries/Java
URL: https://www.dom4j.org/
#Source0: dom4j-1.6.1.tar.gz
# Debian sources don't need a proprietary msv for build, so that's why I used them
# svn co svn://svn.debian.org/svn/pkg-java/trunk/dom4j
# rm dom4j/docs/xref/org/dom4j/tree/ConcurrentReaderHashMap.html
# rm dom4j/docs/clover/org/dom4j/tree/ConcurrentReaderHashMap.html
# #bnc501764
# rm dom4j/lib/tools/clover.license
# tar --exclude-vcs -cjf dom4j-1.6.1-debian.tar.bz2 dom4j/
Source0: dom4j-1.6.1-debian.tar.bz2
Source1: dom4j_rundemo.sh
Source2: https://repo1.maven.org/maven2/dom4j/dom4j/1.6.1/dom4j-1.6.1.pom
Patch0: dom4j-1.6.1-bug1618750.patch
Patch1: dom4j-sourcetarget.patch
Patch2: dom4j-javadoc.patch
# PATCH-FIX-UPSTREAM bsc#1105443 CVE-2018-1000632
Patch3: dom4j-CVE-2018-1000632.patch
# PATCH-FIX-OPENSUSE bsc#1123158 Don't disable STAX and datatypes
Patch4: dom4j-enable-stax-datatypes.patch
# PATCH-FIX-UPSTREAM bsc#1169760 CVE-2020-10683 XML Externl Entity vulnerability in default SAX parser
Patch5: dom4j-CVE-2020-10683.patch
BuildRequires: ant >= 1.6.5
BuildRequires: ant-apache-resolver
BuildRequires: ant-junit
BuildRequires: bea-stax
Summary: Open Source XML framework for Java
License: BSD-3-Clause
URL: https://dom4j.github.io/
Source0: %{name}-%{version}.tar.xz
Source1: https://repo1.maven.org/maven2/org/%{name}/%{name}/%{version}/%{name}-%{version}.pom
Source2: %{name}-build.xml
BuildRequires: ant
BuildRequires: fdupes
BuildRequires: glassfish-jaxb-api
BuildRequires: isorelax
BuildRequires: java-devel >= 1.6
# Needed for maven conversions
BuildRequires: javapackages-local
BuildRequires: javapackages-tools
BuildRequires: jaxen-bootstrap >= 1.1
BuildRequires: junit
BuildRequires: junitperf
BuildRequires: relaxngDatatype
BuildRequires: stax_1_0_api
BuildRequires: ws-jaxme
BuildRequires: xalan-j2 >= 2.7
BuildRequires: xerces-j2
BuildRequires: xpp2
BuildRequires: xpp3
Requires: bea-stax
Requires: glassfish-jaxb-api
Requires: isorelax
Requires: java >= 1.6.0
Requires: jaxen >= 1.1
Requires: relaxngDatatype
Requires: stax_1_0_api
Requires: ws-jaxme
Requires: xalan-j2
Requires: xerces-j2
Requires: xpp2
Requires: xpp3
#Requires: jaxp = 1.2
Requires(post): javapackages-tools
Requires(postun):javapackages-tools
BuildRequires: jaxen-bootstrap
Obsoletes: %{name}-manual < %{version}
BuildArch: noarch
%description
dom4j is an easy to use Open Source XML, XPath and XSLT framework for
Java using the Java Collections Framework. dom4j allows you to read,
dom4j is an Open Source XML framework for Java. dom4j allows you to read,
write, navigate, create and modify XML documents. dom4j integrates with
DOM, SAX and JAXP and is seamlessly integrated with full XPath support.
DOM and SAX and is seamlessly integrated with full XPath support.
%package demo
Summary: XML, XPath and XSLT library for Java
Summary: Open Source XML framework for Java - demo
Group: Development/Libraries/Java
Requires: %{name} = %{version}
%description demo
dom4j is an easy to use Open Source XML, XPath and XSLT framework for
Java using the Java Collections Framework. dom4j allows you to read,
dom4j is an Open Source XML framework for Java. dom4j allows you to read,
write, navigate, create and modify XML documents. dom4j integrates with
DOM, SAX and JAXP and is seamlessly integrated with full XPath support.
%package manual
Summary: JarJar of dom4j for JBoss
Group: Development/Libraries/Java
%description manual
dom4j is an easy to use Open Source XML, XPath and XSLT framework for
Java using the Java Collections Framework. dom4j allows you to read,
write, navigate, create and modify XML documents. dom4j integrates with
DOM, SAX and JAXP and is seamlessly integrated with full XPath support.
DOM and SAX and is seamlessly integrated with full XPath support.
%package javadoc
Summary: XML, XPath and XSLT library for Java
Group: Development/Libraries/Java
Summary: Javadoc for %{name}
%description javadoc
dom4j is an easy to use Open Source XML, XPath and XSLT framework for
Java using the Java Collections Framework. dom4j allows you to read,
write, navigate, create and modify XML documents. dom4j integrates with
DOM, SAX and JAXP and is seamlessly integrated with full XPath support.
Javadoc for %{name}.
%prep
%setup -q -n %{name}
# replace run.sh
cp %{SOURCE1} run.sh
cp %{SOURCE2} pom.xml
%pom_add_dep javax.xml.bind:jaxb-api pom.xml "<optional>true</optional>"
%autosetup -p1
rm -f src/test/org/dom4j/xpath/MatrixConcatTest.java
# won't succeed in headless environment
rm src/test/org/dom4j/bean/BeansTest.java
# FIXME Bug in Xalan 2.6 -- reactivate with Xalan 2.7
#rm src/test/org/dom4j/XPathExamplesTest.java
# fix for deleted jars
sed -i -e '/unjar/d' -e 's|,cookbook/\*\*,|,|' build.xml
# FIXME: (yyang): failed in JDK6
rm -f src/test/org/dom4j/ThreadingTest.java
# FIXME: (yyang): failed in JDK6, maybe failed to load russArticle.xml because it's russian encoding
rm -f src/test/org/dom4j/io/StaxTest.java
%patch0 -p1 -b .bug1618750
%patch1 -p1 -b .sourcetarget
%patch2 -p1 -b .javadoc
%patch3 -p1
%patch4 -p1
%patch5 -p1
perl -pi -e 's/\r//g' LICENSE.txt docs/clover/*.css docs/style/*.css docs/xref/*.css docs/xref-test/*.css src/doc/style/*.css docs/benchmarks/xpath/*.java
cp %{SOURCE1} pom.xml
cp %{SOURCE2} build.xml
pushd lib
ln -sf $(build-classpath xpp2)
ln -sf $(build-classpath relaxngDatatype)
ln -sf $(build-classpath jaxme/jaxmeapi)
#ln -sf $(build-classpath msv-xsdlib)
#ln -sf $(build-classpath msv-msv)
ln -sf $(build-classpath jaxen)
ln -sf $(build-classpath bea-stax-api)
pushd test
ln -sf $(build-classpath bea-stax-ri)
ln -sf $(build-classpath junitperf)
ln -sf $(build-classpath junit)
popd
ln -sf $(build-classpath xpp3)
pushd tools
ln -sf $(build-classpath jaxme/jaxmexs)
ln -sf $(build-classpath xalan-j2)
ln -sf $(build-classpath xalan-j2-serializer)
ln -sf $(build-classpath jaxme/jaxmejs)
ln -sf $(build-classpath isorelax)
ln -sf $(build-classpath jaxme/jaxme2)
ln -sf $(build-classpath xerces-j2)
popd
popd
# Remove xpp2 support
rm -r src/main/java/org/dom4j/xpp
rm src/main/java/org/dom4j/io/XPPReader.java
# Remove datatype code which depends on msv
rm -r src/main/java/org/dom4j/datatype
%pom_remove_dep net.java.dev.msv:xsdlib
# Remove xpp3 support
rm src/main/java/org/dom4j/io/XPP3Reader.java
%pom_remove_dep xpp3:xpp3
%pom_remove_dep pull-parser:pull-parser
%pom_remove_dep javax.xml.stream:stax-api
%build
export CLASSPATH=$(build-classpath \
glassfish-jaxb-api \
jaxen relaxngDatatype xpp3 xpp2)
export OPT_JAR_LIST="junit ant/ant-junit"
rm -rf src/java/org/dom4j/datatype
ant package release-javadoc
mkdir -p lib
build-jar-repository -s lib jaxen glassfish-jaxb-api
%{ant} jar javadoc
%install
# jars
install -d -m 755 %{buildroot}%{_javadir}
install -d -m 755 %{buildroot}%{_datadir}/maven2/poms
cp -p build/%{name}.jar %{buildroot}%{_javadir}/%{name}.jar
mkdir -p %{buildroot}/%{_mavenpomdir}
install -m 644 pom.xml %{buildroot}/%{_mavenpomdir}/JPP-%{name}.pom
%add_maven_depmap JPP-%{name}.pom %{name}.jar -a "org.dom4j:dom4j"
# jar
install -dm 0755 %{buildroot}%{_javadir}
install -pm 0644 target/%{name}-%{version}.jar %{buildroot}%{_javadir}/%{name}.jar
# pom
install -dm 0755 %{buildroot}%{_mavenpomdir}
%{mvn_install_pom} pom.xml %{buildroot}%{_mavenpomdir}/%{name}.pom
%add_maven_depmap %{name}.pom %{name}.jar -a %{name}:%{name}
# javadoc
mkdir -p %{buildroot}%{_javadocdir}/%{name}
cp -pr build/doc/javadoc/* %{buildroot}%{_javadocdir}/%{name}
# manual
mkdir -p %{buildroot}%{_docdir}/%{name}-%{version}
rm -rf docs/apidocs
cp -pr docs/* %{buildroot}%{_docdir}/%{name}-%{version}
install -dm 0755 %{buildroot}%{_javadocdir}/%{name}
cp -r target/site/apidocs %{buildroot}%{_javadocdir}/%{name}
%fdupes -s %{buildroot}%{_javadocdir}
# demo
mkdir -p %{buildroot}%{_datadir}/%{name}/classes/org/dom4j
install -dm 0755 %{buildroot}%{_datadir}/%{name}/src
cp -pr xml %{buildroot}%{_datadir}/%{name}
mkdir -p %{buildroot}%{_datadir}/%{name}/src
cp -pr src/samples %{buildroot}%{_datadir}/%{name}/src
#cp -pr build/classes/org/dom4j/samples $RPM_BUILD_ROOT%%{_datadir}/%%{name}/classes/org/dom4j
install -m 0755 run.sh %{buildroot}%{_datadir}/%{name}
%fdupes -s %{buildroot}%{_javadocdir}/%{name}
%fdupes -s %{buildroot}%{_docdir}/%{name}-%{version}
cp -pr src/example %{buildroot}%{_datadir}/%{name}/src
%fdupes -s %{buildroot}%{_datadir}/%{name}
%files -f .mfiles
%license LICENSE.txt
%files javadoc
%defattr(0644,root,root,0755)
%{_javadocdir}/%{name}
%files manual
%defattr(0644,root,root,0755)
%{_docdir}/%{name}-%{version}
%license LICENSE
%doc README.md
%files demo
%defattr(-,root,root,0755)
%{_datadir}/%{name}
%files javadoc
%license LICENSE
%{_javadocdir}/%{name}
%changelog

View File

@ -1,128 +0,0 @@
#!/bin/sh
XMLFMTOPS="-indentSize 2 -trimText -newlines"
if [ $# -eq 0 ]; then
echo PullParserDemo
echo ./run.sh samples.PullParserDemo $XMLFMTOPS xml/web.xml
echo ./run.sh samples.PullParserDemo $XMLFMTOPS xml/fibo.xml
echo
echo SAXDemo
echo ./run.sh samples.SAXDemo $XMLFMTOPS xml/web.xml
echo ./run.sh samples.SAXDemo $XMLFMTOPS xml/test/test_schema.xml
echo ./run.sh samples.SAXDemo $XMLFMTOPS xml/xhtml/xhtml-basic.xml
echo ./run.sh samples.SAXDemo $XMLFMTOPS xml/contents.xml
echo ./run.sh samples.SAXDemo $XMLFMTOPS xml/cdata.xml
echo ./run.sh -Dorg.xml.sax.driver=org.apache.xerces.parsers.SAXParser samples.SAXDemo $XMLFMTOPS xml/cdata.xml
echo ./run.sh -Dorg.xml.sax.driver=xml.aelfred2.SAXDriver samples.SAXDemo $XMLFMTOPS xml/cdata.xml
echo ./run.sh samples.SAXDemo $XMLFMTOPS xml/testPI.xml
echo ./run.sh samples.SAXDemo $XMLFMTOPS xml/namespaces.xml
echo ./run.sh samples.SAXDemo $XMLFMTOPS xml/testNamespaces.xml
echo ./run.sh samples.SAXDemo $XMLFMTOPS xml/inline.xml
echo
echo DOMDemo
echo ./run.sh samples.dom.DOMDemo xml/contents.xml
echo
echo SAXDOMDemo
echo ./run.sh samples.dom.SAXDOMDemo xml/contents.xml
echo
echo VisitorDemo
echo ./run.sh samples.VisitorDemo xml/cdata.xml
echo
echo CountDemo
echo ./run.sh samples.CountDemo xml/fibo.xml
echo
echo CreateXMLDemo
echo ./run.sh samples.CreateXMLDemo
echo
echo HTMLWriterDemo
echo ./run.sh samples.HTMLWriterDemo xml/xhtml.xml
echo
echo PerformanceTest
echo ./run.sh -Xprof samples.performance.PerformanceSupport xml/periodic_table.xml org.dom4j.DocumentFactory 10
echo ./run.sh -Xprof -Dorg.xml.sax.driver=org.apache.xerces.parsers.SAXParser samples.performance.PerformanceSupport xml/periodic_table.xml org.dom4j.DocumentFactory 10
echo ./run.sh -Xprof -Dorg.xml.sax.driver=xml.aelfred2.SAXDriver samples.performance.PerformanceSupport xml/periodic_table.xml org.dom4j.DocumentFactory 10
echo ./run.sh -Xprof samples.performance.PerformanceSupport xml/much_ado.xml org.dom4j.DocumentFactory 10
echo ./run.sh -Xprof -Dorg.xml.sax.driver=org.apache.xerces.parsers.SAXParser samples.performance.PerformanceSupport xml/much_ado.xml org.dom4j.DocumentFactory 10
echo ./run.sh -Xprof -Dorg.xml.sax.driver=xml.aelfred2.SAXDriver samples.performance.PerformanceSupport xml/much_ado.xml org.dom4j.DocumentFactory 10
echo
echo XPathDemo
echo ./run.sh samples.XPathDemo xml/web.xml //servlet/servlet-class
echo ./run.sh samples.XPathDemo xml/much_ado.xml //ACT/TITLE
echo
echo XSLTDemo
echo ./run.sh samples.XSLTDemo xml/nitf/sample.xml xml/nitf/ashtml.xsl
echo
echo XSLTNativeDOMDemo
echo ./run.sh samples.dom.XSLTNativeDOMDemo xml/nitf/sample.xml xml/nitf/ashtml.xsl
echo
echo LargeDocumentDemo
echo ./run.sh samples.LargeDocumentDemo xml/much_ado.xml /PLAY/ACT
echo
echo LargeDocumentDemo2
echo ./run.sh samples.LargeDocumentDemo2 xml/much_ado.xml
echo
echo LinkCheckerDemo
echo ./run.sh samples.LinkChecker xml/xhtml/xhtml-basic.xml
echo
echo BeanDemo
echo ./run.sh samples.bean.BeanDemo xml/bean/gui.xml
echo
echo SAXValidatorDemo
echo ./run.sh samples.validate.SAXValidatorDemo xml/nitf/invalid.xml
echo
echo VisitorDemo
echo ./run.sh -Dorg.dom4j.factory=org.dom4j.datatype.DatatypeDocumentFactory samples.VisitorDemo xml/schema/personal-schema.xml
echo
echo JTableDemo
echo ./run.sh samples.swing.JTableDemo xml/web.xml
echo
echo JTableTool
echo ./run.sh samples.swing.JTableTool xml/swing/tableForAtoms.xml xml/periodic_table.xml
echo
echo JTreeDemo
echo ./run.sh samples.swing.JTreeDemo xml/web.xml
exit 0
fi
if [ -z "$JAVA_HOME" ] ; then
JAVA=`which java`
if [ -z "$JAVA" ] ; then
echo "Cannot find JAVA. Please set your PATH."
exit 1
fi
JAVA_BIN=`dirname $JAVA`
JAVA_HOME=$JAVA_BIN/..
fi
JAVA=$JAVA_HOME/bin/java
CLASSPATH=`build-classpath \
dom4j \
xpp2 \
fop \
xerces-j2 \
msv-relaxngDatatype \
msv-xsdlib \
msv-isorelax \
msv \
jaxen \
junit \
junitperf \
saxpath \
xalan-j2 \
xml-commons-apis \
avalon-framework \
avalon-logkit \
`:$CLASSPATH
BOOTCLASSPATH=`build-classpath \
xml-commons-apis \
xerces-j2 \
xalan-j2 \
`
CLASSPATH=classes:$CLASSPATH:$JAVA_HOME/lib/tools.jar
$JAVA -Xbootclasspath/p:$BOOTCLASSPATH -classpath $CLASSPATH "$@"