nokogiri-backport 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +3 -0
- data/LICENSE-DEPENDENCIES.md +1682 -0
- data/LICENSE.md +9 -0
- data/README.md +272 -0
- data/bin/nokogiri +118 -0
- data/dependencies.yml +74 -0
- data/ext/java/nokogiri/EncodingHandler.java +124 -0
- data/ext/java/nokogiri/HtmlDocument.java +178 -0
- data/ext/java/nokogiri/HtmlElementDescription.java +148 -0
- data/ext/java/nokogiri/HtmlEntityLookup.java +79 -0
- data/ext/java/nokogiri/HtmlSaxParserContext.java +282 -0
- data/ext/java/nokogiri/HtmlSaxPushParser.java +222 -0
- data/ext/java/nokogiri/NokogiriService.java +597 -0
- data/ext/java/nokogiri/XmlAttr.java +162 -0
- data/ext/java/nokogiri/XmlAttributeDecl.java +129 -0
- data/ext/java/nokogiri/XmlCdata.java +82 -0
- data/ext/java/nokogiri/XmlComment.java +97 -0
- data/ext/java/nokogiri/XmlDocument.java +633 -0
- data/ext/java/nokogiri/XmlDocumentFragment.java +185 -0
- data/ext/java/nokogiri/XmlDtd.java +481 -0
- data/ext/java/nokogiri/XmlElement.java +68 -0
- data/ext/java/nokogiri/XmlElementContent.java +382 -0
- data/ext/java/nokogiri/XmlElementDecl.java +147 -0
- data/ext/java/nokogiri/XmlEntityDecl.java +157 -0
- data/ext/java/nokogiri/XmlEntityReference.java +101 -0
- data/ext/java/nokogiri/XmlNamespace.java +199 -0
- data/ext/java/nokogiri/XmlNode.java +1684 -0
- data/ext/java/nokogiri/XmlNodeSet.java +434 -0
- data/ext/java/nokogiri/XmlProcessingInstruction.java +100 -0
- data/ext/java/nokogiri/XmlReader.java +531 -0
- data/ext/java/nokogiri/XmlRelaxng.java +151 -0
- data/ext/java/nokogiri/XmlSaxParserContext.java +374 -0
- data/ext/java/nokogiri/XmlSaxPushParser.java +286 -0
- data/ext/java/nokogiri/XmlSchema.java +388 -0
- data/ext/java/nokogiri/XmlSyntaxError.java +138 -0
- data/ext/java/nokogiri/XmlText.java +110 -0
- data/ext/java/nokogiri/XmlXpathContext.java +301 -0
- data/ext/java/nokogiri/XsltStylesheet.java +347 -0
- data/ext/java/nokogiri/internals/ClosedStreamException.java +10 -0
- data/ext/java/nokogiri/internals/HtmlDomParserContext.java +252 -0
- data/ext/java/nokogiri/internals/IgnoreSchemaErrorsErrorHandler.java +20 -0
- data/ext/java/nokogiri/internals/NokogiriBlockingQueueInputStream.java +151 -0
- data/ext/java/nokogiri/internals/NokogiriDomParser.java +116 -0
- data/ext/java/nokogiri/internals/NokogiriEntityResolver.java +121 -0
- data/ext/java/nokogiri/internals/NokogiriErrorHandler.java +69 -0
- data/ext/java/nokogiri/internals/NokogiriHandler.java +327 -0
- data/ext/java/nokogiri/internals/NokogiriHelpers.java +734 -0
- data/ext/java/nokogiri/internals/NokogiriNamespaceCache.java +217 -0
- data/ext/java/nokogiri/internals/NokogiriNamespaceContext.java +127 -0
- data/ext/java/nokogiri/internals/NokogiriNonStrictErrorHandler.java +100 -0
- data/ext/java/nokogiri/internals/NokogiriNonStrictErrorHandler4NekoHtml.java +121 -0
- data/ext/java/nokogiri/internals/NokogiriStrictErrorHandler.java +78 -0
- data/ext/java/nokogiri/internals/NokogiriXPathFunction.java +180 -0
- data/ext/java/nokogiri/internals/NokogiriXPathFunctionResolver.java +72 -0
- data/ext/java/nokogiri/internals/NokogiriXPathVariableResolver.java +60 -0
- data/ext/java/nokogiri/internals/NokogiriXsltErrorListener.java +87 -0
- data/ext/java/nokogiri/internals/ParserContext.java +259 -0
- data/ext/java/nokogiri/internals/ReaderNode.java +488 -0
- data/ext/java/nokogiri/internals/SaveContextVisitor.java +778 -0
- data/ext/java/nokogiri/internals/SchemaErrorHandler.java +73 -0
- data/ext/java/nokogiri/internals/XalanDTMManagerPatch.java +168 -0
- data/ext/java/nokogiri/internals/XmlDeclHandler.java +42 -0
- data/ext/java/nokogiri/internals/XmlDomParserContext.java +274 -0
- data/ext/java/nokogiri/internals/XmlSaxParser.java +65 -0
- data/ext/java/nokogiri/internals/c14n/AttrCompare.java +119 -0
- data/ext/java/nokogiri/internals/c14n/C14nHelper.java +159 -0
- data/ext/java/nokogiri/internals/c14n/CanonicalFilter.java +37 -0
- data/ext/java/nokogiri/internals/c14n/CanonicalizationException.java +93 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer.java +252 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer11.java +639 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer11_OmitComments.java +38 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer11_WithComments.java +38 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315.java +367 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315Excl.java +295 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315ExclOmitComments.java +40 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315ExclWithComments.java +44 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315OmitComments.java +44 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315WithComments.java +43 -0
- data/ext/java/nokogiri/internals/c14n/CanonicalizerBase.java +630 -0
- data/ext/java/nokogiri/internals/c14n/CanonicalizerPhysical.java +173 -0
- data/ext/java/nokogiri/internals/c14n/CanonicalizerSpi.java +76 -0
- data/ext/java/nokogiri/internals/c14n/Constants.java +42 -0
- data/ext/java/nokogiri/internals/c14n/ElementProxy.java +293 -0
- data/ext/java/nokogiri/internals/c14n/HelperNodeList.java +93 -0
- data/ext/java/nokogiri/internals/c14n/IgnoreAllErrorHandler.java +79 -0
- data/ext/java/nokogiri/internals/c14n/InclusiveNamespaces.java +166 -0
- data/ext/java/nokogiri/internals/c14n/InvalidCanonicalizerException.java +76 -0
- data/ext/java/nokogiri/internals/c14n/NameSpaceSymbTable.java +402 -0
- data/ext/java/nokogiri/internals/c14n/NodeFilter.java +51 -0
- data/ext/java/nokogiri/internals/c14n/UtfHelpper.java +179 -0
- data/ext/java/nokogiri/internals/c14n/XMLUtils.java +507 -0
- data/ext/java/nokogiri/internals/dom2dtm/DOM2DTM.java +1745 -0
- data/ext/java/nokogiri/internals/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java +685 -0
- data/ext/nokogiri/depend +477 -0
- data/ext/nokogiri/extconf.rb +836 -0
- data/ext/nokogiri/html_document.c +171 -0
- data/ext/nokogiri/html_document.h +10 -0
- data/ext/nokogiri/html_element_description.c +279 -0
- data/ext/nokogiri/html_element_description.h +10 -0
- data/ext/nokogiri/html_entity_lookup.c +32 -0
- data/ext/nokogiri/html_entity_lookup.h +8 -0
- data/ext/nokogiri/html_sax_parser_context.c +116 -0
- data/ext/nokogiri/html_sax_parser_context.h +11 -0
- data/ext/nokogiri/html_sax_push_parser.c +87 -0
- data/ext/nokogiri/html_sax_push_parser.h +9 -0
- data/ext/nokogiri/nokogiri.c +135 -0
- data/ext/nokogiri/nokogiri.h +130 -0
- data/ext/nokogiri/xml_attr.c +103 -0
- data/ext/nokogiri/xml_attr.h +9 -0
- data/ext/nokogiri/xml_attribute_decl.c +70 -0
- data/ext/nokogiri/xml_attribute_decl.h +9 -0
- data/ext/nokogiri/xml_cdata.c +62 -0
- data/ext/nokogiri/xml_cdata.h +9 -0
- data/ext/nokogiri/xml_comment.c +69 -0
- data/ext/nokogiri/xml_comment.h +9 -0
- data/ext/nokogiri/xml_document.c +622 -0
- data/ext/nokogiri/xml_document.h +23 -0
- data/ext/nokogiri/xml_document_fragment.c +48 -0
- data/ext/nokogiri/xml_document_fragment.h +10 -0
- data/ext/nokogiri/xml_dtd.c +202 -0
- data/ext/nokogiri/xml_dtd.h +10 -0
- data/ext/nokogiri/xml_element_content.c +123 -0
- data/ext/nokogiri/xml_element_content.h +10 -0
- data/ext/nokogiri/xml_element_decl.c +69 -0
- data/ext/nokogiri/xml_element_decl.h +9 -0
- data/ext/nokogiri/xml_encoding_handler.c +79 -0
- data/ext/nokogiri/xml_encoding_handler.h +8 -0
- data/ext/nokogiri/xml_entity_decl.c +110 -0
- data/ext/nokogiri/xml_entity_decl.h +10 -0
- data/ext/nokogiri/xml_entity_reference.c +52 -0
- data/ext/nokogiri/xml_entity_reference.h +9 -0
- data/ext/nokogiri/xml_io.c +63 -0
- data/ext/nokogiri/xml_io.h +11 -0
- data/ext/nokogiri/xml_libxml2_hacks.c +112 -0
- data/ext/nokogiri/xml_libxml2_hacks.h +12 -0
- data/ext/nokogiri/xml_namespace.c +111 -0
- data/ext/nokogiri/xml_namespace.h +14 -0
- data/ext/nokogiri/xml_node.c +1773 -0
- data/ext/nokogiri/xml_node.h +13 -0
- data/ext/nokogiri/xml_node_set.c +486 -0
- data/ext/nokogiri/xml_node_set.h +12 -0
- data/ext/nokogiri/xml_processing_instruction.c +56 -0
- data/ext/nokogiri/xml_processing_instruction.h +9 -0
- data/ext/nokogiri/xml_reader.c +657 -0
- data/ext/nokogiri/xml_reader.h +10 -0
- data/ext/nokogiri/xml_relax_ng.c +179 -0
- data/ext/nokogiri/xml_relax_ng.h +9 -0
- data/ext/nokogiri/xml_sax_parser.c +305 -0
- data/ext/nokogiri/xml_sax_parser.h +39 -0
- data/ext/nokogiri/xml_sax_parser_context.c +262 -0
- data/ext/nokogiri/xml_sax_parser_context.h +10 -0
- data/ext/nokogiri/xml_sax_push_parser.c +159 -0
- data/ext/nokogiri/xml_sax_push_parser.h +9 -0
- data/ext/nokogiri/xml_schema.c +276 -0
- data/ext/nokogiri/xml_schema.h +9 -0
- data/ext/nokogiri/xml_syntax_error.c +64 -0
- data/ext/nokogiri/xml_syntax_error.h +13 -0
- data/ext/nokogiri/xml_text.c +52 -0
- data/ext/nokogiri/xml_text.h +9 -0
- data/ext/nokogiri/xml_xpath_context.c +374 -0
- data/ext/nokogiri/xml_xpath_context.h +10 -0
- data/ext/nokogiri/xslt_stylesheet.c +263 -0
- data/ext/nokogiri/xslt_stylesheet.h +14 -0
- data/lib/isorelax.jar +0 -0
- data/lib/jing.jar +0 -0
- data/lib/nekodtd.jar +0 -0
- data/lib/nekohtml.jar +0 -0
- data/lib/nokogiri/css/node.rb +53 -0
- data/lib/nokogiri/css/parser.rb +751 -0
- data/lib/nokogiri/css/parser.y +272 -0
- data/lib/nokogiri/css/parser_extras.rb +94 -0
- data/lib/nokogiri/css/syntax_error.rb +8 -0
- data/lib/nokogiri/css/tokenizer.rb +154 -0
- data/lib/nokogiri/css/tokenizer.rex +55 -0
- data/lib/nokogiri/css/xpath_visitor.rb +260 -0
- data/lib/nokogiri/css.rb +28 -0
- data/lib/nokogiri/decorators/slop.rb +43 -0
- data/lib/nokogiri/html/builder.rb +36 -0
- data/lib/nokogiri/html/document.rb +322 -0
- data/lib/nokogiri/html/document_fragment.rb +50 -0
- data/lib/nokogiri/html/element_description.rb +24 -0
- data/lib/nokogiri/html/element_description_defaults.rb +672 -0
- data/lib/nokogiri/html/entity_lookup.rb +14 -0
- data/lib/nokogiri/html/sax/parser.rb +63 -0
- data/lib/nokogiri/html/sax/parser_context.rb +17 -0
- data/lib/nokogiri/html/sax/push_parser.rb +37 -0
- data/lib/nokogiri/html.rb +38 -0
- data/lib/nokogiri/jruby/dependencies.rb +20 -0
- data/lib/nokogiri/syntax_error.rb +5 -0
- data/lib/nokogiri/version/constant.rb +5 -0
- data/lib/nokogiri/version/info.rb +182 -0
- data/lib/nokogiri/version.rb +3 -0
- data/lib/nokogiri/xml/attr.rb +15 -0
- data/lib/nokogiri/xml/attribute_decl.rb +19 -0
- data/lib/nokogiri/xml/builder.rb +447 -0
- data/lib/nokogiri/xml/cdata.rb +12 -0
- data/lib/nokogiri/xml/character_data.rb +8 -0
- data/lib/nokogiri/xml/document.rb +290 -0
- data/lib/nokogiri/xml/document_fragment.rb +159 -0
- data/lib/nokogiri/xml/dtd.rb +33 -0
- data/lib/nokogiri/xml/element_content.rb +37 -0
- data/lib/nokogiri/xml/element_decl.rb +14 -0
- data/lib/nokogiri/xml/entity_decl.rb +20 -0
- data/lib/nokogiri/xml/entity_reference.rb +19 -0
- data/lib/nokogiri/xml/namespace.rb +14 -0
- data/lib/nokogiri/xml/node/save_options.rb +62 -0
- data/lib/nokogiri/xml/node.rb +1240 -0
- data/lib/nokogiri/xml/node_set.rb +372 -0
- data/lib/nokogiri/xml/notation.rb +7 -0
- data/lib/nokogiri/xml/parse_options.rb +127 -0
- data/lib/nokogiri/xml/pp/character_data.rb +19 -0
- data/lib/nokogiri/xml/pp/node.rb +57 -0
- data/lib/nokogiri/xml/pp.rb +3 -0
- data/lib/nokogiri/xml/processing_instruction.rb +9 -0
- data/lib/nokogiri/xml/reader.rb +116 -0
- data/lib/nokogiri/xml/relax_ng.rb +37 -0
- data/lib/nokogiri/xml/sax/document.rb +172 -0
- data/lib/nokogiri/xml/sax/parser.rb +123 -0
- data/lib/nokogiri/xml/sax/parser_context.rb +17 -0
- data/lib/nokogiri/xml/sax/push_parser.rb +61 -0
- data/lib/nokogiri/xml/sax.rb +5 -0
- data/lib/nokogiri/xml/schema.rb +72 -0
- data/lib/nokogiri/xml/searchable.rb +239 -0
- data/lib/nokogiri/xml/syntax_error.rb +71 -0
- data/lib/nokogiri/xml/text.rb +10 -0
- data/lib/nokogiri/xml/xpath/syntax_error.rb +12 -0
- data/lib/nokogiri/xml/xpath.rb +11 -0
- data/lib/nokogiri/xml/xpath_context.rb +17 -0
- data/lib/nokogiri/xml.rb +76 -0
- data/lib/nokogiri/xslt/stylesheet.rb +26 -0
- data/lib/nokogiri/xslt.rb +57 -0
- data/lib/nokogiri.rb +144 -0
- data/lib/serializer.jar +0 -0
- data/lib/xalan.jar +0 -0
- data/lib/xercesImpl.jar +0 -0
- data/lib/xml-apis.jar +0 -0
- data/lib/xsd/xmlparser/nokogiri.rb +103 -0
- metadata +531 -0
@@ -0,0 +1,79 @@
|
|
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
|
+
/** Field throwExceptions */
|
34
|
+
private static final boolean warnOnExceptions =
|
35
|
+
System.getProperty("org.apache.xml.security.test.warn.on.exceptions", "false").equals("true");
|
36
|
+
|
37
|
+
/** Field throwExceptions */
|
38
|
+
private static final boolean throwExceptions =
|
39
|
+
System.getProperty("org.apache.xml.security.test.throw.exceptions", "false").equals("true");
|
40
|
+
|
41
|
+
|
42
|
+
/** @inheritDoc */
|
43
|
+
public void warning(SAXParseException ex) throws SAXException {
|
44
|
+
if (IgnoreAllErrorHandler.warnOnExceptions) {
|
45
|
+
// TODO
|
46
|
+
// get handler from upper layer
|
47
|
+
//log.warn("", ex);
|
48
|
+
}
|
49
|
+
if (IgnoreAllErrorHandler.throwExceptions) {
|
50
|
+
throw ex;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
|
55
|
+
/** @inheritDoc */
|
56
|
+
public void error(SAXParseException ex) throws SAXException {
|
57
|
+
if (IgnoreAllErrorHandler.warnOnExceptions) {
|
58
|
+
// TODO
|
59
|
+
// get handler from upper layer
|
60
|
+
//log.error("", ex);
|
61
|
+
}
|
62
|
+
if (IgnoreAllErrorHandler.throwExceptions) {
|
63
|
+
throw ex;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
|
68
|
+
/** @inheritDoc */
|
69
|
+
public void fatalError(SAXParseException ex) throws SAXException {
|
70
|
+
if (IgnoreAllErrorHandler.warnOnExceptions) {
|
71
|
+
// TODO
|
72
|
+
// get handler from upper layer
|
73
|
+
//log.warn("", ex);
|
74
|
+
}
|
75
|
+
if (IgnoreAllErrorHandler.throwExceptions) {
|
76
|
+
throw ex;
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
@@ -0,0 +1,166 @@
|
|
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
|
+
/** Field _TAG_EC_INCLUSIVENAMESPACES */
|
42
|
+
public static final String _TAG_EC_INCLUSIVENAMESPACES =
|
43
|
+
"InclusiveNamespaces";
|
44
|
+
|
45
|
+
/** Field _ATT_EC_PREFIXLIST */
|
46
|
+
public static final String _ATT_EC_PREFIXLIST = "PrefixList";
|
47
|
+
|
48
|
+
/** Field ExclusiveCanonicalizationNamespace */
|
49
|
+
public static final String ExclusiveCanonicalizationNamespace =
|
50
|
+
"http://www.w3.org/2001/10/xml-exc-c14n#";
|
51
|
+
|
52
|
+
/**
|
53
|
+
* Constructor XPathContainer
|
54
|
+
*
|
55
|
+
* @param doc
|
56
|
+
* @param prefixList
|
57
|
+
*/
|
58
|
+
public InclusiveNamespaces(Document doc, String prefixList) {
|
59
|
+
this(doc, InclusiveNamespaces.prefixStr2Set(prefixList));
|
60
|
+
}
|
61
|
+
|
62
|
+
/**
|
63
|
+
* Constructor InclusiveNamespaces
|
64
|
+
*
|
65
|
+
* @param doc
|
66
|
+
* @param prefixes
|
67
|
+
*/
|
68
|
+
public InclusiveNamespaces(Document doc, Set<String> prefixes) {
|
69
|
+
super(doc);
|
70
|
+
|
71
|
+
SortedSet<String> prefixList;
|
72
|
+
if (prefixes instanceof SortedSet<?>) {
|
73
|
+
prefixList = (SortedSet<String>)prefixes;
|
74
|
+
} else {
|
75
|
+
prefixList = new TreeSet<String>(prefixes);
|
76
|
+
}
|
77
|
+
|
78
|
+
StringBuilder sb = new StringBuilder(prefixList.size() * 8);
|
79
|
+
for (String prefix : prefixList) {
|
80
|
+
if (prefix.equals("xmlns")) {
|
81
|
+
sb.append("#default ");
|
82
|
+
} else {
|
83
|
+
sb.append(prefix).append(' ');
|
84
|
+
}
|
85
|
+
}
|
86
|
+
int last = sb.length() - 1;
|
87
|
+
while (last >= 0 && sb.charAt(last) == ' ') sb.setLength(last--); // trim
|
88
|
+
|
89
|
+
this.constructionElement.setAttributeNS(null, InclusiveNamespaces._ATT_EC_PREFIXLIST, sb.toString());
|
90
|
+
}
|
91
|
+
|
92
|
+
/**
|
93
|
+
* Constructor InclusiveNamespaces
|
94
|
+
*
|
95
|
+
* @param element
|
96
|
+
* @param BaseURI
|
97
|
+
* @throws XMLSecurityException
|
98
|
+
*/
|
99
|
+
public InclusiveNamespaces(Element element, String BaseURI)
|
100
|
+
throws CanonicalizationException {
|
101
|
+
super(element, BaseURI);
|
102
|
+
}
|
103
|
+
|
104
|
+
/**
|
105
|
+
* Method getInclusiveNamespaces
|
106
|
+
*
|
107
|
+
* @return The Inclusive Namespace string
|
108
|
+
*/
|
109
|
+
public String getInclusiveNamespaces() {
|
110
|
+
return this.constructionElement.getAttributeNS(null, InclusiveNamespaces._ATT_EC_PREFIXLIST);
|
111
|
+
}
|
112
|
+
|
113
|
+
/**
|
114
|
+
* Decodes the <code>inclusiveNamespaces</code> String and returns all
|
115
|
+
* selected namespace prefixes as a Set. The <code>#default</code>
|
116
|
+
* namespace token is represented as an empty namespace prefix
|
117
|
+
* (<code>"xmlns"</code>).
|
118
|
+
* <BR/>
|
119
|
+
* The String <code>inclusiveNamespaces=" xenc ds #default"</code>
|
120
|
+
* is returned as a Set containing the following Strings:
|
121
|
+
* <UL>
|
122
|
+
* <LI><code>xmlns</code></LI>
|
123
|
+
* <LI><code>xenc</code></LI>
|
124
|
+
* <LI><code>ds</code></LI>
|
125
|
+
* </UL>
|
126
|
+
*
|
127
|
+
* @param inclusiveNamespaces
|
128
|
+
* @return A set to string
|
129
|
+
*/
|
130
|
+
public static SortedSet<String> prefixStr2Set(String inclusiveNamespaces) {
|
131
|
+
SortedSet<String> prefixes = new TreeSet<String>();
|
132
|
+
|
133
|
+
if ((inclusiveNamespaces == null) || (inclusiveNamespaces.length() == 0)) {
|
134
|
+
return prefixes;
|
135
|
+
}
|
136
|
+
|
137
|
+
String[] tokens = inclusiveNamespaces.split("\\s");
|
138
|
+
for (String prefix : tokens) {
|
139
|
+
if (prefix.equals("#default")) {
|
140
|
+
prefixes.add("xmlns");
|
141
|
+
} else {
|
142
|
+
prefixes.add(prefix);
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
146
|
+
return prefixes;
|
147
|
+
}
|
148
|
+
|
149
|
+
/**
|
150
|
+
* Method getBaseNamespace
|
151
|
+
*
|
152
|
+
* @inheritDoc
|
153
|
+
*/
|
154
|
+
public String getBaseNamespace() {
|
155
|
+
return InclusiveNamespaces.ExclusiveCanonicalizationNamespace;
|
156
|
+
}
|
157
|
+
|
158
|
+
/**
|
159
|
+
* Method getBaseLocalName
|
160
|
+
*
|
161
|
+
* @inheritDoc
|
162
|
+
*/
|
163
|
+
public String getBaseLocalName() {
|
164
|
+
return InclusiveNamespaces._TAG_EC_INCLUSIVENAMESPACES;
|
165
|
+
}
|
166
|
+
}
|
@@ -0,0 +1,76 @@
|
|
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
|
+
private static final long serialVersionUID = 1L;
|
28
|
+
|
29
|
+
/**
|
30
|
+
* Constructor InvalidCanonicalizerException
|
31
|
+
*
|
32
|
+
*/
|
33
|
+
public InvalidCanonicalizerException() {
|
34
|
+
super();
|
35
|
+
}
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Constructor InvalidCanonicalizerException
|
39
|
+
*
|
40
|
+
* @param message
|
41
|
+
*/
|
42
|
+
public InvalidCanonicalizerException(String message) {
|
43
|
+
super(message);
|
44
|
+
}
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Constructor InvalidCanonicalizerException
|
48
|
+
*
|
49
|
+
* @param message
|
50
|
+
* @param exArgs
|
51
|
+
*/
|
52
|
+
public InvalidCanonicalizerException(String message, Object... exArgs) {
|
53
|
+
super(C14nHelper.getErrorMessage(message, exArgs));
|
54
|
+
}
|
55
|
+
|
56
|
+
/**
|
57
|
+
* Constructor InvalidCanonicalizerException
|
58
|
+
*
|
59
|
+
* @param msgID
|
60
|
+
* @param originalException
|
61
|
+
*/
|
62
|
+
public InvalidCanonicalizerException(String message, Exception rootCause) {
|
63
|
+
super(message, rootCause);
|
64
|
+
}
|
65
|
+
|
66
|
+
/**
|
67
|
+
* Constructor InvalidCanonicalizerException
|
68
|
+
*
|
69
|
+
* @param msgID
|
70
|
+
* @param exArgs
|
71
|
+
* @param originalException
|
72
|
+
*/
|
73
|
+
public InvalidCanonicalizerException(String message, Exception rootCause, Object... exArgs) {
|
74
|
+
super(C14nHelper.getErrorMessage(message, exArgs), rootCause);
|
75
|
+
}
|
76
|
+
}
|