diff --git a/ext/java/nokogiri/NokogiriService.java b/ext/java/nokogiri/NokogiriService.java index 045c98af713..17c51eaa643 100644 --- a/ext/java/nokogiri/NokogiriService.java +++ b/ext/java/nokogiri/NokogiriService.java @@ -94,6 +94,8 @@ public class NokogiriService implements BasicLibraryService createSaxModule(ruby, xmlSaxModule, htmlSaxModule); createXsltModule(ruby, xsltModule); nokogiri.setInternalVariable("cache", populateNokogiriClassCahce(ruby)); + + org.apache.xml.security.Init.init(); } private void diff --git a/ext/java/nokogiri/XmlDocument.java b/ext/java/nokogiri/XmlDocument.java index 3141ae28c46..8960e046be9 100644 --- a/ext/java/nokogiri/XmlDocument.java +++ b/ext/java/nokogiri/XmlDocument.java @@ -8,6 +8,7 @@ import static nokogiri.internals.NokogiriHelpers.stringOrNil; import java.util.List; +import java.io.ByteArrayOutputStream; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; @@ -36,13 +37,13 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; +import org.apache.xml.security.exceptions.XMLSecurityException; +import org.apache.xml.security.c14n.Canonicalizer; + import nokogiri.internals.NokogiriHelpers; import nokogiri.internals.NokogiriNamespaceCache; import nokogiri.internals.SaveContextVisitor; import nokogiri.internals.XmlDomParserContext; -import nokogiri.internals.c14n.CanonicalFilter; -import nokogiri.internals.c14n.CanonicalizationException; -import nokogiri.internals.c14n.Canonicalizer; /** * Class for Nokogiri::XML::Document @@ -673,15 +674,14 @@ private static class DocumentBuilderFactoryHolder try { Canonicalizer canonicalizer = Canonicalizer.getInstance(algorithmURI); XmlNode startingNode = getStartingNode(block); - byte[] result; - CanonicalFilter filter = new CanonicalFilter(context, block); + ByteArrayOutputStream writer = new ByteArrayOutputStream(); if (inclusive_namespace == null) { - result = canonicalizer.canonicalizeSubtree(startingNode.getNode(), filter); + canonicalizer.canonicalizeSubtree(startingNode.getNode(), writer); } else { - result = canonicalizer.canonicalizeSubtree(startingNode.getNode(), inclusive_namespace, filter); + canonicalizer.canonicalizeSubtree(startingNode.getNode(), inclusive_namespace, writer); } - return RubyString.newString(context.runtime, new ByteList(result, UTF8Encoding.INSTANCE)); - } catch (Exception e) { + return RubyString.newString(context.runtime, writer.toString()); + } catch (XMLSecurityException e) { throw context.getRuntime().newRuntimeError(e.getMessage()); } } diff --git a/ext/java/nokogiri/internals/c14n/AttrCompare.java b/ext/java/nokogiri/internals/c14n/AttrCompare.java deleted file mode 100644 index ed34b536dd5..00000000000 --- a/ext/java/nokogiri/internals/c14n/AttrCompare.java +++ /dev/null @@ -1,122 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package nokogiri.internals.c14n; - -import java.io.Serializable; -import java.util.Comparator; - - -import org.w3c.dom.Attr; - -/** - * Compares two attributes based on the C14n specification. - * - *
node
.
- *
- * @param node The node to canonicalize
- * @return the result of the c14n.
- *
- * @throws CanonicalizationException
- */
- public byte[]
- canonicalizeSubtree(Node node, CanonicalFilter filter) throws CanonicalizationException
- {
- return canonicalizerSpi.engineCanonicalizeSubTree(node, filter);
- }
-
- /**
- * Canonicalizes the subtree rooted by node
.
- *
- * @param node
- * @param inclusiveNamespaces
- * @return the result of the c14n.
- * @throws CanonicalizationException
- */
- public byte[]
- canonicalizeSubtree(Node node, String inclusiveNamespaces, CanonicalFilter filter)
- throws CanonicalizationException
- {
- return canonicalizerSpi.engineCanonicalizeSubTree(node, inclusiveNamespaces, filter);
- }
-
- /**
- * Sets the writer where the canonicalization ends. ByteArrayOutputStream
- * if none is set.
- * @param os
- */
- public void
- setWriter(OutputStream os)
- {
- canonicalizerSpi.setWriter(os);
- }
-
- /**
- * Returns the name of the implementing {@link CanonicalizerSpi} class
- *
- * @return the name of the implementing {@link CanonicalizerSpi} class
- */
- public String
- getImplementingCanonicalizerClass()
- {
- return canonicalizerSpi.getClass().getName();
- }
-
- /**
- * Set the canonicalizer behaviour to not reset.
- */
- public void
- notReset()
- {
- canonicalizerSpi.reset = false;
- }
-
-}
diff --git a/ext/java/nokogiri/internals/c14n/Canonicalizer11.java b/ext/java/nokogiri/internals/c14n/Canonicalizer11.java
deleted file mode 100644
index 324770c7854..00000000000
--- a/ext/java/nokogiri/internals/c14n/Canonicalizer11.java
+++ /dev/null
@@ -1,664 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package nokogiri.internals.c14n;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-/**
- * Implements
- * Canonical XML Version 1.1, a W3C Proposed Recommendation from 29
- * January 2008.
- *
- * @author Sean Mullan
- * @author Raul Benito
- */
-public abstract class Canonicalizer11 extends CanonicalizerBase
-{
-
- private static final String XMLNS_URI = Constants.NamespaceSpecNS;
- private static final String XML_LANG_URI = Constants.XML_LANG_SPACE_SpecNS;
- private final SortedSet&
<
"
#x9
, #xA, and #xD, with character
- * references. The character references are written in uppercase
- * hexadecimal with no leading zeroes (for example, #xD
is represented
- * by the character reference 
)inclusiveNamespaces
String and returns all
- * selected namespace prefixes as a Set. The #default
- * namespace token is represented as an empty namespace prefix
- * ("xmlns"
).
- * inclusiveNamespaces=" xenc ds #default"
- * is returned as a Set containing the following Strings:
- * xmlns
xenc
ds
int
value
- */
- protected void
- rehash(int newCapacity)
- {
- int oldCapacity = keys.length;
- String oldKeys[] = keys;
- NameSpaceSymbEntry oldVals[] = entries;
-
- keys = new String[newCapacity];
- entries = new NameSpaceSymbEntry[newCapacity];
-
- for (int i = oldCapacity; i-- > 0;) {
- if (oldKeys[i] != null) {
- String o = oldKeys[i];
- int index = index(o);
- keys[index] = o;
- entries[index] = oldVals[i];
- }
- }
- }
-
- NameSpaceSymbEntry
- get(String key)
- {
- return entries[index(key)];
- }
-
- protected Object
- clone()
- {
- try {
- SymbMap copy = (SymbMap) super.clone();
- copy.entries = new NameSpaceSymbEntry[entries.length];
- System.arraycopy(entries, 0, copy.entries, 0, entries.length);
- copy.keys = new String[keys.length];
- System.arraycopy(keys, 0, copy.keys, 0, keys.length);
-
- return copy;
- } catch (CloneNotSupportedException e) {
- e.printStackTrace();
- }
- return null;
- }
-}
diff --git a/ext/java/nokogiri/internals/c14n/NodeFilter.java b/ext/java/nokogiri/internals/c14n/NodeFilter.java
deleted file mode 100644
index 42f959de9f8..00000000000
--- a/ext/java/nokogiri/internals/c14n/NodeFilter.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package nokogiri.internals.c14n;
-
-import org.w3c.dom.Node;
-
-/**
- * An interface to tell to the c14n if a node is included or not in the output
- */
-public interface NodeFilter
-{
-
- /**
- * Tells if a node must be output in c14n.
- * @param n
- * @return 1 if the node should be output.
- * 0 if node must not be output,
- * -1 if the node and all it's child must not be output.
- *
- */
- int isNodeInclude(Node n);
-
- /**
- * Tells if a node must be output in a c14n.
- * The caller must assured that this method is always call
- * in document order. The implementations can use this
- * restriction to optimize the transformation.
- * @param n
- * @param level the relative level in the tree
- * @return 1 if the node should be output.
- * 0 if node must not be output,
- * -1 if the node and all it's child must not be output.
- */
- int isNodeIncludeDO(Node n, int level);
-
-}
diff --git a/ext/java/nokogiri/internals/c14n/UtfHelpper.java b/ext/java/nokogiri/internals/c14n/UtfHelpper.java
deleted file mode 100644
index 40866507bfb..00000000000
--- a/ext/java/nokogiri/internals/c14n/UtfHelpper.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package nokogiri.internals.c14n;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Map;
-
-public final class UtfHelpper
-{
-
- private
- UtfHelpper()
- {
- // complete
- }
-
- public static void
- writeByte(
- final String str,
- final OutputStream out,
- Mapnull
- * if the {@link Node} is a {@link Document}.
- *
- * @param node
- * @return the owner document of the node
- */
- public static Document
- getOwnerDocument(Node node)
- {
- if (node.getNodeType() == Node.DOCUMENT_NODE) {
- return (Document) node;
- }
- try {
- return node.getOwnerDocument();
- } catch (NullPointerException npe) {
- throw new NullPointerException(npe.getMessage());
- }
- }
-
- /**
- * This method returns the first non-null owner document of the Nodes in this Set.
- * This method is necessary because it always returns a
- * {@link Document}. {@link Node#getOwnerDocument} returns null
- * if the {@link Node} is a {@link Document}.
- *
- * @param xpathNodeSet
- * @return the owner document
- */
- public static Document
- getOwnerDocument(SetThis works around a limitation of the DOM
- * Element.getAttributeNode
method, which does not distinguish
- * between an unspecified attribute and an attribute with a value of
- * "" (it returns "" for both cases).
- *
- * @param elem the element containing the attribute
- * @param name the name of the attribute
- * @return the attribute value (may be null if unspecified)
- */
- public static String
- getAttributeValue(Element elem, String name)
- {
- Attr attr = elem.getAttributeNodeNS(null, name);
- return (attr == null) ? null : attr.getValue();
- }
-
- /**
- * This method is a tree-search to help prevent against wrapping attacks. It checks that no
- * two Elements have ID Attributes that match the "value" argument, if this is the case then
- * "false" is returned. Note that a return value of "true" does not necessarily mean that
- * a matching Element has been found, just that no wrapping attack has been detected.
- */
- public static boolean
- protectAgainstWrappingAttack(Node startNode, String value)
- {
- Node startParent = startNode.getParentNode();
- Node processedNode;
- Element foundElement = null;
-
- String id = value.trim();
- if (id.charAt(0) == '#') {
- id = id.substring(1);
- }
-
- while (startNode != null) {
- if (startNode.getNodeType() == Node.ELEMENT_NODE) {
- Element se = (Element) startNode;
-
- NamedNodeMap attributes = se.getAttributes();
- if (attributes != null) {
- for (int i = 0; i < attributes.getLength(); i++) {
- Attr attr = (Attr)attributes.item(i);
- if (attr.isId() && id.equals(attr.getValue())) {
- if (foundElement == null) {
- // Continue searching to find duplicates
- foundElement = attr.getOwnerElement();
- } else {
- //log.debug("Multiple elements with the same 'Id' attribute value!");
- return false;
- }
- }
- }
- }
- }
-
- processedNode = startNode;
- startNode = startNode.getFirstChild();
-
- // no child, this node is done.
- if (startNode == null) {
- // close node processing, get sibling
- startNode = processedNode.getNextSibling();
- }
-
- // no more siblings, get parent, all children
- // of parent are processed.
- while (startNode == null) {
- processedNode = processedNode.getParentNode();
- if (processedNode == startParent) {
- return true;
- }
- // close parent node processing (processed node now)
- startNode = processedNode.getNextSibling();
- }
- }
- return true;
- }
-
- /**
- * This method is a tree-search to help prevent against wrapping attacks. It checks that no other
- * Element than the given "knownElement" argument has an ID attribute that matches the "value"
- * argument, which is the ID value of "knownElement". If this is the case then "false" is returned.
- */
- public static boolean
- protectAgainstWrappingAttack(
- Node startNode, Element knownElement, String value
- )
- {
- Node startParent = startNode.getParentNode();
- Node processedNode;
-
- String id = value.trim();
- if (id.charAt(0) == '#') {
- id = id.substring(1);
- }
-
- while (startNode != null) {
- if (startNode.getNodeType() == Node.ELEMENT_NODE) {
- Element se = (Element) startNode;
-
- NamedNodeMap attributes = se.getAttributes();
- if (attributes != null) {
- for (int i = 0; i < attributes.getLength(); i++) {
- Attr attr = (Attr)attributes.item(i);
- if (attr.isId() && id.equals(attr.getValue()) && se != knownElement) {
- //log.debug("Multiple elements with the same 'Id' attribute value!");
- return false;
- }
- }
- }
- }
-
- processedNode = startNode;
- startNode = startNode.getFirstChild();
-
- // no child, this node is done.
- if (startNode == null) {
- // close node processing, get sibling
- startNode = processedNode.getNextSibling();
- }
-
- // no more siblings, get parent, all children
- // of parent are processed.
- while (startNode == null) {
- processedNode = processedNode.getParentNode();
- if (processedNode == startParent) {
- return true;
- }
- // close parent node processing (processed node now)
- startNode = processedNode.getNextSibling();
- }
- }
- return true;
- }
-
-}
diff --git a/lib/nokogiri/jruby/com/fasterxml/woodstox/woodstox-core/6.2.6/woodstox-core-6.2.6.jar b/lib/nokogiri/jruby/com/fasterxml/woodstox/woodstox-core/6.2.6/woodstox-core-6.2.6.jar
new file mode 100644
index 00000000000..695fb76ebac
Binary files /dev/null and b/lib/nokogiri/jruby/com/fasterxml/woodstox/woodstox-core/6.2.6/woodstox-core-6.2.6.jar differ
diff --git a/lib/nokogiri/jruby/commons-codec/commons-codec/1.15/commons-codec-1.15.jar b/lib/nokogiri/jruby/commons-codec/commons-codec/1.15/commons-codec-1.15.jar
new file mode 100644
index 00000000000..f14985ac921
Binary files /dev/null and b/lib/nokogiri/jruby/commons-codec/commons-codec/1.15/commons-codec-1.15.jar differ
diff --git a/lib/nokogiri/jruby/jakarta/activation/jakarta.activation-api/1.2.2/jakarta.activation-api-1.2.2.jar b/lib/nokogiri/jruby/jakarta/activation/jakarta.activation-api/1.2.2/jakarta.activation-api-1.2.2.jar
new file mode 100644
index 00000000000..3cc969d8f74
Binary files /dev/null and b/lib/nokogiri/jruby/jakarta/activation/jakarta.activation-api/1.2.2/jakarta.activation-api-1.2.2.jar differ
diff --git a/lib/nokogiri/jruby/jakarta/xml/bind/jakarta.xml.bind-api/2.3.3/jakarta.xml.bind-api-2.3.3.jar b/lib/nokogiri/jruby/jakarta/xml/bind/jakarta.xml.bind-api/2.3.3/jakarta.xml.bind-api-2.3.3.jar
new file mode 100644
index 00000000000..b8c7dc1ec85
Binary files /dev/null and b/lib/nokogiri/jruby/jakarta/xml/bind/jakarta.xml.bind-api/2.3.3/jakarta.xml.bind-api-2.3.3.jar differ
diff --git a/lib/nokogiri/jruby/nokogiri_jars.rb b/lib/nokogiri/jruby/nokogiri_jars.rb
index 96f2b7ddb98..d7f878f96cb 100644
--- a/lib/nokogiri/jruby/nokogiri_jars.rb
+++ b/lib/nokogiri/jruby/nokogiri_jars.rb
@@ -2,32 +2,46 @@
begin
require 'jar_dependencies'
rescue LoadError
+ require 'commons-codec/commons-codec/1.15/commons-codec-1.15.jar'
+ require 'com/fasterxml/woodstox/woodstox-core/6.2.6/woodstox-core-6.2.6.jar'
+ require 'xerces/xercesImpl/2.12.2/xercesImpl-2.12.2.jar'
+ require 'org/apache/santuario/xmlsec/2.3.1/xmlsec-2.3.1.jar'
+ require 'xalan/serializer/2.7.2/serializer-2.7.2.jar'
+ require 'net/sourceforge/htmlunit/neko-htmlunit/2.61.0/neko-htmlunit-2.61.0.jar'
+ require 'isorelax/isorelax/20030108/isorelax-20030108.jar'
+ require 'org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar'
require 'xalan/xalan/2.7.2/xalan-2.7.2.jar'
+ require 'org/codehaus/woodstox/stax2-api/4.2.1/stax2-api-4.2.1.jar'
require 'nu/validator/jing/20200702VNU/jing-20200702VNU.jar'
- require 'xerces/xercesImpl/2.12.2/xercesImpl-2.12.2.jar'
require 'org/nokogiri/nekodtd/0.1.11.noko1/nekodtd-0.1.11.noko1.jar'
require 'net/sf/saxon/Saxon-HE/9.6.0-4/Saxon-HE-9.6.0-4.jar'
+ require 'jakarta/xml/bind/jakarta.xml.bind-api/2.3.3/jakarta.xml.bind-api-2.3.3.jar'
require 'xml-apis/xml-apis/1.4.01/xml-apis-1.4.01.jar'
- require 'xalan/serializer/2.7.2/serializer-2.7.2.jar'
- require 'net/sourceforge/htmlunit/neko-htmlunit/2.61.0/neko-htmlunit-2.61.0.jar'
- require 'isorelax/isorelax/20030108/isorelax-20030108.jar'
+ require 'jakarta/activation/jakarta.activation-api/1.2.2/jakarta.activation-api-1.2.2.jar'
end
if defined? Jars
+ require_jar 'commons-codec', 'commons-codec', '1.15'
+ require_jar 'com.fasterxml.woodstox', 'woodstox-core', '6.2.6'
+ require_jar 'xerces', 'xercesImpl', '2.12.2'
+ require_jar 'org.apache.santuario', 'xmlsec', '2.3.1'
+ require_jar 'xalan', 'serializer', '2.7.2'
+ require_jar 'net.sourceforge.htmlunit', 'neko-htmlunit', '2.61.0'
+ require_jar 'isorelax', 'isorelax', '20030108'
+ require_jar 'org.slf4j', 'slf4j-api', '1.7.36'
require_jar 'xalan', 'xalan', '2.7.2'
+ require_jar 'org.codehaus.woodstox', 'stax2-api', '4.2.1'
require_jar 'nu.validator', 'jing', '20200702VNU'
- require_jar 'xerces', 'xercesImpl', '2.12.2'
require_jar 'org.nokogiri', 'nekodtd', '0.1.11.noko1'
require_jar 'net.sf.saxon', 'Saxon-HE', '9.6.0-4'
+ require_jar 'jakarta.xml.bind', 'jakarta.xml.bind-api', '2.3.3'
require_jar 'xml-apis', 'xml-apis', '1.4.01'
- require_jar 'xalan', 'serializer', '2.7.2'
- require_jar 'net.sourceforge.htmlunit', 'neko-htmlunit', '2.61.0'
- require_jar 'isorelax', 'isorelax', '20030108'
+ require_jar 'jakarta.activation', 'jakarta.activation-api', '1.2.2'
end
# generated by the :vendor_jars rake task
module Nokogiri
- JAR_DEPENDENCIES = {"isorelax:isorelax"=>"20030108", "net.sf.saxon:Saxon-HE"=>"9.6.0-4", "net.sourceforge.htmlunit:neko-htmlunit"=>"2.61.0", "nu.validator:jing"=>"20200702VNU", "org.nokogiri:nekodtd"=>"0.1.11.noko1", "xalan:serializer"=>"2.7.2", "xalan:xalan"=>"2.7.2", "xerces:xercesImpl"=>"2.12.2", "xml-apis:xml-apis"=>"1.4.01"}.freeze
+ JAR_DEPENDENCIES = {"com.fasterxml.woodstox:woodstox-core"=>"6.2.6", "commons-codec:commons-codec"=>"1.15", "isorelax:isorelax"=>"20030108", "jakarta.activation:jakarta.activation-api"=>"1.2.2", "jakarta.xml.bind:jakarta.xml.bind-api"=>"2.3.3", "net.sf.saxon:Saxon-HE"=>"9.6.0-4", "net.sourceforge.htmlunit:neko-htmlunit"=>"2.61.0", "nu.validator:jing"=>"20200702VNU", "org.apache.santuario:xmlsec"=>"2.3.1", "org.codehaus.woodstox:stax2-api"=>"4.2.1", "org.nokogiri:nekodtd"=>"0.1.11.noko1", "org.slf4j:slf4j-api"=>"1.7.36", "xalan:serializer"=>"2.7.2", "xalan:xalan"=>"2.7.2", "xerces:xercesImpl"=>"2.12.2", "xml-apis:xml-apis"=>"1.4.01"}.freeze
XERCES_VERSION = JAR_DEPENDENCIES["xerces:xercesImpl"]
NEKO_VERSION = JAR_DEPENDENCIES["net.sourceforge.htmlunit:neko-htmlunit"]
end
diff --git a/lib/nokogiri/jruby/org/apache/santuario/xmlsec/2.3.1/xmlsec-2.3.1.jar b/lib/nokogiri/jruby/org/apache/santuario/xmlsec/2.3.1/xmlsec-2.3.1.jar
new file mode 100644
index 00000000000..e7df49b033c
Binary files /dev/null and b/lib/nokogiri/jruby/org/apache/santuario/xmlsec/2.3.1/xmlsec-2.3.1.jar differ
diff --git a/lib/nokogiri/jruby/org/codehaus/woodstox/stax2-api/4.2.1/stax2-api-4.2.1.jar b/lib/nokogiri/jruby/org/codehaus/woodstox/stax2-api/4.2.1/stax2-api-4.2.1.jar
new file mode 100644
index 00000000000..28c6a08f40b
Binary files /dev/null and b/lib/nokogiri/jruby/org/codehaus/woodstox/stax2-api/4.2.1/stax2-api-4.2.1.jar differ
diff --git a/lib/nokogiri/jruby/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar b/lib/nokogiri/jruby/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar
new file mode 100644
index 00000000000..7d3ce68d25e
Binary files /dev/null and b/lib/nokogiri/jruby/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar differ
diff --git a/lib/nokogiri/xml.rb b/lib/nokogiri/xml.rb
index 9d16fb14989..16bad274cd1 100644
--- a/lib/nokogiri/xml.rb
+++ b/lib/nokogiri/xml.rb
@@ -11,7 +11,7 @@ def XML(thing, url = nil, encoding = nil, options = XML::ParseOptions::DEFAULT_X
module XML
# Original C14N 1.0 spec canonicalization
- XML_C14N_1_0 = 0
+ XML_C14N_1_0 = 0
# Exclusive C14N 1.0 spec canonicalization
XML_C14N_EXCLUSIVE_1_0 = 1
# C14N 1.1 spec canonicalization
diff --git a/nokogiri.gemspec b/nokogiri.gemspec
index 9ab83e2dc7d..6f94cff7875 100644
--- a/nokogiri.gemspec
+++ b/nokogiri.gemspec
@@ -117,33 +117,6 @@ Gem::Specification.new do |spec|
"ext/java/nokogiri/internals/XmlDeclHandler.java",
"ext/java/nokogiri/internals/XmlDomParserContext.java",
"ext/java/nokogiri/internals/XmlSaxParser.java",
- "ext/java/nokogiri/internals/c14n/AttrCompare.java",
- "ext/java/nokogiri/internals/c14n/C14nHelper.java",
- "ext/java/nokogiri/internals/c14n/CanonicalFilter.java",
- "ext/java/nokogiri/internals/c14n/CanonicalizationException.java",
- "ext/java/nokogiri/internals/c14n/Canonicalizer.java",
- "ext/java/nokogiri/internals/c14n/Canonicalizer11.java",
- "ext/java/nokogiri/internals/c14n/Canonicalizer11_OmitComments.java",
- "ext/java/nokogiri/internals/c14n/Canonicalizer11_WithComments.java",
- "ext/java/nokogiri/internals/c14n/Canonicalizer20010315.java",
- "ext/java/nokogiri/internals/c14n/Canonicalizer20010315Excl.java",
- "ext/java/nokogiri/internals/c14n/Canonicalizer20010315ExclOmitComments.java",
- "ext/java/nokogiri/internals/c14n/Canonicalizer20010315ExclWithComments.java",
- "ext/java/nokogiri/internals/c14n/Canonicalizer20010315OmitComments.java",
- "ext/java/nokogiri/internals/c14n/Canonicalizer20010315WithComments.java",
- "ext/java/nokogiri/internals/c14n/CanonicalizerBase.java",
- "ext/java/nokogiri/internals/c14n/CanonicalizerPhysical.java",
- "ext/java/nokogiri/internals/c14n/CanonicalizerSpi.java",
- "ext/java/nokogiri/internals/c14n/Constants.java",
- "ext/java/nokogiri/internals/c14n/ElementProxy.java",
- "ext/java/nokogiri/internals/c14n/HelperNodeList.java",
- "ext/java/nokogiri/internals/c14n/IgnoreAllErrorHandler.java",
- "ext/java/nokogiri/internals/c14n/InclusiveNamespaces.java",
- "ext/java/nokogiri/internals/c14n/InvalidCanonicalizerException.java",
- "ext/java/nokogiri/internals/c14n/NameSpaceSymbTable.java",
- "ext/java/nokogiri/internals/c14n/NodeFilter.java",
- "ext/java/nokogiri/internals/c14n/UtfHelpper.java",
- "ext/java/nokogiri/internals/c14n/XMLUtils.java",
"ext/java/nokogiri/internals/dom2dtm/DOM2DTM.java",
"ext/java/nokogiri/internals/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java",
"ext/nokogiri/depend",
@@ -257,13 +230,20 @@ Gem::Specification.new do |spec|
"lib/nokogiri/html5/document.rb",
"lib/nokogiri/html5/document_fragment.rb",
"lib/nokogiri/html5/node.rb",
+ "lib/nokogiri/jruby/com/fasterxml/woodstox/woodstox-core/6.2.6/woodstox-core-6.2.6.jar",
+ "lib/nokogiri/jruby/commons-codec/commons-codec/1.15/commons-codec-1.15.jar",
"lib/nokogiri/jruby/dependencies.rb",
"lib/nokogiri/jruby/isorelax/isorelax/20030108/isorelax-20030108.jar",
+ "lib/nokogiri/jruby/jakarta/activation/jakarta.activation-api/1.2.2/jakarta.activation-api-1.2.2.jar",
+ "lib/nokogiri/jruby/jakarta/xml/bind/jakarta.xml.bind-api/2.3.3/jakarta.xml.bind-api-2.3.3.jar",
"lib/nokogiri/jruby/net/sf/saxon/Saxon-HE/9.6.0-4/Saxon-HE-9.6.0-4.jar",
"lib/nokogiri/jruby/net/sourceforge/htmlunit/neko-htmlunit/2.61.0/neko-htmlunit-2.61.0.jar",
"lib/nokogiri/jruby/nokogiri_jars.rb",
"lib/nokogiri/jruby/nu/validator/jing/20200702VNU/jing-20200702VNU.jar",
+ "lib/nokogiri/jruby/org/apache/santuario/xmlsec/2.3.1/xmlsec-2.3.1.jar",
+ "lib/nokogiri/jruby/org/codehaus/woodstox/stax2-api/4.2.1/stax2-api-4.2.1.jar",
"lib/nokogiri/jruby/org/nokogiri/nekodtd/0.1.11.noko1/nekodtd-0.1.11.noko1.jar",
+ "lib/nokogiri/jruby/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar",
"lib/nokogiri/jruby/xalan/serializer/2.7.2/serializer-2.7.2.jar",
"lib/nokogiri/jruby/xalan/xalan/2.7.2/xalan-2.7.2.jar",
"lib/nokogiri/jruby/xerces/xercesImpl/2.12.2/xercesImpl-2.12.2.jar",
@@ -331,6 +311,7 @@ Gem::Specification.new do |spec|
spec.requirements << "jar xalan, xalan, 2.7.2" # https://search.maven.org/artifact/xalan/xalan
spec.requirements << "jar xerces, xercesImpl, 2.12.2" # https://search.maven.org/artifact/xerces/xercesImpl
spec.requirements << "jar xml-apis, xml-apis, 1.4.01" # https://search.maven.org/artifact/xml-apis/xml-apis
+ spec.requirements << "jar org.apache.santuario, xmlsec, 2.3.1" # https://search.maven.org/artifact/org.apache.santuario/xmlsec
else
spec.add_runtime_dependency("mini_portile2", "~> 2.8.0") # keep version in sync with extconf.rb
end
diff --git a/test/xml/test_c14n.rb b/test/xml/test_c14n.rb
index 379e60f0aff..f5c5770b46d 100644
--- a/test/xml/test_c14n.rb
+++ b/test/xml/test_c14n.rb
@@ -49,6 +49,8 @@ def test_3_1
end
def test_exclude_block_params
+ skip("canonicalize block not supported on jruby, see #2547") if Nokogiri.jruby?
+
xml = ""
doc = Nokogiri.XML(xml)
@@ -57,20 +59,15 @@ def test_exclude_block_params
list << [node, parent]
true
end
- if Nokogiri.jruby?
- assert_equal(
- ["a", "document", "document", nil, "b", "a"],
- list.flatten.map { |x| x ? x.name : x }
- )
- else
- assert_equal(
- ["a", "document", "document", nil, "b", "a", "a", "document"],
- list.flatten.map { |x| x ? x.name : x }
- )
- end
+ assert_equal(
+ ["a", "document", "document", nil, "b", "a", "a", "document"],
+ list.flatten.map { |x| x ? x.name : x }
+ )
end
def test_exclude_block_true
+ skip("canonicalize block not supported on jruby, see #2547") if Nokogiri.jruby?
+
xml = ""
doc = Nokogiri.XML(xml)
@@ -81,6 +78,8 @@ def test_exclude_block_true
end
def test_exclude_block_false
+ skip("canonicalize block not supported on jruby, see #2547") if Nokogiri.jruby?
+
xml = ""
doc = Nokogiri.XML(xml)
@@ -91,6 +90,8 @@ def test_exclude_block_false
end
def test_exclude_block_conditional
+ skip("canonicalize block not supported on jruby, see #2547") if Nokogiri.jruby?
+
xml = "