Nokogiri_precompiled_aarch64_dedshit 1.14.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +44 -0
- data/LICENSE-DEPENDENCIES.md +2224 -0
- data/LICENSE.md +9 -0
- data/README.md +287 -0
- data/bin/nokogiri +131 -0
- data/dependencies.yml +41 -0
- data/ext/java/nokogiri/Html4Document.java +157 -0
- data/ext/java/nokogiri/Html4ElementDescription.java +133 -0
- data/ext/java/nokogiri/Html4EntityLookup.java +63 -0
- data/ext/java/nokogiri/Html4SaxParserContext.java +289 -0
- data/ext/java/nokogiri/Html4SaxPushParser.java +213 -0
- data/ext/java/nokogiri/NokogiriService.java +613 -0
- data/ext/java/nokogiri/XmlAttr.java +154 -0
- data/ext/java/nokogiri/XmlAttributeDecl.java +119 -0
- data/ext/java/nokogiri/XmlCdata.java +60 -0
- data/ext/java/nokogiri/XmlComment.java +77 -0
- data/ext/java/nokogiri/XmlDocument.java +705 -0
- data/ext/java/nokogiri/XmlDocumentFragment.java +163 -0
- data/ext/java/nokogiri/XmlDtd.java +516 -0
- data/ext/java/nokogiri/XmlElement.java +44 -0
- data/ext/java/nokogiri/XmlElementContent.java +412 -0
- data/ext/java/nokogiri/XmlElementDecl.java +148 -0
- data/ext/java/nokogiri/XmlEntityDecl.java +151 -0
- data/ext/java/nokogiri/XmlEntityReference.java +79 -0
- data/ext/java/nokogiri/XmlNamespace.java +193 -0
- data/ext/java/nokogiri/XmlNode.java +1938 -0
- data/ext/java/nokogiri/XmlNodeSet.java +463 -0
- data/ext/java/nokogiri/XmlProcessingInstruction.java +79 -0
- data/ext/java/nokogiri/XmlReader.java +615 -0
- data/ext/java/nokogiri/XmlRelaxng.java +133 -0
- data/ext/java/nokogiri/XmlSaxParserContext.java +329 -0
- data/ext/java/nokogiri/XmlSaxPushParser.java +288 -0
- data/ext/java/nokogiri/XmlSchema.java +423 -0
- data/ext/java/nokogiri/XmlSyntaxError.java +137 -0
- data/ext/java/nokogiri/XmlText.java +90 -0
- data/ext/java/nokogiri/XmlXpathContext.java +305 -0
- data/ext/java/nokogiri/XsltStylesheet.java +368 -0
- data/ext/java/nokogiri/internals/ClosedStreamException.java +13 -0
- data/ext/java/nokogiri/internals/HtmlDomParserContext.java +252 -0
- data/ext/java/nokogiri/internals/IgnoreSchemaErrorsErrorHandler.java +27 -0
- data/ext/java/nokogiri/internals/NokogiriBlockingQueueInputStream.java +178 -0
- data/ext/java/nokogiri/internals/NokogiriDomParser.java +99 -0
- data/ext/java/nokogiri/internals/NokogiriEntityResolver.java +140 -0
- data/ext/java/nokogiri/internals/NokogiriErrorHandler.java +65 -0
- data/ext/java/nokogiri/internals/NokogiriHandler.java +339 -0
- data/ext/java/nokogiri/internals/NokogiriHelpers.java +817 -0
- data/ext/java/nokogiri/internals/NokogiriNamespaceCache.java +228 -0
- data/ext/java/nokogiri/internals/NokogiriNamespaceContext.java +110 -0
- data/ext/java/nokogiri/internals/NokogiriNonStrictErrorHandler.java +86 -0
- data/ext/java/nokogiri/internals/NokogiriNonStrictErrorHandler4NekoHtml.java +107 -0
- data/ext/java/nokogiri/internals/NokogiriStrictErrorHandler.java +62 -0
- data/ext/java/nokogiri/internals/NokogiriXPathFunction.java +165 -0
- data/ext/java/nokogiri/internals/NokogiriXPathFunctionResolver.java +50 -0
- data/ext/java/nokogiri/internals/NokogiriXPathVariableResolver.java +37 -0
- data/ext/java/nokogiri/internals/NokogiriXsltErrorListener.java +70 -0
- data/ext/java/nokogiri/internals/ParserContext.java +262 -0
- data/ext/java/nokogiri/internals/ReaderNode.java +564 -0
- data/ext/java/nokogiri/internals/SaveContextVisitor.java +865 -0
- data/ext/java/nokogiri/internals/SchemaErrorHandler.java +50 -0
- data/ext/java/nokogiri/internals/XalanDTMManagerPatch.java +174 -0
- data/ext/java/nokogiri/internals/XmlDeclHandler.java +11 -0
- data/ext/java/nokogiri/internals/XmlDomParserContext.java +265 -0
- data/ext/java/nokogiri/internals/XmlSaxParser.java +40 -0
- data/ext/java/nokogiri/internals/c14n/AttrCompare.java +122 -0
- data/ext/java/nokogiri/internals/c14n/C14nHelper.java +178 -0
- data/ext/java/nokogiri/internals/c14n/CanonicalFilter.java +43 -0
- data/ext/java/nokogiri/internals/c14n/CanonicalizationException.java +106 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer.java +278 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer11.java +664 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer11_OmitComments.java +45 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer11_WithComments.java +45 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315.java +388 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315Excl.java +308 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315ExclOmitComments.java +47 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315ExclWithComments.java +51 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315OmitComments.java +51 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315WithComments.java +50 -0
- data/ext/java/nokogiri/internals/c14n/CanonicalizerBase.java +660 -0
- data/ext/java/nokogiri/internals/c14n/CanonicalizerPhysical.java +194 -0
- data/ext/java/nokogiri/internals/c14n/CanonicalizerSpi.java +77 -0
- data/ext/java/nokogiri/internals/c14n/Constants.java +45 -0
- data/ext/java/nokogiri/internals/c14n/ElementProxy.java +325 -0
- data/ext/java/nokogiri/internals/c14n/HelperNodeList.java +106 -0
- data/ext/java/nokogiri/internals/c14n/IgnoreAllErrorHandler.java +86 -0
- data/ext/java/nokogiri/internals/c14n/InclusiveNamespaces.java +181 -0
- data/ext/java/nokogiri/internals/c14n/InvalidCanonicalizerException.java +87 -0
- data/ext/java/nokogiri/internals/c14n/NameSpaceSymbTable.java +452 -0
- data/ext/java/nokogiri/internals/c14n/NodeFilter.java +52 -0
- data/ext/java/nokogiri/internals/c14n/UtfHelpper.java +190 -0
- data/ext/java/nokogiri/internals/c14n/XMLUtils.java +540 -0
- data/ext/java/nokogiri/internals/dom2dtm/DOM2DTM.java +1712 -0
- data/ext/java/nokogiri/internals/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java +737 -0
- data/ext/nokogiri/depend +38 -0
- data/ext/nokogiri/extconf.rb +1086 -0
- data/ext/nokogiri/gumbo.c +594 -0
- data/ext/nokogiri/html4_document.c +167 -0
- data/ext/nokogiri/html4_element_description.c +294 -0
- data/ext/nokogiri/html4_entity_lookup.c +37 -0
- data/ext/nokogiri/html4_sax_parser_context.c +116 -0
- data/ext/nokogiri/html4_sax_push_parser.c +95 -0
- data/ext/nokogiri/libxml2_backwards_compat.c +121 -0
- data/ext/nokogiri/nokogiri.c +265 -0
- data/ext/nokogiri/nokogiri.h +235 -0
- data/ext/nokogiri/test_global_handlers.c +42 -0
- data/ext/nokogiri/xml_attr.c +103 -0
- data/ext/nokogiri/xml_attribute_decl.c +70 -0
- data/ext/nokogiri/xml_cdata.c +57 -0
- data/ext/nokogiri/xml_comment.c +62 -0
- data/ext/nokogiri/xml_document.c +689 -0
- data/ext/nokogiri/xml_document_fragment.c +44 -0
- data/ext/nokogiri/xml_dtd.c +210 -0
- data/ext/nokogiri/xml_element_content.c +128 -0
- data/ext/nokogiri/xml_element_decl.c +69 -0
- data/ext/nokogiri/xml_encoding_handler.c +104 -0
- data/ext/nokogiri/xml_entity_decl.c +112 -0
- data/ext/nokogiri/xml_entity_reference.c +50 -0
- data/ext/nokogiri/xml_namespace.c +186 -0
- data/ext/nokogiri/xml_node.c +2426 -0
- data/ext/nokogiri/xml_node_set.c +496 -0
- data/ext/nokogiri/xml_processing_instruction.c +54 -0
- data/ext/nokogiri/xml_reader.c +794 -0
- data/ext/nokogiri/xml_relax_ng.c +164 -0
- data/ext/nokogiri/xml_sax_parser.c +316 -0
- data/ext/nokogiri/xml_sax_parser_context.c +283 -0
- data/ext/nokogiri/xml_sax_push_parser.c +166 -0
- data/ext/nokogiri/xml_schema.c +260 -0
- data/ext/nokogiri/xml_syntax_error.c +85 -0
- data/ext/nokogiri/xml_text.c +48 -0
- data/ext/nokogiri/xml_xpath_context.c +415 -0
- data/ext/nokogiri/xslt_stylesheet.c +363 -0
- data/gumbo-parser/CHANGES.md +63 -0
- data/gumbo-parser/Makefile +111 -0
- data/gumbo-parser/THANKS +27 -0
- data/gumbo-parser/src/Makefile +34 -0
- data/gumbo-parser/src/README.md +41 -0
- data/gumbo-parser/src/ascii.c +75 -0
- data/gumbo-parser/src/ascii.h +115 -0
- data/gumbo-parser/src/attribute.c +42 -0
- data/gumbo-parser/src/attribute.h +17 -0
- data/gumbo-parser/src/char_ref.c +22225 -0
- data/gumbo-parser/src/char_ref.h +29 -0
- data/gumbo-parser/src/char_ref.rl +2154 -0
- data/gumbo-parser/src/error.c +626 -0
- data/gumbo-parser/src/error.h +148 -0
- data/gumbo-parser/src/foreign_attrs.c +104 -0
- data/gumbo-parser/src/foreign_attrs.gperf +27 -0
- data/gumbo-parser/src/insertion_mode.h +33 -0
- data/gumbo-parser/src/macros.h +91 -0
- data/gumbo-parser/src/nokogiri_gumbo.h +944 -0
- data/gumbo-parser/src/parser.c +4878 -0
- data/gumbo-parser/src/parser.h +41 -0
- data/gumbo-parser/src/replacement.h +33 -0
- data/gumbo-parser/src/string_buffer.c +103 -0
- data/gumbo-parser/src/string_buffer.h +68 -0
- data/gumbo-parser/src/string_piece.c +48 -0
- data/gumbo-parser/src/svg_attrs.c +174 -0
- data/gumbo-parser/src/svg_attrs.gperf +77 -0
- data/gumbo-parser/src/svg_tags.c +137 -0
- data/gumbo-parser/src/svg_tags.gperf +55 -0
- data/gumbo-parser/src/tag.c +223 -0
- data/gumbo-parser/src/tag_lookup.c +382 -0
- data/gumbo-parser/src/tag_lookup.gperf +170 -0
- data/gumbo-parser/src/tag_lookup.h +13 -0
- data/gumbo-parser/src/token_buffer.c +79 -0
- data/gumbo-parser/src/token_buffer.h +71 -0
- data/gumbo-parser/src/token_type.h +17 -0
- data/gumbo-parser/src/tokenizer.c +3463 -0
- data/gumbo-parser/src/tokenizer.h +112 -0
- data/gumbo-parser/src/tokenizer_states.h +339 -0
- data/gumbo-parser/src/utf8.c +245 -0
- data/gumbo-parser/src/utf8.h +164 -0
- data/gumbo-parser/src/util.c +66 -0
- data/gumbo-parser/src/util.h +34 -0
- data/gumbo-parser/src/vector.c +111 -0
- data/gumbo-parser/src/vector.h +45 -0
- data/lib/nokogiri/class_resolver.rb +67 -0
- data/lib/nokogiri/css/node.rb +54 -0
- data/lib/nokogiri/css/parser.rb +770 -0
- data/lib/nokogiri/css/parser.y +277 -0
- data/lib/nokogiri/css/parser_extras.rb +96 -0
- data/lib/nokogiri/css/syntax_error.rb +9 -0
- data/lib/nokogiri/css/tokenizer.rb +155 -0
- data/lib/nokogiri/css/tokenizer.rex +56 -0
- data/lib/nokogiri/css/xpath_visitor.rb +359 -0
- data/lib/nokogiri/css.rb +66 -0
- data/lib/nokogiri/decorators/slop.rb +44 -0
- data/lib/nokogiri/encoding_handler.rb +57 -0
- data/lib/nokogiri/extension.rb +32 -0
- data/lib/nokogiri/gumbo.rb +15 -0
- data/lib/nokogiri/html.rb +48 -0
- data/lib/nokogiri/html4/builder.rb +37 -0
- data/lib/nokogiri/html4/document.rb +214 -0
- data/lib/nokogiri/html4/document_fragment.rb +54 -0
- data/lib/nokogiri/html4/element_description.rb +25 -0
- data/lib/nokogiri/html4/element_description_defaults.rb +572 -0
- data/lib/nokogiri/html4/encoding_reader.rb +121 -0
- data/lib/nokogiri/html4/entity_lookup.rb +15 -0
- data/lib/nokogiri/html4/sax/parser.rb +63 -0
- data/lib/nokogiri/html4/sax/parser_context.rb +20 -0
- data/lib/nokogiri/html4/sax/push_parser.rb +37 -0
- data/lib/nokogiri/html4.rb +47 -0
- data/lib/nokogiri/html5/document.rb +168 -0
- data/lib/nokogiri/html5/document_fragment.rb +90 -0
- data/lib/nokogiri/html5/node.rb +98 -0
- data/lib/nokogiri/html5.rb +389 -0
- data/lib/nokogiri/jruby/dependencies.rb +3 -0
- data/lib/nokogiri/jruby/isorelax/isorelax/20030108/isorelax-20030108.jar +0 -0
- data/lib/nokogiri/jruby/net/sf/saxon/Saxon-HE/9.6.0-4/Saxon-HE-9.6.0-4.jar +0 -0
- data/lib/nokogiri/jruby/net/sourceforge/htmlunit/neko-htmlunit/2.63.0/neko-htmlunit-2.63.0.jar +0 -0
- data/lib/nokogiri/jruby/nokogiri_jars.rb +43 -0
- data/lib/nokogiri/jruby/nu/validator/jing/20200702VNU/jing-20200702VNU.jar +0 -0
- data/lib/nokogiri/jruby/org/nokogiri/nekodtd/0.1.11.noko2/nekodtd-0.1.11.noko2.jar +0 -0
- data/lib/nokogiri/jruby/xalan/serializer/2.7.3/serializer-2.7.3.jar +0 -0
- data/lib/nokogiri/jruby/xalan/xalan/2.7.3/xalan-2.7.3.jar +0 -0
- data/lib/nokogiri/jruby/xerces/xercesImpl/2.12.2/xercesImpl-2.12.2.jar +0 -0
- data/lib/nokogiri/jruby/xml-apis/xml-apis/1.4.01/xml-apis-1.4.01.jar +0 -0
- data/lib/nokogiri/syntax_error.rb +6 -0
- data/lib/nokogiri/version/constant.rb +6 -0
- data/lib/nokogiri/version/info.rb +223 -0
- data/lib/nokogiri/version.rb +4 -0
- data/lib/nokogiri/xml/attr.rb +66 -0
- data/lib/nokogiri/xml/attribute_decl.rb +20 -0
- data/lib/nokogiri/xml/builder.rb +487 -0
- data/lib/nokogiri/xml/cdata.rb +13 -0
- data/lib/nokogiri/xml/character_data.rb +9 -0
- data/lib/nokogiri/xml/document.rb +471 -0
- data/lib/nokogiri/xml/document_fragment.rb +205 -0
- data/lib/nokogiri/xml/dtd.rb +34 -0
- data/lib/nokogiri/xml/element_content.rb +38 -0
- data/lib/nokogiri/xml/element_decl.rb +15 -0
- data/lib/nokogiri/xml/entity_decl.rb +21 -0
- data/lib/nokogiri/xml/entity_reference.rb +20 -0
- data/lib/nokogiri/xml/namespace.rb +58 -0
- data/lib/nokogiri/xml/node/save_options.rb +68 -0
- data/lib/nokogiri/xml/node.rb +1563 -0
- data/lib/nokogiri/xml/node_set.rb +447 -0
- data/lib/nokogiri/xml/notation.rb +19 -0
- data/lib/nokogiri/xml/parse_options.rb +213 -0
- data/lib/nokogiri/xml/pp/character_data.rb +21 -0
- data/lib/nokogiri/xml/pp/node.rb +57 -0
- data/lib/nokogiri/xml/pp.rb +4 -0
- data/lib/nokogiri/xml/processing_instruction.rb +11 -0
- data/lib/nokogiri/xml/reader.rb +105 -0
- data/lib/nokogiri/xml/relax_ng.rb +38 -0
- data/lib/nokogiri/xml/sax/document.rb +167 -0
- data/lib/nokogiri/xml/sax/parser.rb +125 -0
- data/lib/nokogiri/xml/sax/parser_context.rb +21 -0
- data/lib/nokogiri/xml/sax/push_parser.rb +61 -0
- data/lib/nokogiri/xml/sax.rb +6 -0
- data/lib/nokogiri/xml/schema.rb +73 -0
- data/lib/nokogiri/xml/searchable.rb +270 -0
- data/lib/nokogiri/xml/syntax_error.rb +72 -0
- data/lib/nokogiri/xml/text.rb +11 -0
- data/lib/nokogiri/xml/xpath/syntax_error.rb +13 -0
- data/lib/nokogiri/xml/xpath.rb +21 -0
- data/lib/nokogiri/xml/xpath_context.rb +16 -0
- data/lib/nokogiri/xml.rb +76 -0
- data/lib/nokogiri/xslt/stylesheet.rb +27 -0
- data/lib/nokogiri/xslt.rb +65 -0
- data/lib/nokogiri.rb +120 -0
- data/lib/xsd/xmlparser/nokogiri.rb +106 -0
- metadata +391 -0
@@ -0,0 +1,106 @@
|
|
1
|
+
/**
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
4
|
+
* distributed with this work for additional information
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
7
|
+
* "License"); you may not use this file except in compliance
|
8
|
+
* with the License. You may obtain a copy of the License at
|
9
|
+
*
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
*
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
13
|
+
* software distributed under the License is distributed on an
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
* KIND, either express or implied. See the License for the
|
16
|
+
* specific language governing permissions and limitations
|
17
|
+
* under the License.
|
18
|
+
*/
|
19
|
+
package nokogiri.internals.c14n;
|
20
|
+
|
21
|
+
import java.util.ArrayList;
|
22
|
+
import java.util.List;
|
23
|
+
import org.w3c.dom.Document;
|
24
|
+
import org.w3c.dom.Node;
|
25
|
+
import org.w3c.dom.NodeList;
|
26
|
+
|
27
|
+
/**
|
28
|
+
* @author Christian Geuer-Pollmann
|
29
|
+
*/
|
30
|
+
public class HelperNodeList implements NodeList
|
31
|
+
{
|
32
|
+
|
33
|
+
/** Field nodes */
|
34
|
+
List<Node> nodes = new ArrayList<Node>();
|
35
|
+
boolean allNodesMustHaveSameParent = false;
|
36
|
+
|
37
|
+
/**
|
38
|
+
*
|
39
|
+
*/
|
40
|
+
public
|
41
|
+
HelperNodeList()
|
42
|
+
{
|
43
|
+
this(false);
|
44
|
+
}
|
45
|
+
|
46
|
+
|
47
|
+
/**
|
48
|
+
* @param allNodesMustHaveSameParent
|
49
|
+
*/
|
50
|
+
public
|
51
|
+
HelperNodeList(boolean allNodesMustHaveSameParent)
|
52
|
+
{
|
53
|
+
this.allNodesMustHaveSameParent = allNodesMustHaveSameParent;
|
54
|
+
}
|
55
|
+
|
56
|
+
/**
|
57
|
+
* Method item
|
58
|
+
*
|
59
|
+
* @param index
|
60
|
+
* @return node with index i
|
61
|
+
*/
|
62
|
+
public Node
|
63
|
+
item(int index)
|
64
|
+
{
|
65
|
+
return nodes.get(index);
|
66
|
+
}
|
67
|
+
|
68
|
+
/**
|
69
|
+
* Method getLength
|
70
|
+
*
|
71
|
+
* @return length of the list
|
72
|
+
*/
|
73
|
+
public int
|
74
|
+
getLength()
|
75
|
+
{
|
76
|
+
return nodes.size();
|
77
|
+
}
|
78
|
+
|
79
|
+
/**
|
80
|
+
* Method appendChild
|
81
|
+
*
|
82
|
+
* @param node
|
83
|
+
* @throws IllegalArgumentException
|
84
|
+
*/
|
85
|
+
public void
|
86
|
+
appendChild(Node node) throws IllegalArgumentException
|
87
|
+
{
|
88
|
+
if (this.allNodesMustHaveSameParent && this.getLength() > 0
|
89
|
+
&& this.item(0).getParentNode() != node.getParentNode()) {
|
90
|
+
throw new IllegalArgumentException("Nodes have not the same Parent");
|
91
|
+
}
|
92
|
+
nodes.add(node);
|
93
|
+
}
|
94
|
+
|
95
|
+
/**
|
96
|
+
* @return the document that contains this nodelist
|
97
|
+
*/
|
98
|
+
public Document
|
99
|
+
getOwnerDocument()
|
100
|
+
{
|
101
|
+
if (this.getLength() == 0) {
|
102
|
+
return null;
|
103
|
+
}
|
104
|
+
return XMLUtils.getOwnerDocument(this.item(0));
|
105
|
+
}
|
106
|
+
}
|
@@ -0,0 +1,86 @@
|
|
1
|
+
/**
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
4
|
+
* distributed with this work for additional information
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
7
|
+
* "License"); you may not use this file except in compliance
|
8
|
+
* with the License. You may obtain a copy of the License at
|
9
|
+
*
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
*
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
13
|
+
* software distributed under the License is distributed on an
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
* KIND, either express or implied. See the License for the
|
16
|
+
* specific language governing permissions and limitations
|
17
|
+
* under the License.
|
18
|
+
*/
|
19
|
+
package nokogiri.internals.c14n;
|
20
|
+
|
21
|
+
import org.xml.sax.ErrorHandler;
|
22
|
+
import org.xml.sax.SAXException;
|
23
|
+
import org.xml.sax.SAXParseException;
|
24
|
+
|
25
|
+
/**
|
26
|
+
* This {@link org.xml.sax.ErrorHandler} does absolutely nothing but log
|
27
|
+
* the events.
|
28
|
+
*
|
29
|
+
* @author Christian Geuer-Pollmann
|
30
|
+
*/
|
31
|
+
public class IgnoreAllErrorHandler implements ErrorHandler
|
32
|
+
{
|
33
|
+
|
34
|
+
/** Field throwExceptions */
|
35
|
+
private static final boolean warnOnExceptions =
|
36
|
+
System.getProperty("org.apache.xml.security.test.warn.on.exceptions", "false").equals("true");
|
37
|
+
|
38
|
+
/** Field throwExceptions */
|
39
|
+
private static final boolean throwExceptions =
|
40
|
+
System.getProperty("org.apache.xml.security.test.throw.exceptions", "false").equals("true");
|
41
|
+
|
42
|
+
|
43
|
+
/** @inheritDoc */
|
44
|
+
public void
|
45
|
+
warning(SAXParseException ex) throws SAXException
|
46
|
+
{
|
47
|
+
if (IgnoreAllErrorHandler.warnOnExceptions) {
|
48
|
+
// TODO
|
49
|
+
// get handler from upper layer
|
50
|
+
//log.warn("", ex);
|
51
|
+
}
|
52
|
+
if (IgnoreAllErrorHandler.throwExceptions) {
|
53
|
+
throw ex;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
|
58
|
+
/** @inheritDoc */
|
59
|
+
public void
|
60
|
+
error(SAXParseException ex) throws SAXException
|
61
|
+
{
|
62
|
+
if (IgnoreAllErrorHandler.warnOnExceptions) {
|
63
|
+
// TODO
|
64
|
+
// get handler from upper layer
|
65
|
+
//log.error("", ex);
|
66
|
+
}
|
67
|
+
if (IgnoreAllErrorHandler.throwExceptions) {
|
68
|
+
throw ex;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
|
73
|
+
/** @inheritDoc */
|
74
|
+
public void
|
75
|
+
fatalError(SAXParseException ex) throws SAXException
|
76
|
+
{
|
77
|
+
if (IgnoreAllErrorHandler.warnOnExceptions) {
|
78
|
+
// TODO
|
79
|
+
// get handler from upper layer
|
80
|
+
//log.warn("", ex);
|
81
|
+
}
|
82
|
+
if (IgnoreAllErrorHandler.throwExceptions) {
|
83
|
+
throw ex;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
}
|
@@ -0,0 +1,181 @@
|
|
1
|
+
/**
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
4
|
+
* distributed with this work for additional information
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
7
|
+
* "License"); you may not use this file except in compliance
|
8
|
+
* with the License. You may obtain a copy of the License at
|
9
|
+
*
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
*
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
13
|
+
* software distributed under the License is distributed on an
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
* KIND, either express or implied. See the License for the
|
16
|
+
* specific language governing permissions and limitations
|
17
|
+
* under the License.
|
18
|
+
*/
|
19
|
+
package nokogiri.internals.c14n;
|
20
|
+
|
21
|
+
import java.util.Set;
|
22
|
+
import java.util.SortedSet;
|
23
|
+
import java.util.TreeSet;
|
24
|
+
//import nokogiri.internals.org.apache.xml.security.exceptions.XMLSecurityException;
|
25
|
+
//import nokogiri.internals.org.apache.xml.security.transforms.TransformParam;
|
26
|
+
import org.w3c.dom.Document;
|
27
|
+
import org.w3c.dom.Element;
|
28
|
+
|
29
|
+
/**
|
30
|
+
* This Object serves as Content for the ds:Transforms for exclusive
|
31
|
+
* Canonicalization.
|
32
|
+
* <BR />
|
33
|
+
* It implements the {@link Element} interface
|
34
|
+
* and can be used directly in a DOM tree.
|
35
|
+
*
|
36
|
+
* @author Christian Geuer-Pollmann
|
37
|
+
*/
|
38
|
+
//public class InclusiveNamespaces extends ElementProxy implements TransformParam {
|
39
|
+
public class InclusiveNamespaces extends ElementProxy
|
40
|
+
{
|
41
|
+
|
42
|
+
/** Field _TAG_EC_INCLUSIVENAMESPACES */
|
43
|
+
public static final String _TAG_EC_INCLUSIVENAMESPACES =
|
44
|
+
"InclusiveNamespaces";
|
45
|
+
|
46
|
+
/** Field _ATT_EC_PREFIXLIST */
|
47
|
+
public static final String _ATT_EC_PREFIXLIST = "PrefixList";
|
48
|
+
|
49
|
+
/** Field ExclusiveCanonicalizationNamespace */
|
50
|
+
public static final String ExclusiveCanonicalizationNamespace =
|
51
|
+
"http://www.w3.org/2001/10/xml-exc-c14n#";
|
52
|
+
|
53
|
+
/**
|
54
|
+
* Constructor XPathContainer
|
55
|
+
*
|
56
|
+
* @param doc
|
57
|
+
* @param prefixList
|
58
|
+
*/
|
59
|
+
public
|
60
|
+
InclusiveNamespaces(Document doc, String prefixList)
|
61
|
+
{
|
62
|
+
this(doc, InclusiveNamespaces.prefixStr2Set(prefixList));
|
63
|
+
}
|
64
|
+
|
65
|
+
/**
|
66
|
+
* Constructor InclusiveNamespaces
|
67
|
+
*
|
68
|
+
* @param doc
|
69
|
+
* @param prefixes
|
70
|
+
*/
|
71
|
+
public
|
72
|
+
InclusiveNamespaces(Document doc, Set<String> prefixes)
|
73
|
+
{
|
74
|
+
super(doc);
|
75
|
+
|
76
|
+
SortedSet<String> prefixList;
|
77
|
+
if (prefixes instanceof SortedSet<?>) {
|
78
|
+
prefixList = (SortedSet<String>)prefixes;
|
79
|
+
} else {
|
80
|
+
prefixList = new TreeSet<String>(prefixes);
|
81
|
+
}
|
82
|
+
|
83
|
+
StringBuilder sb = new StringBuilder(prefixList.size() * 8);
|
84
|
+
for (String prefix : prefixList) {
|
85
|
+
if (prefix.equals("xmlns")) {
|
86
|
+
sb.append("#default ");
|
87
|
+
} else {
|
88
|
+
sb.append(prefix).append(' ');
|
89
|
+
}
|
90
|
+
}
|
91
|
+
int last = sb.length() - 1;
|
92
|
+
while (last >= 0 && sb.charAt(last) == ' ') { sb.setLength(last--); } // trim
|
93
|
+
|
94
|
+
this.constructionElement.setAttributeNS(null, InclusiveNamespaces._ATT_EC_PREFIXLIST, sb.toString());
|
95
|
+
}
|
96
|
+
|
97
|
+
/**
|
98
|
+
* Constructor InclusiveNamespaces
|
99
|
+
*
|
100
|
+
* @param element
|
101
|
+
* @param BaseURI
|
102
|
+
* @throws XMLSecurityException
|
103
|
+
*/
|
104
|
+
public
|
105
|
+
InclusiveNamespaces(Element element, String BaseURI)
|
106
|
+
throws CanonicalizationException
|
107
|
+
{
|
108
|
+
super(element, BaseURI);
|
109
|
+
}
|
110
|
+
|
111
|
+
/**
|
112
|
+
* Method getInclusiveNamespaces
|
113
|
+
*
|
114
|
+
* @return The Inclusive Namespace string
|
115
|
+
*/
|
116
|
+
public String
|
117
|
+
getInclusiveNamespaces()
|
118
|
+
{
|
119
|
+
return this.constructionElement.getAttributeNS(null, InclusiveNamespaces._ATT_EC_PREFIXLIST);
|
120
|
+
}
|
121
|
+
|
122
|
+
/**
|
123
|
+
* Decodes the <code>inclusiveNamespaces</code> String and returns all
|
124
|
+
* selected namespace prefixes as a Set. The <code>#default</code>
|
125
|
+
* namespace token is represented as an empty namespace prefix
|
126
|
+
* (<code>"xmlns"</code>).
|
127
|
+
* <BR/>
|
128
|
+
* The String <code>inclusiveNamespaces=" xenc ds #default"</code>
|
129
|
+
* is returned as a Set containing the following Strings:
|
130
|
+
* <UL>
|
131
|
+
* <LI><code>xmlns</code></LI>
|
132
|
+
* <LI><code>xenc</code></LI>
|
133
|
+
* <LI><code>ds</code></LI>
|
134
|
+
* </UL>
|
135
|
+
*
|
136
|
+
* @param inclusiveNamespaces
|
137
|
+
* @return A set to string
|
138
|
+
*/
|
139
|
+
public static SortedSet<String>
|
140
|
+
prefixStr2Set(String inclusiveNamespaces)
|
141
|
+
{
|
142
|
+
SortedSet<String> prefixes = new TreeSet<String>();
|
143
|
+
|
144
|
+
if ((inclusiveNamespaces == null) || (inclusiveNamespaces.length() == 0)) {
|
145
|
+
return prefixes;
|
146
|
+
}
|
147
|
+
|
148
|
+
String[] tokens = inclusiveNamespaces.split("\\s");
|
149
|
+
for (String prefix : tokens) {
|
150
|
+
if (prefix.equals("#default")) {
|
151
|
+
prefixes.add("xmlns");
|
152
|
+
} else {
|
153
|
+
prefixes.add(prefix);
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
return prefixes;
|
158
|
+
}
|
159
|
+
|
160
|
+
/**
|
161
|
+
* Method getBaseNamespace
|
162
|
+
*
|
163
|
+
* @inheritDoc
|
164
|
+
*/
|
165
|
+
public String
|
166
|
+
getBaseNamespace()
|
167
|
+
{
|
168
|
+
return InclusiveNamespaces.ExclusiveCanonicalizationNamespace;
|
169
|
+
}
|
170
|
+
|
171
|
+
/**
|
172
|
+
* Method getBaseLocalName
|
173
|
+
*
|
174
|
+
* @inheritDoc
|
175
|
+
*/
|
176
|
+
public String
|
177
|
+
getBaseLocalName()
|
178
|
+
{
|
179
|
+
return InclusiveNamespaces._TAG_EC_INCLUSIVENAMESPACES;
|
180
|
+
}
|
181
|
+
}
|
@@ -0,0 +1,87 @@
|
|
1
|
+
/**
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
4
|
+
* distributed with this work for additional information
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
7
|
+
* "License"); you may not use this file except in compliance
|
8
|
+
* with the License. You may obtain a copy of the License at
|
9
|
+
*
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
*
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
13
|
+
* software distributed under the License is distributed on an
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
* KIND, either express or implied. See the License for the
|
16
|
+
* specific language governing permissions and limitations
|
17
|
+
* under the License.
|
18
|
+
*/
|
19
|
+
package nokogiri.internals.c14n;
|
20
|
+
|
21
|
+
|
22
|
+
public class InvalidCanonicalizerException extends Exception
|
23
|
+
{
|
24
|
+
|
25
|
+
/**
|
26
|
+
*
|
27
|
+
*/
|
28
|
+
private static final long serialVersionUID = 1L;
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Constructor InvalidCanonicalizerException
|
32
|
+
*
|
33
|
+
*/
|
34
|
+
public
|
35
|
+
InvalidCanonicalizerException()
|
36
|
+
{
|
37
|
+
super();
|
38
|
+
}
|
39
|
+
|
40
|
+
/**
|
41
|
+
* Constructor InvalidCanonicalizerException
|
42
|
+
*
|
43
|
+
* @param message
|
44
|
+
*/
|
45
|
+
public
|
46
|
+
InvalidCanonicalizerException(String message)
|
47
|
+
{
|
48
|
+
super(message);
|
49
|
+
}
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Constructor InvalidCanonicalizerException
|
53
|
+
*
|
54
|
+
* @param message
|
55
|
+
* @param exArgs
|
56
|
+
*/
|
57
|
+
public
|
58
|
+
InvalidCanonicalizerException(String message, Object... exArgs)
|
59
|
+
{
|
60
|
+
super(C14nHelper.getErrorMessage(message, exArgs));
|
61
|
+
}
|
62
|
+
|
63
|
+
/**
|
64
|
+
* Constructor InvalidCanonicalizerException
|
65
|
+
*
|
66
|
+
* @param msgID
|
67
|
+
* @param originalException
|
68
|
+
*/
|
69
|
+
public
|
70
|
+
InvalidCanonicalizerException(String message, Exception rootCause)
|
71
|
+
{
|
72
|
+
super(message, rootCause);
|
73
|
+
}
|
74
|
+
|
75
|
+
/**
|
76
|
+
* Constructor InvalidCanonicalizerException
|
77
|
+
*
|
78
|
+
* @param msgID
|
79
|
+
* @param exArgs
|
80
|
+
* @param originalException
|
81
|
+
*/
|
82
|
+
public
|
83
|
+
InvalidCanonicalizerException(String message, Exception rootCause, Object... exArgs)
|
84
|
+
{
|
85
|
+
super(C14nHelper.getErrorMessage(message, exArgs), rootCause);
|
86
|
+
}
|
87
|
+
}
|