Accepting request 1105589 from Java:packages
add bootstrap flavour OBS-URL: https://build.opensuse.org/request/show/1105589 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/dom4j?expand=0&rev=28
This commit is contained in:
commit
9a48340ed9
713
0001-no-jaxen-dom4.patch
Normal file
713
0001-no-jaxen-dom4.patch
Normal file
@ -0,0 +1,713 @@
|
||||
From b494798add23c21d68b1dd54e8929095396516bb Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch>
|
||||
Date: Wed, 23 Aug 2023 20:33:23 +0200
|
||||
Subject: [PATCH] no-jaxen-dom4
|
||||
|
||||
---
|
||||
src/main/java/org/dom4j/DocumentFactory.java | 22 +-
|
||||
src/main/java/org/dom4j/DocumentHelper.java | 16 -
|
||||
.../java/org/dom4j/tree/AbstractNode.java | 4 -
|
||||
.../org/dom4j/util/ProxyDocumentFactory.java | 4 -
|
||||
.../java/org/dom4j/xpath/DefaultXPath.java | 409 ------------------
|
||||
.../java/org/dom4j/xpath/XPathPattern.java | 164 -------
|
||||
6 files changed, 2 insertions(+), 617 deletions(-)
|
||||
delete mode 100644 src/main/java/org/dom4j/xpath/DefaultXPath.java
|
||||
delete mode 100644 src/main/java/org/dom4j/xpath/XPathPattern.java
|
||||
|
||||
diff --git a/src/main/java/org/dom4j/DocumentFactory.java b/src/main/java/org/dom4j/DocumentFactory.java
|
||||
index 9aaaa11..fa2bbb8 100644
|
||||
--- a/src/main/java/org/dom4j/DocumentFactory.java
|
||||
+++ b/src/main/java/org/dom4j/DocumentFactory.java
|
||||
@@ -27,8 +27,6 @@ import org.dom4j.tree.DefaultText;
|
||||
import org.dom4j.tree.QNameCache;
|
||||
import org.dom4j.util.SimpleSingleton;
|
||||
import org.dom4j.util.SingletonStrategy;
|
||||
-import org.dom4j.xpath.DefaultXPath;
|
||||
-import org.dom4j.xpath.XPathPattern;
|
||||
import org.jaxen.VariableContext;
|
||||
|
||||
/**
|
||||
@@ -219,7 +217,7 @@ public class DocumentFactory implements Serializable {
|
||||
*/
|
||||
public XPath createXPath(String xpathExpression)
|
||||
throws InvalidXPathException {
|
||||
- DefaultXPath xpath = new DefaultXPath(xpathExpression);
|
||||
+ XPath xpath = createXPath(xpathExpression);
|
||||
|
||||
if (xpathNamespaceURIs != null) {
|
||||
xpath.setNamespaceURIs(xpathNamespaceURIs);
|
||||
@@ -291,22 +289,6 @@ public class DocumentFactory implements Serializable {
|
||||
// return new DefaultXPath( xpathFilterExpression );
|
||||
}
|
||||
|
||||
- /**
|
||||
- * <p>
|
||||
- * <code>createPattern</code> parses the given XPath expression to create
|
||||
- * an XSLT style {@link Pattern}instance which can then be used in an XSLT
|
||||
- * processing model.
|
||||
- * </p>
|
||||
- *
|
||||
- * @param xpathPattern
|
||||
- * is the XPath pattern expression to create
|
||||
- *
|
||||
- * @return a new <code>Pattern</code> instance
|
||||
- */
|
||||
- public Pattern createPattern(String xpathPattern) {
|
||||
- return new XPathPattern(xpathPattern);
|
||||
- }
|
||||
-
|
||||
// Properties
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@@ -445,4 +427,4 @@ public class DocumentFactory implements Serializable {
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
|
||||
- */
|
||||
\ No newline at end of file
|
||||
+ */
|
||||
diff --git a/src/main/java/org/dom4j/DocumentHelper.java b/src/main/java/org/dom4j/DocumentHelper.java
|
||||
index 865a51a..040770c 100644
|
||||
--- a/src/main/java/org/dom4j/DocumentHelper.java
|
||||
+++ b/src/main/java/org/dom4j/DocumentHelper.java
|
||||
@@ -160,22 +160,6 @@ public final class DocumentHelper {
|
||||
return getDocumentFactory().createXPathFilter(xpathFilterExpression);
|
||||
}
|
||||
|
||||
- /**
|
||||
- * <p>
|
||||
- * <code>createPattern</code> parses the given XPath expression to create
|
||||
- * an XSLT style {@link Pattern}instance which can then be used in an XSLT
|
||||
- * processing model.
|
||||
- * </p>
|
||||
- *
|
||||
- * @param xpathPattern
|
||||
- * is the XPath pattern expression to create
|
||||
- *
|
||||
- * @return a new <code>Pattern</code> instance
|
||||
- */
|
||||
- public static Pattern createPattern(String xpathPattern) {
|
||||
- return getDocumentFactory().createPattern(xpathPattern);
|
||||
- }
|
||||
-
|
||||
/**
|
||||
* <p>
|
||||
* <code>selectNodes</code> performs the given XPath expression on the
|
||||
diff --git a/src/main/java/org/dom4j/tree/AbstractNode.java b/src/main/java/org/dom4j/tree/AbstractNode.java
|
||||
index 3957c29..e8b14c7 100644
|
||||
--- a/src/main/java/org/dom4j/tree/AbstractNode.java
|
||||
+++ b/src/main/java/org/dom4j/tree/AbstractNode.java
|
||||
@@ -206,10 +206,6 @@ public abstract class AbstractNode implements Node, Cloneable, Serializable {
|
||||
return getDocumentFactory().createXPathFilter(patternText);
|
||||
}
|
||||
|
||||
- public Pattern createPattern(String patternText) {
|
||||
- return getDocumentFactory().createPattern(patternText);
|
||||
- }
|
||||
-
|
||||
public Node asXPathResult(Element parent) {
|
||||
if (supportsParent()) {
|
||||
return this;
|
||||
diff --git a/src/main/java/org/dom4j/util/ProxyDocumentFactory.java b/src/main/java/org/dom4j/util/ProxyDocumentFactory.java
|
||||
index 65624be..8bf7e57 100644
|
||||
--- a/src/main/java/org/dom4j/util/ProxyDocumentFactory.java
|
||||
+++ b/src/main/java/org/dom4j/util/ProxyDocumentFactory.java
|
||||
@@ -146,10 +146,6 @@ public abstract class ProxyDocumentFactory {
|
||||
return proxy.createXPathFilter(xpathFilterExpression);
|
||||
}
|
||||
|
||||
- public Pattern createPattern(String xpathPattern) {
|
||||
- return proxy.createPattern(xpathPattern);
|
||||
- }
|
||||
-
|
||||
// Implementation methods
|
||||
// -------------------------------------------------------------------------
|
||||
protected DocumentFactory getProxy() {
|
||||
diff --git a/src/main/java/org/dom4j/xpath/DefaultXPath.java b/src/main/java/org/dom4j/xpath/DefaultXPath.java
|
||||
deleted file mode 100644
|
||||
index f81eec5..0000000
|
||||
--- a/src/main/java/org/dom4j/xpath/DefaultXPath.java
|
||||
+++ /dev/null
|
||||
@@ -1,409 +0,0 @@
|
||||
-/*
|
||||
- * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
|
||||
- *
|
||||
- * This software is open source.
|
||||
- * See the bottom of this file for the licence.
|
||||
- */
|
||||
-
|
||||
-package org.dom4j.xpath;
|
||||
-
|
||||
-import java.io.Serializable;
|
||||
-import java.util.Collections;
|
||||
-import java.util.Comparator;
|
||||
-import java.util.HashMap;
|
||||
-import java.util.HashSet;
|
||||
-import java.util.Iterator;
|
||||
-import java.util.List;
|
||||
-import java.util.Map;
|
||||
-
|
||||
-import org.dom4j.InvalidXPathException;
|
||||
-import org.dom4j.Node;
|
||||
-import org.dom4j.NodeFilter;
|
||||
-import org.dom4j.XPathException;
|
||||
-
|
||||
-import org.jaxen.FunctionContext;
|
||||
-import org.jaxen.JaxenException;
|
||||
-import org.jaxen.NamespaceContext;
|
||||
-import org.jaxen.SimpleNamespaceContext;
|
||||
-import org.jaxen.VariableContext;
|
||||
-import org.jaxen.XPath;
|
||||
-import org.jaxen.dom4j.Dom4jXPath;
|
||||
-
|
||||
-/**
|
||||
- * <p>
|
||||
- * Default implementation of {@link org.dom4j.XPath}which uses the <a
|
||||
- * href="http://jaxen.org">Jaxen </a> project.
|
||||
- * </p>
|
||||
- *
|
||||
- * @author bob mcwhirter
|
||||
- * @author <a href="mailto:jstrachan@apache.org">James Strachan </a>
|
||||
- */
|
||||
-public class DefaultXPath implements org.dom4j.XPath, NodeFilter, Serializable {
|
||||
- private String text;
|
||||
-
|
||||
- private XPath xpath;
|
||||
-
|
||||
- private NamespaceContext namespaceContext;
|
||||
-
|
||||
- /**
|
||||
- * Construct an XPath
|
||||
- *
|
||||
- * @param text
|
||||
- * DOCUMENT ME!
|
||||
- *
|
||||
- * @throws InvalidXPathException
|
||||
- * DOCUMENT ME!
|
||||
- */
|
||||
- public DefaultXPath(String text) throws InvalidXPathException {
|
||||
- this.text = text;
|
||||
- this.xpath = parse(text);
|
||||
- }
|
||||
-
|
||||
- public String toString() {
|
||||
- return "[XPath: " + xpath + "]";
|
||||
- }
|
||||
-
|
||||
- // XPath interface
|
||||
-
|
||||
- /**
|
||||
- * Retrieve the textual XPath string used to initialize this Object
|
||||
- *
|
||||
- * @return The XPath string
|
||||
- */
|
||||
- public String getText() {
|
||||
- return text;
|
||||
- }
|
||||
-
|
||||
- public FunctionContext getFunctionContext() {
|
||||
- return xpath.getFunctionContext();
|
||||
- }
|
||||
-
|
||||
- public void setFunctionContext(FunctionContext functionContext) {
|
||||
- xpath.setFunctionContext(functionContext);
|
||||
- }
|
||||
-
|
||||
- public NamespaceContext getNamespaceContext() {
|
||||
- return namespaceContext;
|
||||
- }
|
||||
-
|
||||
- public void setNamespaceURIs(Map<String, String> map) {
|
||||
- setNamespaceContext(new SimpleNamespaceContext(map));
|
||||
- }
|
||||
-
|
||||
- public void setNamespaceContext(NamespaceContext namespaceContext) {
|
||||
- this.namespaceContext = namespaceContext;
|
||||
- xpath.setNamespaceContext(namespaceContext);
|
||||
- }
|
||||
-
|
||||
- public VariableContext getVariableContext() {
|
||||
- return xpath.getVariableContext();
|
||||
- }
|
||||
-
|
||||
- public void setVariableContext(VariableContext variableContext) {
|
||||
- xpath.setVariableContext(variableContext);
|
||||
- }
|
||||
-
|
||||
- public Object evaluate(Object context) {
|
||||
- try {
|
||||
- setNSContext(context);
|
||||
-
|
||||
- List<Object> answer = xpath.selectNodes(context);
|
||||
-
|
||||
- if ((answer != null) && (answer.size() == 1)) {
|
||||
- return answer.get(0);
|
||||
- }
|
||||
-
|
||||
- return answer;
|
||||
- } catch (JaxenException e) {
|
||||
- handleJaxenException(e);
|
||||
-
|
||||
- return null;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- public Object selectObject(Object context) {
|
||||
- return evaluate(context);
|
||||
- }
|
||||
-
|
||||
- public List<Node> selectNodes(Object context) {
|
||||
- try {
|
||||
- setNSContext(context);
|
||||
-
|
||||
- return (List<Node>) xpath.selectNodes(context);
|
||||
- } catch (JaxenException e) {
|
||||
- handleJaxenException(e);
|
||||
-
|
||||
- return Collections.emptyList();
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- public List<Node> selectNodes(Object context, org.dom4j.XPath sortXPath) {
|
||||
- List<Node> answer = selectNodes(context);
|
||||
- sortXPath.sort(answer);
|
||||
-
|
||||
- return answer;
|
||||
- }
|
||||
-
|
||||
- public List<Node> selectNodes(Object context, org.dom4j.XPath sortXPath,
|
||||
- boolean distinct) {
|
||||
- List<Node> answer = selectNodes(context);
|
||||
- sortXPath.sort(answer, distinct);
|
||||
-
|
||||
- return answer;
|
||||
- }
|
||||
-
|
||||
- public Node selectSingleNode(Object context) {
|
||||
- try {
|
||||
- setNSContext(context);
|
||||
-
|
||||
- Object answer = xpath.selectSingleNode(context);
|
||||
-
|
||||
- if (answer instanceof Node) {
|
||||
- return (Node) answer;
|
||||
- }
|
||||
-
|
||||
- if (answer == null) {
|
||||
- return null;
|
||||
- }
|
||||
-
|
||||
- throw new XPathException("The result of the XPath expression is "
|
||||
- + "not a Node. It was: " + answer + " of type: "
|
||||
- + answer.getClass().getName());
|
||||
- } catch (JaxenException e) {
|
||||
- handleJaxenException(e);
|
||||
-
|
||||
- return null;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- public String valueOf(Object context) {
|
||||
- try {
|
||||
- setNSContext(context);
|
||||
-
|
||||
- return xpath.stringValueOf(context);
|
||||
- } catch (JaxenException e) {
|
||||
- handleJaxenException(e);
|
||||
-
|
||||
- return "";
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- public Number numberValueOf(Object context) {
|
||||
- try {
|
||||
- setNSContext(context);
|
||||
-
|
||||
- return xpath.numberValueOf(context);
|
||||
- } catch (JaxenException e) {
|
||||
- handleJaxenException(e);
|
||||
-
|
||||
- return null;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- public boolean booleanValueOf(Object context) {
|
||||
- try {
|
||||
- setNSContext(context);
|
||||
-
|
||||
- return xpath.booleanValueOf(context);
|
||||
- } catch (JaxenException e) {
|
||||
- handleJaxenException(e);
|
||||
-
|
||||
- return false;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * <p>
|
||||
- * <code>sort</code> sorts the given List of Nodes using this XPath
|
||||
- * expression as a {@link Comparator}.
|
||||
- * </p>
|
||||
- *
|
||||
- * @param list
|
||||
- * is the list of Nodes to sort
|
||||
- */
|
||||
- public void sort(List<Node> list) {
|
||||
- sort(list, false);
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * <p>
|
||||
- * <code>sort</code> sorts the given List of Nodes using this XPath
|
||||
- * expression as a {@link Comparator}and optionally removing duplicates.
|
||||
- * </p>
|
||||
- *
|
||||
- * @param list
|
||||
- * is the list of Nodes to sort
|
||||
- * @param distinct
|
||||
- * if true then duplicate values (using the sortXPath for
|
||||
- * comparisions) will be removed from the List
|
||||
- */
|
||||
- public void sort(List<Node> list, boolean distinct) {
|
||||
- if ((list != null) && !list.isEmpty()) {
|
||||
- int size = list.size();
|
||||
- HashMap<Node, Object> sortValues = new HashMap<Node, Object>(size);
|
||||
-
|
||||
- for (Node node : list) {
|
||||
- Object expression = getCompareValue(node);
|
||||
- sortValues.put(node, expression);
|
||||
- }
|
||||
-
|
||||
- sort(list, sortValues);
|
||||
-
|
||||
- if (distinct) {
|
||||
- removeDuplicates(list, sortValues);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- public boolean matches(Node node) {
|
||||
- try {
|
||||
- setNSContext(node);
|
||||
-
|
||||
- List<Object> answer = xpath.selectNodes(node);
|
||||
-
|
||||
- if ((answer != null) && (answer.size() > 0)) {
|
||||
- Object item = answer.get(0);
|
||||
-
|
||||
- if (item instanceof Boolean) {
|
||||
- return (Boolean) item;
|
||||
- }
|
||||
-
|
||||
- return answer.contains(node);
|
||||
- }
|
||||
-
|
||||
- return false;
|
||||
- } catch (JaxenException e) {
|
||||
- handleJaxenException(e);
|
||||
-
|
||||
- return false;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Sorts the list based on the sortValues for each node
|
||||
- *
|
||||
- * @param list
|
||||
- * DOCUMENT ME!
|
||||
- * @param sortValues
|
||||
- * DOCUMENT ME!
|
||||
- */
|
||||
- protected void sort(List<Node> list, final Map<Node, Object> sortValues) {
|
||||
- Collections.sort(list, new Comparator<Node>() {
|
||||
- public int compare(Node n1, Node n2) {
|
||||
- Object o1 = sortValues.get(n1);
|
||||
- Object o2 = sortValues.get(n2);
|
||||
-
|
||||
- if (o1 == o2) {
|
||||
- return 0;
|
||||
- } else if (o1 instanceof Comparable) {
|
||||
- Comparable<Object> c1 = (Comparable<Object>) o1;
|
||||
-
|
||||
- return c1.compareTo(o2);
|
||||
- } else if (o1 == null) {
|
||||
- return 1;
|
||||
- } else if (o2 == null) {
|
||||
- return -1;
|
||||
- } else {
|
||||
- return o1.equals(o2) ? 0 : (-1);
|
||||
- }
|
||||
- }
|
||||
- });
|
||||
- }
|
||||
-
|
||||
- // Implementation methods
|
||||
-
|
||||
- /**
|
||||
- * Removes items from the list which have duplicate values
|
||||
- *
|
||||
- * @param list
|
||||
- * DOCUMENT ME!
|
||||
- * @param sortValues
|
||||
- * DOCUMENT ME!
|
||||
- */
|
||||
- protected void removeDuplicates(List<Node> list, Map<Node, Object> sortValues) {
|
||||
- // remove distinct
|
||||
- HashSet<Object> distinctValues = new HashSet<Object>();
|
||||
-
|
||||
- for (Iterator<Node> iter = list.iterator(); iter.hasNext();) {
|
||||
- Node node = iter.next();
|
||||
- Object value = sortValues.get(node);
|
||||
-
|
||||
- if (distinctValues.contains(value)) {
|
||||
- iter.remove();
|
||||
- } else {
|
||||
- distinctValues.add(value);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * DOCUMENT ME!
|
||||
- *
|
||||
- * @param node
|
||||
- * DOCUMENT ME!
|
||||
- *
|
||||
- * @return the node expression used for sorting comparisons
|
||||
- */
|
||||
- protected Object getCompareValue(Node node) {
|
||||
- return valueOf(node);
|
||||
- }
|
||||
-
|
||||
- protected static XPath parse(String text) {
|
||||
- try {
|
||||
- return new Dom4jXPath(text);
|
||||
- } catch (JaxenException e) {
|
||||
- throw new InvalidXPathException(text, e.getMessage());
|
||||
- } catch (RuntimeException e) {
|
||||
- }
|
||||
-
|
||||
- throw new InvalidXPathException(text);
|
||||
- }
|
||||
-
|
||||
- protected void setNSContext(Object context) {
|
||||
- if (namespaceContext == null) {
|
||||
- xpath.setNamespaceContext(DefaultNamespaceContext.create(context));
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- protected void handleJaxenException(JaxenException exception)
|
||||
- throws XPathException {
|
||||
- throw new XPathException(text, exception);
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-/*
|
||||
- * Redistribution and use of this software and associated documentation
|
||||
- * ("Software"), with or without modification, are permitted provided that the
|
||||
- * following conditions are met:
|
||||
- *
|
||||
- * 1. Redistributions of source code must retain copyright statements and
|
||||
- * notices. Redistributions must also contain a copy of this document.
|
||||
- *
|
||||
- * 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
- * this list of conditions and the following disclaimer in the documentation
|
||||
- * and/or other materials provided with the distribution.
|
||||
- *
|
||||
- * 3. The name "DOM4J" must not be used to endorse or promote products derived
|
||||
- * from this Software without prior written permission of MetaStuff, Ltd. For
|
||||
- * written permission, please contact dom4j-info@metastuff.com.
|
||||
- *
|
||||
- * 4. Products derived from this Software may not be called "DOM4J" nor may
|
||||
- * "DOM4J" appear in their names without prior written permission of MetaStuff,
|
||||
- * Ltd. DOM4J is a registered trademark of MetaStuff, Ltd.
|
||||
- *
|
||||
- * 5. Due credit should be given to the DOM4J Project - http://www.dom4j.org
|
||||
- *
|
||||
- * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS ``AS IS'' AND
|
||||
- * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
- * ARE DISCLAIMED. IN NO EVENT SHALL METASTUFF, LTD. OR ITS CONTRIBUTORS BE
|
||||
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
- * POSSIBILITY OF SUCH DAMAGE.
|
||||
- *
|
||||
- * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
|
||||
- */
|
||||
diff --git a/src/main/java/org/dom4j/xpath/XPathPattern.java b/src/main/java/org/dom4j/xpath/XPathPattern.java
|
||||
deleted file mode 100644
|
||||
index 65d656b..0000000
|
||||
--- a/src/main/java/org/dom4j/xpath/XPathPattern.java
|
||||
+++ /dev/null
|
||||
@@ -1,164 +0,0 @@
|
||||
-/*
|
||||
- * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
|
||||
- *
|
||||
- * This software is open source.
|
||||
- * See the bottom of this file for the licence.
|
||||
- */
|
||||
-
|
||||
-package org.dom4j.xpath;
|
||||
-
|
||||
-import java.util.ArrayList;
|
||||
-import java.util.Collections;
|
||||
-
|
||||
-import org.dom4j.InvalidXPathException;
|
||||
-import org.dom4j.Node;
|
||||
-import org.dom4j.XPathException;
|
||||
-
|
||||
-import org.jaxen.Context;
|
||||
-import org.jaxen.ContextSupport;
|
||||
-import org.jaxen.JaxenException;
|
||||
-import org.jaxen.SimpleNamespaceContext;
|
||||
-import org.jaxen.SimpleVariableContext;
|
||||
-import org.jaxen.VariableContext;
|
||||
-import org.jaxen.XPathFunctionContext;
|
||||
-import org.jaxen.dom4j.DocumentNavigator;
|
||||
-import org.jaxen.pattern.Pattern;
|
||||
-import org.jaxen.pattern.PatternParser;
|
||||
-import org.jaxen.saxpath.SAXPathException;
|
||||
-
|
||||
-/**
|
||||
- * <p>
|
||||
- * <code>XPathPattern</code> is an implementation of Pattern which uses an
|
||||
- * XPath xpath.
|
||||
- * </p>
|
||||
- *
|
||||
- * @author <a href="mailto:jstrachan@apache.org">James Strachan </a>
|
||||
- * @version $Revision: 1.18 $
|
||||
- */
|
||||
-public class XPathPattern implements org.dom4j.rule.Pattern {
|
||||
- private String text;
|
||||
-
|
||||
- private Pattern pattern;
|
||||
-
|
||||
- private Context context;
|
||||
-
|
||||
- public XPathPattern(Pattern pattern) {
|
||||
- this.pattern = pattern;
|
||||
- this.text = pattern.getText();
|
||||
- this.context = new Context(getContextSupport());
|
||||
- }
|
||||
-
|
||||
- public XPathPattern(String text) {
|
||||
- this.text = text;
|
||||
- this.context = new Context(getContextSupport());
|
||||
-
|
||||
- try {
|
||||
- this.pattern = PatternParser.parse(text);
|
||||
- } catch (SAXPathException e) {
|
||||
- throw new InvalidXPathException(text, e.getMessage());
|
||||
- } catch (RuntimeException e) {
|
||||
- throw new InvalidXPathException(text);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- public boolean matches(Node node) {
|
||||
- try {
|
||||
- context.setNodeSet(Collections.singletonList(node));
|
||||
-
|
||||
- return pattern.matches(node, context);
|
||||
- } catch (JaxenException e) {
|
||||
- handleJaxenException(e);
|
||||
-
|
||||
- return false;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- public String getText() {
|
||||
- return text;
|
||||
- }
|
||||
-
|
||||
- public double getPriority() {
|
||||
- return pattern.getPriority();
|
||||
- }
|
||||
-
|
||||
- public org.dom4j.rule.Pattern[] getUnionPatterns() {
|
||||
- Pattern[] patterns = pattern.getUnionPatterns();
|
||||
-
|
||||
- if (patterns != null) {
|
||||
- int size = patterns.length;
|
||||
- XPathPattern[] answer = new XPathPattern[size];
|
||||
-
|
||||
- for (int i = 0; i < size; i++) {
|
||||
- answer[i] = new XPathPattern(patterns[i]);
|
||||
- }
|
||||
-
|
||||
- return answer;
|
||||
- }
|
||||
-
|
||||
- return null;
|
||||
- }
|
||||
-
|
||||
- public short getMatchType() {
|
||||
- return pattern.getMatchType();
|
||||
- }
|
||||
-
|
||||
- public String getMatchesNodeName() {
|
||||
- return pattern.getMatchesNodeName();
|
||||
- }
|
||||
-
|
||||
- public void setVariableContext(VariableContext variableContext) {
|
||||
- context.getContextSupport().setVariableContext(variableContext);
|
||||
- }
|
||||
-
|
||||
- public String toString() {
|
||||
- return "[XPathPattern: text: " + text + " Pattern: " + pattern + "]";
|
||||
- }
|
||||
-
|
||||
- protected ContextSupport getContextSupport() {
|
||||
- return new ContextSupport(new SimpleNamespaceContext(),
|
||||
- XPathFunctionContext.getInstance(),
|
||||
- new SimpleVariableContext(), DocumentNavigator.getInstance());
|
||||
- }
|
||||
-
|
||||
- protected void handleJaxenException(JaxenException exception)
|
||||
- throws XPathException {
|
||||
- throw new XPathException(text, exception);
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-/*
|
||||
- * Redistribution and use of this software and associated documentation
|
||||
- * ("Software"), with or without modification, are permitted provided that the
|
||||
- * following conditions are met:
|
||||
- *
|
||||
- * 1. Redistributions of source code must retain copyright statements and
|
||||
- * notices. Redistributions must also contain a copy of this document.
|
||||
- *
|
||||
- * 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
- * this list of conditions and the following disclaimer in the documentation
|
||||
- * and/or other materials provided with the distribution.
|
||||
- *
|
||||
- * 3. The name "DOM4J" must not be used to endorse or promote products derived
|
||||
- * from this Software without prior written permission of MetaStuff, Ltd. For
|
||||
- * written permission, please contact dom4j-info@metastuff.com.
|
||||
- *
|
||||
- * 4. Products derived from this Software may not be called "DOM4J" nor may
|
||||
- * "DOM4J" appear in their names without prior written permission of MetaStuff,
|
||||
- * Ltd. DOM4J is a registered trademark of MetaStuff, Ltd.
|
||||
- *
|
||||
- * 5. Due credit should be given to the DOM4J Project - http://www.dom4j.org
|
||||
- *
|
||||
- * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS ``AS IS'' AND
|
||||
- * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
- * ARE DISCLAIMED. IN NO EVENT SHALL METASTUFF, LTD. OR ITS CONTRIBUTORS BE
|
||||
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
- * POSSIBILITY OF SUCH DAMAGE.
|
||||
- *
|
||||
- * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
|
||||
- */
|
||||
--
|
||||
2.41.0
|
||||
|
3
_multibuild
Normal file
3
_multibuild
Normal file
@ -0,0 +1,3 @@
|
||||
<multibuild>
|
||||
<flavor>bootstrap</flavor>
|
||||
</multibuild>
|
15
_service
Normal file
15
_service
Normal 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.1.4</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>
|
@ -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 {
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d72427a11a23df97f8957331269df7fde4fcc982ac3b9d399a49e4df8598b94a
|
||||
size 1962425
|
221
dom4j-1.6.1.pom
221
dom4j-1.6.1.pom
@ -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.1.4.pom
Normal file
77
dom4j-2.1.4.pom
Normal 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.1.4</version>
|
||||
<name>dom4j</name>
|
||||
<description>flexible XML framework for Java</description>
|
||||
<url>http://dom4j.github.io/</url>
|
||||
<licenses>
|
||||
<license>
|
||||
<name>Plexus</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.1.10</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>
|
BIN
dom4j-2.1.4.tar.xz
(Stored with Git LFS)
Normal file
BIN
dom4j-2.1.4.tar.xz
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -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
|
@ -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
113
dom4j-build.xml
Normal 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.1.4"/>
|
||||
|
||||
<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>
|
@ -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>
|
||||
|
@ -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 © ${year} MetaStuff Ltd. All Rights Reserved. Hosted by <p> <img src='http://sourceforge.net/sflogo.php?group_id=16035' width='88' height='31' border='0' alt='SourceForge Logo' />"
|
||||
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 © ${year} MetaStuff Ltd. All Rights Reserved. Hosted by <p> <img src='http://sourceforge.net/sflogo.php?group_id=16035' width='88' height='31' border='0' alt='SourceForge Logo' />"
|
||||
stylesheetfile="${doc.dir}/style/javadoc.css">
|
||||
- <link href="file:///usr/share/doc/classpath-doc/api"/>
|
||||
- <link href="${build.javadocs}"/>
|
||||
</javadoc>
|
||||
</target>
|
||||
|
@ -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"
|
@ -1,3 +1,65 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Aug 24 10:08:25 UTC 2023 - Fridrich Strba <fstrba@suse.com>
|
||||
|
||||
- Make a separate flavour for a minimal dom4j-bootstrap package
|
||||
used to build jaxen and full dom4j
|
||||
- Added patch:
|
||||
* 0001-no-jaxen-dom4.patch
|
||||
* for the bootstrap package, patch out the code that requires
|
||||
jaxen with dom4j support to build
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Aug 24 04:59:20 UTC 2023 - Fridrich Strba <fstrba@suse.com>
|
||||
|
||||
- Upgrade to upstream version 2.1.4
|
||||
* Improvements and potentially breaking changes
|
||||
+ Added new factory method
|
||||
org.dom4j.io.SAXReader.createDefault(). It has more secure
|
||||
defaults than new SAXReader(), which uses system
|
||||
XMLReaderFactory.createXMLReader() or
|
||||
SAXParserFactory.newInstance().newSAXParser().
|
||||
+ If you use some optional dependency of dom4j (for example
|
||||
Jaxen, xsdlib etc.), you need to specify an explicit
|
||||
dependency on it in your project. They are no longer marked as
|
||||
a mandatory transitive dependency by dom4j.
|
||||
+ Following SAX parser features are disabled by default in
|
||||
DocumentHelper.parse() for security reasons (they were enabled
|
||||
in previous versions):
|
||||
° http://xml.org/sax/properties/external-general-entities
|
||||
° http://xml.org/sax/properties/external-parameter-entities
|
||||
* Other changes:
|
||||
+ updated pull-parser version
|
||||
+ Reuse the writeAttribute method in writeAttributes
|
||||
+ support build on OS with non-UTF8 as default charset
|
||||
+ Gradle: add an automatic module name
|
||||
+ Use Correct License Name "Plexus"
|
||||
+ Possible vulnerability of DocumentHelper.parseText() to XML
|
||||
injection
|
||||
+ CVS directories left in the source tree
|
||||
+ XMLWriter does not escape supplementary unicode characters
|
||||
correctly
|
||||
+ writer.writeOpen(x) doesn't write namespaces
|
||||
+ concurrency problem with QNameCache
|
||||
+ all dependencies are optional
|
||||
+ SAXReader: hardcoded namespace features
|
||||
+ validate QNames
|
||||
+ StringIndexOutOfBoundsException in
|
||||
XMLWriter.writeElementContent()
|
||||
+ TreeNode has grown some generics
|
||||
+ QName serialization fix
|
||||
+ DocumentException initialize with nested exception
|
||||
+ Accidentally occurring error in a multi-threaded test
|
||||
+ compatibility with W3C DOM Level 3
|
||||
+ use Java generics
|
||||
- Removed patches:
|
||||
* dom4j-1.6.1-bug1618750.patch
|
||||
* dom4j-CVE-2018-1000632.patch
|
||||
* dom4j-CVE-2020-10683.patch
|
||||
* dom4j-enable-stax-datatypes.patch
|
||||
* dom4j-javadoc.patch
|
||||
* dom4j-sourcetarget.patch
|
||||
+ not needed with this version
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jul 24 19:38:26 UTC 2023 - Fridrich Strba <fstrba@suse.com>
|
||||
|
||||
@ -32,7 +94,7 @@ Fri Jan 25 11:10:16 UTC 2019 - Cédric Bosdonnat <cbosdonnat@suse.com>
|
||||
|
||||
- Build STAXEventReader, STAXEventWriter and the data types.
|
||||
[bsc#1123158]
|
||||
* Added patch dom4j-enable-stax-datatypes.patch
|
||||
* Added patch dom4j-enable-stax-datatypes.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Sep 18 10:31:28 UTC 2018 - pmonrealgonzalez@suse.com
|
||||
|
268
dom4j.spec
268
dom4j.spec
@ -1,7 +1,8 @@
|
||||
#
|
||||
# spec file for package dom4j
|
||||
# spec file
|
||||
#
|
||||
# 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
|
||||
@ -16,208 +17,133 @@
|
||||
#
|
||||
|
||||
|
||||
Name: dom4j
|
||||
Version: 1.6.1
|
||||
%global base_name dom4j
|
||||
%global flavor @BUILD_FLAVOR@%{nil}
|
||||
%if "%{flavor}" == "bootstrap"
|
||||
%bcond_without bootstrap
|
||||
%else
|
||||
%bcond_with bootstrap
|
||||
%endif
|
||||
Version: 2.1.4
|
||||
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: %{base_name}-%{version}.tar.xz
|
||||
Source1: https://repo1.maven.org/maven2/org/%{base_name}/%{base_name}/%{version}/%{base_name}-%{version}.pom
|
||||
Source2: %{base_name}-build.xml
|
||||
Patch0: 0001-no-jaxen-dom4.patch
|
||||
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: javapackages-local >= 6
|
||||
Obsoletes: %{base_name}-manual < %{version}
|
||||
BuildArch: noarch
|
||||
%if %{with bootstrap}
|
||||
Name: %{base_name}-bootstrap
|
||||
%else
|
||||
Name: %{base_name}
|
||||
%endif
|
||||
%if %{without bootstrap}
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: jaxen
|
||||
Conflicts: %{base_name}-bootstrap
|
||||
Obsoletes: %{base_name}-bootstrap
|
||||
%else
|
||||
BuildRequires: jaxen-bootstrap
|
||||
Conflicts: %{base_name}
|
||||
%endif
|
||||
|
||||
%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.
|
||||
|
||||
%if %{without bootstrap}
|
||||
%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}
|
||||
Requires: %{base_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 %{base_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 %{base_name}.
|
||||
%endif
|
||||
|
||||
%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>"
|
||||
%setup -q -n %{base_name}-%{version}
|
||||
%if %{with bootstrap}
|
||||
%patch0 -p1
|
||||
%endif
|
||||
|
||||
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/%{base_name}-%{version}.jar %{buildroot}%{_javadir}/%{base_name}.jar
|
||||
|
||||
%if %{without bootstrap}
|
||||
# pom
|
||||
install -dm 0755 %{buildroot}%{_mavenpomdir}
|
||||
%{mvn_install_pom} pom.xml %{buildroot}%{_mavenpomdir}/%{base_name}.pom
|
||||
%add_maven_depmap %{base_name}.pom %{base_name}.jar -a %{base_name}:%{base_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}/%{base_name}
|
||||
cp -r target/site/apidocs %{buildroot}%{_javadocdir}/%{base_name}
|
||||
%fdupes -s %{buildroot}%{_javadocdir}
|
||||
|
||||
# demo
|
||||
mkdir -p %{buildroot}%{_datadir}/%{name}/classes/org/dom4j
|
||||
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}
|
||||
%fdupes -s %{buildroot}%{_datadir}/%{name}
|
||||
install -dm 0755 %{buildroot}%{_datadir}/%{base_name}/src
|
||||
cp -pr xml %{buildroot}%{_datadir}/%{base_name}
|
||||
cp -pr src/example %{buildroot}%{_datadir}/%{base_name}/src
|
||||
%fdupes -s %{buildroot}%{_datadir}/%{base_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}
|
||||
%{_datadir}/%{base_name}
|
||||
|
||||
%files javadoc
|
||||
%license LICENSE
|
||||
%{_javadocdir}/%{base_name}
|
||||
|
||||
%else
|
||||
|
||||
%files
|
||||
%{_javadir}/%{base_name}.jar
|
||||
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
|
128
dom4j_rundemo.sh
128
dom4j_rundemo.sh
@ -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 "$@"
|
Loading…
Reference in New Issue
Block a user