gss 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/gss.gemspec +25 -0
- data/lib/gss.rb +62 -0
- data/lib/gss/version.rb +3 -0
- data/vendor/bundle/ruby/1.9.1/bin/nokogiri +23 -0
- data/vendor/bundle/ruby/1.9.1/bin/nokogiri.bat +6 -0
- data/vendor/bundle/ruby/1.9.1/bin/rake +23 -0
- data/vendor/bundle/ruby/1.9.1/bin/rake.bat +6 -0
- data/vendor/bundle/ruby/1.9.1/build_info/certified-0.1.2.info +1 -0
- data/vendor/bundle/ruby/1.9.1/build_info/mini_portile-0.6.0.info +1 -0
- data/vendor/bundle/ruby/1.9.1/build_info/nokogiri-1.6.2.1-x86-mingw32.info +1 -0
- data/vendor/bundle/ruby/1.9.1/build_info/rake-0.9.2.2.info +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/certified-0.1.2/README.md +5 -0
- data/vendor/bundle/ruby/1.9.1/gems/certified-0.1.2/certified.rb +20 -0
- data/vendor/bundle/ruby/1.9.1/gems/certified-0.1.2/certs/ca-bundle.crt +3376 -0
- data/vendor/bundle/ruby/1.9.1/gems/mini_portile-0.6.0/History.txt +86 -0
- data/vendor/bundle/ruby/1.9.1/gems/mini_portile-0.6.0/LICENSE.txt +20 -0
- data/vendor/bundle/ruby/1.9.1/gems/mini_portile-0.6.0/README.rdoc +169 -0
- data/vendor/bundle/ruby/1.9.1/gems/mini_portile-0.6.0/Rakefile +53 -0
- data/vendor/bundle/ruby/1.9.1/gems/mini_portile-0.6.0/examples/Rakefile +113 -0
- data/vendor/bundle/ruby/1.9.1/gems/mini_portile-0.6.0/lib/mini_portile.rb +437 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/.autotest +26 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/.editorconfig +17 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/.gemtest +0 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/.travis.yml +27 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/CHANGELOG.ja.rdoc +889 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/CHANGELOG.rdoc +898 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/C_CODING_STYLE.rdoc +33 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/Gemfile +21 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/Manifest.txt +377 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/README.ja.rdoc +111 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/README.rdoc +180 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ROADMAP.md +89 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/Rakefile +356 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/STANDARD_RESPONSES.md +47 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/Y_U_NO_GEMSPEC.md +155 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/bin/nokogiri +78 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/build_all +130 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/dependencies.yml +4 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/depend +358 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/extconf.rb +543 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/html_document.c +170 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/html_document.h +10 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/html_element_description.c +279 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/html_element_description.h +10 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/html_entity_lookup.c +32 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/html_entity_lookup.h +8 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/html_sax_parser_context.c +116 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/html_sax_parser_context.h +11 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/html_sax_push_parser.c +87 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/html_sax_push_parser.h +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/nokogiri.c +148 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/nokogiri.h +164 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_attr.c +94 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_attr.h +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_attribute_decl.c +70 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_attribute_decl.h +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_cdata.c +56 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_cdata.h +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_comment.c +54 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_comment.h +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_document.c +577 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_document.h +23 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_document_fragment.c +48 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_document_fragment.h +10 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_dtd.c +202 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_dtd.h +10 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_element_content.c +123 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_element_content.h +10 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_element_decl.c +69 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_element_decl.h +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_encoding_handler.c +79 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_encoding_handler.h +8 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_entity_decl.c +110 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_entity_decl.h +10 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_entity_reference.c +52 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_entity_reference.h +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_io.c +56 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_io.h +11 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_libxml2_hacks.c +112 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_libxml2_hacks.h +12 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_namespace.c +78 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_namespace.h +13 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_node.c +1603 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_node.h +13 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_node_set.c +467 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_node_set.h +14 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_processing_instruction.c +56 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_processing_instruction.h +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_reader.c +681 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_reader.h +10 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_relax_ng.c +161 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_relax_ng.h +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_sax_parser.c +312 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_sax_parser.h +39 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_sax_parser_context.c +262 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_sax_parser_context.h +10 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_sax_push_parser.c +115 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_sax_push_parser.h +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_schema.c +205 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_schema.h +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_syntax_error.c +63 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_syntax_error.h +13 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_text.c +52 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_text.h +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_xpath_context.c +307 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_xpath_context.h +10 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xslt_stylesheet.c +270 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xslt_stylesheet.h +14 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri.rb +137 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/css.rb +27 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/css/node.rb +52 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/css/parser.rb +715 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/css/parser.y +249 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/css/parser_extras.rb +91 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/css/syntax_error.rb +7 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/css/tokenizer.rb +152 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/css/tokenizer.rex +55 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/css/xpath_visitor.rb +219 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/decorators/slop.rb +35 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/html.rb +37 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/html/builder.rb +35 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/html/document.rb +333 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/html/document_fragment.rb +41 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/html/element_description.rb +23 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/html/element_description_defaults.rb +671 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/html/entity_lookup.rb +13 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/html/sax/parser.rb +52 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/html/sax/parser_context.rb +16 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/html/sax/push_parser.rb +16 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/syntax_error.rb +4 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/version.rb +106 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml.rb +73 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/attr.rb +14 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/attribute_decl.rb +18 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/builder.rb +443 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/cdata.rb +11 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/character_data.rb +7 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/document.rb +279 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/document_fragment.rb +112 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/dtd.rb +32 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/element_content.rb +36 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/element_decl.rb +13 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/entity_decl.rb +19 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/namespace.rb +13 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/node.rb +982 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/node/save_options.rb +61 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/node_set.rb +355 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/notation.rb +6 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/parse_options.rb +98 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/pp.rb +2 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/pp/character_data.rb +18 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/pp/node.rb +56 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/processing_instruction.rb +8 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/reader.rb +112 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/relax_ng.rb +32 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/sax.rb +4 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/sax/document.rb +171 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/sax/parser.rb +123 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/sax/parser_context.rb +16 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/sax/push_parser.rb +60 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/schema.rb +63 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/syntax_error.rb +47 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/text.rb +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/xpath.rb +10 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/xpath/syntax_error.rb +11 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xml/xpath_context.rb +16 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xslt.rb +56 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/nokogiri/xslt/stylesheet.rb +25 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/lib/xsd/xmlparser/nokogiri.rb +102 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/suppressions/README.txt +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/suppressions/nokogiri_ree-1.8.7.358.supp +61 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/suppressions/nokogiri_ruby-1.8.7.370.supp +0 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/suppressions/nokogiri_ruby-1.9.2.320.supp +28 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/suppressions/nokogiri_ruby-1.9.3.327.supp +28 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/tasks/nokogiri.org.rb +24 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/tasks/test.rb +95 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/css/test_nthiness.rb +222 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/css/test_parser.rb +358 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/css/test_tokenizer.rb +198 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/css/test_xpath_visitor.rb +96 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/decorators/test_slop.rb +16 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/2ch.html +108 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/address_book.rlx +12 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/address_book.xml +10 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/atom.xml +344 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/bar/bar.xsd +4 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/bogus.xml +0 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/dont_hurt_em_why.xml +422 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/encoding.html +82 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/encoding.xhtml +84 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/exslt.xml +8 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/exslt.xslt +35 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/foo/foo.xsd +4 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/metacharset.html +10 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/noencoding.html +47 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/po.xml +32 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/po.xsd +66 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/saml/saml20assertion_schema.xsd +283 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/saml/saml20protocol_schema.xsd +302 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/saml/xenc_schema.xsd +146 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/saml/xmldsig_schema.xsd +318 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/shift_jis.html +10 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/shift_jis.xml +5 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/shift_jis_no_charset.html +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/slow-xpath.xml +25509 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/snuggles.xml +3 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/staff.dtd +10 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/staff.xml +59 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/staff.xslt +32 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/test_document_url/bar.xml +2 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/test_document_url/document.dtd +4 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/test_document_url/document.xml +6 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/tlm.html +850 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/to_be_xincluded.xml +2 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/valid_bar.xml +2 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/files/xinclude.xml +4 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/helper.rb +164 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/html/sax/test_parser.rb +141 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/html/sax/test_parser_context.rb +46 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/html/test_builder.rb +164 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/html/test_document.rb +619 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/html/test_document_encoding.rb +148 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/html/test_document_fragment.rb +267 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/html/test_element_description.rb +105 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/html/test_named_characters.rb +14 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/html/test_node.rb +196 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/html/test_node_encoding.rb +27 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/namespaces/test_additional_namespaces_in_builder_doc.rb +14 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/namespaces/test_namespaces_aliased_default.rb +24 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/namespaces/test_namespaces_in_builder_doc.rb +75 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/namespaces/test_namespaces_in_cloned_doc.rb +31 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/namespaces/test_namespaces_in_created_doc.rb +75 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/namespaces/test_namespaces_in_parsed_doc.rb +66 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/namespaces/test_namespaces_preservation.rb +31 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/test_convert_xpath.rb +135 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/test_css_cache.rb +45 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/test_encoding_handler.rb +46 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/test_memory_leak.rb +156 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/test_nokogiri.rb +138 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/test_reader.rb +558 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/test_soap4r_sax.rb +52 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/test_xslt_transforms.rb +279 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/node/test_save_options.rb +28 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/node/test_subclass.rb +44 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/sax/test_parser.rb +382 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/sax/test_parser_context.rb +115 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/sax/test_push_parser.rb +157 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_attr.rb +64 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_attribute_decl.rb +86 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_builder.rb +315 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_c14n.rb +161 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_cdata.rb +48 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_comment.rb +29 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_document.rb +934 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_document_encoding.rb +28 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_document_fragment.rb +228 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_dtd.rb +187 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_dtd_encoding.rb +33 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_element_content.rb +56 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_element_decl.rb +73 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_entity_decl.rb +122 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_entity_reference.rb +245 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_namespace.rb +95 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_node.rb +1155 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_node_attributes.rb +113 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_node_encoding.rb +107 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_node_inheritance.rb +32 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_node_reparenting.rb +374 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_node_set.rb +755 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_parse_options.rb +64 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_processing_instruction.rb +30 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_reader_encoding.rb +142 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_relax_ng.rb +60 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_schema.rb +129 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_syntax_error.rb +12 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_text.rb +60 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_unparented_node.rb +422 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_xinclude.rb +83 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xml/test_xpath.rb +382 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xslt/test_custom_functions.rb +133 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test/xslt/test_exception_handling.rb +37 -0
- data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/test_all +81 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/.gemtest +0 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/CHANGES +522 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/README.rdoc +197 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/Rakefile +369 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/TODO +20 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/bin/rake +33 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/install.rb +90 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake.rb +69 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/alt_system.rb +109 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb +595 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/classic_namespace.rb +11 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/clean.rb +32 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/cloneable.rb +25 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/contrib/compositepublisher.rb +21 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/contrib/ftptools.rb +150 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/contrib/publisher.rb +73 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/contrib/rubyforgepublisher.rb +16 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/contrib/sshpublisher.rb +50 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/contrib/sys.rb +191 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/default_loader.rb +10 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/dsl_definition.rb +176 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/early_time.rb +18 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/ext/core.rb +27 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/ext/module.rb +39 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/ext/string.rb +167 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/ext/time.rb +14 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/file_creation_task.rb +24 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/file_list.rb +403 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/file_task.rb +47 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/file_utils.rb +114 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb +145 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/gempackagetask.rb +15 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/invocation_chain.rb +51 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/invocation_exception_mixin.rb +16 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/loaders/makefile.rb +40 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/multi_task.rb +16 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/name_space.rb +25 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/packagetask.rb +185 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/pathmap.rb +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/pseudo_status.rb +24 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/rake_module.rb +29 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb +22 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/rdoctask.rb +234 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/ruby182_test_unit_fix.rb +25 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/rule_recursion_overflow_error.rb +20 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/runtest.rb +21 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb +327 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task_argument_error.rb +7 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task_arguments.rb +78 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task_manager.rb +307 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb +22 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/testtask.rb +191 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/version.rb +8 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/win32.rb +55 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/file_creation.rb +34 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/helper.rb +492 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake.rb +40 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_application.rb +489 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_application_options.rb +335 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_clean.rb +14 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_definitions.rb +80 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_directory_task.rb +46 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_dsl.rb +77 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_early_time.rb +31 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_extension.rb +59 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_file_creation_task.rb +56 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_file_list.rb +628 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_file_list_path_map.rb +8 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_file_task.rb +102 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_file_utils.rb +305 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_ftp_file.rb +59 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_functional.rb +450 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_invocation_chain.rb +52 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_makefile_loader.rb +44 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_multi_task.rb +51 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_name_space.rb +43 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_package_task.rb +79 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_path_map.rb +157 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_path_map_explode.rb +34 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_path_map_partial.rb +18 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_pseudo_status.rb +21 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_rake_test_loader.rb +21 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_rdoc_task.rb +83 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_require.rb +40 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_rules.rb +327 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_task.rb +267 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_task_argument_parsing.rb +103 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_task_arguments.rb +88 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_task_lib.rb +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_task_manager.rb +157 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_task_manager_argument_resolution.rb +36 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_task_with_arguments.rb +173 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_test_task.rb +120 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_top_level_functions.rb +111 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_win32.rb +72 -0
- data/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_sys.rb +20 -0
- data/vendor/bundle/ruby/1.9.1/specifications/certified-0.1.2.gemspec +20 -0
- data/vendor/bundle/ruby/1.9.1/specifications/mini_portile-0.6.0.gemspec +24 -0
- data/vendor/bundle/ruby/1.9.1/specifications/nokogiri-1.6.2.1-x86-mingw32.gemspec +73 -0
- data/vendor/bundle/ruby/1.9.1/specifications/rake-0.9.2.2.gemspec +37 -0
- metadata +489 -0
data/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.6.2.1-x86-mingw32/ext/nokogiri/xml_libxml2_hacks.h
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#ifndef HAVE_XMLFIRSTELEMENTCHILD
|
2
|
+
|
3
|
+
#ifndef XML_LIBXML2_HACKS
|
4
|
+
#define XML_LIBXML2_HACKS
|
5
|
+
|
6
|
+
xmlNodePtr xmlFirstElementChild(xmlNodePtr parent);
|
7
|
+
xmlNodePtr xmlNextElementSibling(xmlNodePtr node);
|
8
|
+
xmlNodePtr xmlLastElementChild(xmlNodePtr parent);
|
9
|
+
|
10
|
+
#endif
|
11
|
+
|
12
|
+
#endif
|
@@ -0,0 +1,78 @@
|
|
1
|
+
#include <xml_namespace.h>
|
2
|
+
|
3
|
+
VALUE cNokogiriXmlNamespace ;
|
4
|
+
|
5
|
+
/*
|
6
|
+
* call-seq:
|
7
|
+
* prefix
|
8
|
+
*
|
9
|
+
* Get the prefix for this namespace. Returns +nil+ if there is no prefix.
|
10
|
+
*/
|
11
|
+
static VALUE prefix(VALUE self)
|
12
|
+
{
|
13
|
+
xmlNsPtr ns;
|
14
|
+
|
15
|
+
Data_Get_Struct(self, xmlNs, ns);
|
16
|
+
if(!ns->prefix) return Qnil;
|
17
|
+
|
18
|
+
return NOKOGIRI_STR_NEW2(ns->prefix);
|
19
|
+
}
|
20
|
+
|
21
|
+
/*
|
22
|
+
* call-seq:
|
23
|
+
* href
|
24
|
+
*
|
25
|
+
* Get the href for this namespace
|
26
|
+
*/
|
27
|
+
static VALUE href(VALUE self)
|
28
|
+
{
|
29
|
+
xmlNsPtr ns;
|
30
|
+
|
31
|
+
Data_Get_Struct(self, xmlNs, ns);
|
32
|
+
if(!ns->href) return Qnil;
|
33
|
+
|
34
|
+
return NOKOGIRI_STR_NEW2(ns->href);
|
35
|
+
}
|
36
|
+
|
37
|
+
VALUE Nokogiri_wrap_xml_namespace(xmlDocPtr doc, xmlNsPtr node)
|
38
|
+
{
|
39
|
+
VALUE ns, document, node_cache;
|
40
|
+
|
41
|
+
assert(doc->_private);
|
42
|
+
|
43
|
+
if(node->_private)
|
44
|
+
return (VALUE)node->_private;
|
45
|
+
|
46
|
+
ns = Data_Wrap_Struct(cNokogiriXmlNamespace, 0, 0, node);
|
47
|
+
|
48
|
+
document = DOC_RUBY_OBJECT(doc);
|
49
|
+
|
50
|
+
node_cache = rb_iv_get(document, "@node_cache");
|
51
|
+
rb_ary_push(node_cache, ns);
|
52
|
+
|
53
|
+
rb_iv_set(ns, "@document", DOC_RUBY_OBJECT(doc));
|
54
|
+
|
55
|
+
node->_private = (void *)ns;
|
56
|
+
|
57
|
+
return ns;
|
58
|
+
}
|
59
|
+
|
60
|
+
VALUE Nokogiri_wrap_xml_namespace2(VALUE document, xmlNsPtr node)
|
61
|
+
{
|
62
|
+
xmlDocPtr doc;
|
63
|
+
Data_Get_Struct(document, xmlDoc, doc) ;
|
64
|
+
return Nokogiri_wrap_xml_namespace(doc, node);
|
65
|
+
}
|
66
|
+
|
67
|
+
|
68
|
+
void init_xml_namespace()
|
69
|
+
{
|
70
|
+
VALUE nokogiri = rb_define_module("Nokogiri");
|
71
|
+
VALUE xml = rb_define_module_under(nokogiri, "XML");
|
72
|
+
VALUE klass = rb_define_class_under(xml, "Namespace", rb_cObject);
|
73
|
+
|
74
|
+
cNokogiriXmlNamespace = klass;
|
75
|
+
|
76
|
+
rb_define_method(klass, "prefix", prefix, 0);
|
77
|
+
rb_define_method(klass, "href", href, 0);
|
78
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#ifndef NOKOGIRI_XML_NAMESPACE
|
2
|
+
#define NOKOGIRI_XML_NAMESPACE
|
3
|
+
|
4
|
+
#include <nokogiri.h>
|
5
|
+
|
6
|
+
void init_xml_namespace();
|
7
|
+
|
8
|
+
extern VALUE cNokogiriXmlNamespace ;
|
9
|
+
|
10
|
+
VALUE Nokogiri_wrap_xml_namespace(xmlDocPtr doc, xmlNsPtr node) ;
|
11
|
+
VALUE Nokogiri_wrap_xml_namespace2(VALUE document, xmlNsPtr node) ;
|
12
|
+
|
13
|
+
#endif
|
@@ -0,0 +1,1603 @@
|
|
1
|
+
#include <xml_node.h>
|
2
|
+
|
3
|
+
static ID decorate, decorate_bang;
|
4
|
+
|
5
|
+
#ifdef DEBUG
|
6
|
+
static void debug_node_dealloc(xmlNodePtr x)
|
7
|
+
{
|
8
|
+
NOKOGIRI_DEBUG_START(x)
|
9
|
+
NOKOGIRI_DEBUG_END(x)
|
10
|
+
}
|
11
|
+
#else
|
12
|
+
# define debug_node_dealloc 0
|
13
|
+
#endif
|
14
|
+
|
15
|
+
static void mark(xmlNodePtr node)
|
16
|
+
{
|
17
|
+
xmlNodePtr doc = node->doc;
|
18
|
+
if(doc->type == XML_DOCUMENT_NODE || doc->type == XML_HTML_DOCUMENT_NODE) {
|
19
|
+
if(DOC_RUBY_OBJECT_TEST(doc)) {
|
20
|
+
rb_gc_mark(DOC_RUBY_OBJECT(doc));
|
21
|
+
}
|
22
|
+
} else if(node->doc->_private) {
|
23
|
+
rb_gc_mark((VALUE)doc->_private);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
/* :nodoc: */
|
28
|
+
typedef xmlNodePtr (*pivot_reparentee_func)(xmlNodePtr, xmlNodePtr);
|
29
|
+
|
30
|
+
/* :nodoc: */
|
31
|
+
static void relink_namespace(xmlNodePtr reparented)
|
32
|
+
{
|
33
|
+
xmlChar *name, *prefix;
|
34
|
+
xmlNodePtr child;
|
35
|
+
xmlNsPtr ns;
|
36
|
+
|
37
|
+
if (reparented->type != XML_ATTRIBUTE_NODE &&
|
38
|
+
reparented->type != XML_ELEMENT_NODE) return;
|
39
|
+
|
40
|
+
if (reparented->ns == NULL || reparented->ns->prefix == NULL) {
|
41
|
+
name = xmlSplitQName2(reparented->name, &prefix);
|
42
|
+
|
43
|
+
if(reparented->type == XML_ATTRIBUTE_NODE) {
|
44
|
+
if (prefix == NULL || strcmp((char*)prefix, XMLNS_PREFIX) == 0) return;
|
45
|
+
}
|
46
|
+
|
47
|
+
ns = xmlSearchNs(reparented->doc, reparented, prefix);
|
48
|
+
|
49
|
+
if (ns == NULL && reparented->parent) {
|
50
|
+
ns = xmlSearchNs(reparented->doc, reparented->parent, prefix);
|
51
|
+
}
|
52
|
+
|
53
|
+
if (ns != NULL) {
|
54
|
+
xmlNodeSetName(reparented, name);
|
55
|
+
xmlSetNs(reparented, ns);
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
/* Avoid segv when relinking against unlinked nodes. */
|
60
|
+
if (reparented->type != XML_ELEMENT_NODE || !reparented->parent) return;
|
61
|
+
|
62
|
+
/* Make sure that our reparented node has the correct namespaces */
|
63
|
+
if(!reparented->ns && reparented->doc != (xmlDocPtr)reparented->parent)
|
64
|
+
xmlSetNs(reparented, reparented->parent->ns);
|
65
|
+
|
66
|
+
/* Search our parents for an existing definition */
|
67
|
+
if(reparented->nsDef) {
|
68
|
+
xmlNsPtr curr = reparented->nsDef;
|
69
|
+
xmlNsPtr prev = NULL;
|
70
|
+
|
71
|
+
while(curr) {
|
72
|
+
xmlNsPtr ns = xmlSearchNsByHref(
|
73
|
+
reparented->doc,
|
74
|
+
reparented->parent,
|
75
|
+
curr->href
|
76
|
+
);
|
77
|
+
/* If we find the namespace is already declared, remove it from this
|
78
|
+
* definition list. */
|
79
|
+
if(ns && ns != curr) {
|
80
|
+
if (prev) {
|
81
|
+
prev->next = curr->next;
|
82
|
+
} else {
|
83
|
+
reparented->nsDef = curr->next;
|
84
|
+
}
|
85
|
+
nokogiri_root_nsdef(curr, reparented->doc);
|
86
|
+
} else {
|
87
|
+
prev = curr;
|
88
|
+
}
|
89
|
+
curr = curr->next;
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
/* Only walk all children if there actually is a namespace we need to */
|
94
|
+
/* reparent. */
|
95
|
+
if(NULL == reparented->ns) return;
|
96
|
+
|
97
|
+
/* When a node gets reparented, walk it's children to make sure that */
|
98
|
+
/* their namespaces are reparented as well. */
|
99
|
+
child = reparented->children;
|
100
|
+
while(NULL != child) {
|
101
|
+
relink_namespace(child);
|
102
|
+
child = child->next;
|
103
|
+
}
|
104
|
+
|
105
|
+
if (reparented->type == XML_ELEMENT_NODE) {
|
106
|
+
child = (xmlNodePtr)((xmlElementPtr)reparented)->attributes;
|
107
|
+
while(NULL != child) {
|
108
|
+
relink_namespace(child);
|
109
|
+
child = child->next;
|
110
|
+
}
|
111
|
+
}
|
112
|
+
}
|
113
|
+
|
114
|
+
/* :nodoc: */
|
115
|
+
static xmlNodePtr xmlReplaceNodeWrapper(xmlNodePtr pivot, xmlNodePtr new_node)
|
116
|
+
{
|
117
|
+
xmlNodePtr retval ;
|
118
|
+
|
119
|
+
retval = xmlReplaceNode(pivot, new_node) ;
|
120
|
+
|
121
|
+
if (retval == pivot) {
|
122
|
+
retval = new_node ; /* return semantics for reparent_node_with */
|
123
|
+
}
|
124
|
+
|
125
|
+
/* work around libxml2 issue: https://bugzilla.gnome.org/show_bug.cgi?id=615612 */
|
126
|
+
if (retval && retval->type == XML_TEXT_NODE) {
|
127
|
+
if (retval->prev && retval->prev->type == XML_TEXT_NODE) {
|
128
|
+
retval = xmlTextMerge(retval->prev, retval);
|
129
|
+
}
|
130
|
+
if (retval->next && retval->next->type == XML_TEXT_NODE) {
|
131
|
+
retval = xmlTextMerge(retval, retval->next);
|
132
|
+
}
|
133
|
+
}
|
134
|
+
|
135
|
+
return retval ;
|
136
|
+
}
|
137
|
+
|
138
|
+
/* :nodoc: */
|
139
|
+
static VALUE reparent_node_with(VALUE pivot_obj, VALUE reparentee_obj, pivot_reparentee_func prf)
|
140
|
+
{
|
141
|
+
VALUE reparented_obj ;
|
142
|
+
xmlNodePtr reparentee, pivot, reparented, next_text, new_next_text, parent ;
|
143
|
+
|
144
|
+
if(!rb_obj_is_kind_of(reparentee_obj, cNokogiriXmlNode))
|
145
|
+
rb_raise(rb_eArgError, "node must be a Nokogiri::XML::Node");
|
146
|
+
if(rb_obj_is_kind_of(reparentee_obj, cNokogiriXmlDocument))
|
147
|
+
rb_raise(rb_eArgError, "node must be a Nokogiri::XML::Node");
|
148
|
+
|
149
|
+
Data_Get_Struct(reparentee_obj, xmlNode, reparentee);
|
150
|
+
Data_Get_Struct(pivot_obj, xmlNode, pivot);
|
151
|
+
|
152
|
+
/*
|
153
|
+
* Check if nodes given are appropriate to have a parent-child
|
154
|
+
* relationship, based on the DOM specification.
|
155
|
+
*
|
156
|
+
* cf. http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-1590626202
|
157
|
+
*/
|
158
|
+
if (prf == xmlAddChild) {
|
159
|
+
parent = pivot;
|
160
|
+
} else {
|
161
|
+
parent = pivot->parent;
|
162
|
+
}
|
163
|
+
|
164
|
+
if (parent) {
|
165
|
+
switch (parent->type) {
|
166
|
+
case XML_DOCUMENT_NODE:
|
167
|
+
case XML_HTML_DOCUMENT_NODE:
|
168
|
+
switch (reparentee->type) {
|
169
|
+
case XML_ELEMENT_NODE:
|
170
|
+
case XML_PI_NODE:
|
171
|
+
case XML_COMMENT_NODE:
|
172
|
+
case XML_DOCUMENT_TYPE_NODE:
|
173
|
+
/*
|
174
|
+
* The DOM specification says no to adding text-like nodes
|
175
|
+
* directly to a document, but we allow it for compatibility.
|
176
|
+
*/
|
177
|
+
case XML_TEXT_NODE:
|
178
|
+
case XML_CDATA_SECTION_NODE:
|
179
|
+
case XML_ENTITY_REF_NODE:
|
180
|
+
goto ok;
|
181
|
+
}
|
182
|
+
break;
|
183
|
+
case XML_DOCUMENT_FRAG_NODE:
|
184
|
+
case XML_ENTITY_REF_NODE:
|
185
|
+
case XML_ELEMENT_NODE:
|
186
|
+
switch (reparentee->type) {
|
187
|
+
case XML_ELEMENT_NODE:
|
188
|
+
case XML_PI_NODE:
|
189
|
+
case XML_COMMENT_NODE:
|
190
|
+
case XML_TEXT_NODE:
|
191
|
+
case XML_CDATA_SECTION_NODE:
|
192
|
+
case XML_ENTITY_REF_NODE:
|
193
|
+
goto ok;
|
194
|
+
}
|
195
|
+
break;
|
196
|
+
case XML_ATTRIBUTE_NODE:
|
197
|
+
switch (reparentee->type) {
|
198
|
+
case XML_TEXT_NODE:
|
199
|
+
case XML_ENTITY_REF_NODE:
|
200
|
+
goto ok;
|
201
|
+
}
|
202
|
+
break;
|
203
|
+
case XML_TEXT_NODE:
|
204
|
+
/*
|
205
|
+
* xmlAddChild() breaks the DOM specification in that it allows
|
206
|
+
* adding a text node to another, in which case text nodes are
|
207
|
+
* coalesced, but since our JRuby version does not support such
|
208
|
+
* operation, we should inhibit it.
|
209
|
+
*/
|
210
|
+
break;
|
211
|
+
}
|
212
|
+
|
213
|
+
rb_raise(rb_eArgError, "cannot reparent %s there", rb_obj_classname(reparentee_obj));
|
214
|
+
}
|
215
|
+
|
216
|
+
ok:
|
217
|
+
xmlUnlinkNode(reparentee);
|
218
|
+
|
219
|
+
if (reparentee->doc != pivot->doc || reparentee->type == XML_TEXT_NODE) {
|
220
|
+
/*
|
221
|
+
* if the reparentee is a text node, there's a very good chance it will be
|
222
|
+
* merged with an adjacent text node after being reparented, and in that case
|
223
|
+
* libxml will free the underlying C struct.
|
224
|
+
*
|
225
|
+
* since we clearly have a ruby object which references the underlying
|
226
|
+
* memory, we can't let the C struct get freed. let's pickle the original
|
227
|
+
* reparentee by rooting it; and then we'll reparent a duplicate of the
|
228
|
+
* node that we don't care about preserving.
|
229
|
+
*
|
230
|
+
* alternatively, if the reparentee is from a different document than the
|
231
|
+
* pivot node, libxml2 is going to get confused about which document's
|
232
|
+
* "dictionary" the node's strings belong to (this is an otherwise
|
233
|
+
* uninteresting libxml2 implementation detail). as a result, we cannot
|
234
|
+
* reparent the actual reparentee, so we reparent a duplicate.
|
235
|
+
*/
|
236
|
+
nokogiri_root_node(reparentee);
|
237
|
+
if (!(reparentee = xmlDocCopyNode(reparentee, pivot->doc, 1))) {
|
238
|
+
rb_raise(rb_eRuntimeError, "Could not reparent node (xmlDocCopyNode)");
|
239
|
+
}
|
240
|
+
}
|
241
|
+
|
242
|
+
if (prf != xmlAddPrevSibling && prf != xmlAddNextSibling
|
243
|
+
&& reparentee->type == XML_TEXT_NODE && pivot->next && pivot->next->type == XML_TEXT_NODE) {
|
244
|
+
/*
|
245
|
+
* libxml merges text nodes in a right-to-left fashion, meaning that if
|
246
|
+
* there are two text nodes who would be adjacent, the right (or following,
|
247
|
+
* or next) node will be merged into the left (or preceding, or previous)
|
248
|
+
* node.
|
249
|
+
*
|
250
|
+
* and by "merged" I mean the string contents will be concatenated onto the
|
251
|
+
* left node's contents, and then the node will be freed.
|
252
|
+
*
|
253
|
+
* which means that if we have a ruby object wrapped around the right node,
|
254
|
+
* its memory would be freed out from under it.
|
255
|
+
*
|
256
|
+
* so, we detect this edge case and unlink-and-root the text node before it gets
|
257
|
+
* merged. then we dup the node and insert that duplicate back into the
|
258
|
+
* document where the real node was.
|
259
|
+
*
|
260
|
+
* yes, this is totally lame.
|
261
|
+
*/
|
262
|
+
next_text = pivot->next ;
|
263
|
+
new_next_text = xmlDocCopyNode(next_text, pivot->doc, 1) ;
|
264
|
+
|
265
|
+
xmlUnlinkNode(next_text);
|
266
|
+
nokogiri_root_node(next_text);
|
267
|
+
|
268
|
+
xmlAddNextSibling(pivot, new_next_text);
|
269
|
+
}
|
270
|
+
|
271
|
+
if(!(reparented = (*prf)(pivot, reparentee))) {
|
272
|
+
rb_raise(rb_eRuntimeError, "Could not reparent node");
|
273
|
+
}
|
274
|
+
|
275
|
+
/*
|
276
|
+
* make sure the ruby object is pointed at the just-reparented node, which
|
277
|
+
* might be a duplicate (see above) or might be the result of merging
|
278
|
+
* adjacent text nodes.
|
279
|
+
*/
|
280
|
+
DATA_PTR(reparentee_obj) = reparented ;
|
281
|
+
|
282
|
+
relink_namespace(reparented);
|
283
|
+
|
284
|
+
reparented_obj = Nokogiri_wrap_xml_node(Qnil, reparented);
|
285
|
+
|
286
|
+
rb_funcall(reparented_obj, decorate_bang, 0);
|
287
|
+
|
288
|
+
return reparented_obj ;
|
289
|
+
}
|
290
|
+
|
291
|
+
|
292
|
+
/*
|
293
|
+
* call-seq:
|
294
|
+
* document
|
295
|
+
*
|
296
|
+
* Get the document for this Node
|
297
|
+
*/
|
298
|
+
static VALUE document(VALUE self)
|
299
|
+
{
|
300
|
+
xmlNodePtr node;
|
301
|
+
Data_Get_Struct(self, xmlNode, node);
|
302
|
+
return DOC_RUBY_OBJECT(node->doc);
|
303
|
+
}
|
304
|
+
|
305
|
+
/*
|
306
|
+
* call-seq:
|
307
|
+
* pointer_id
|
308
|
+
*
|
309
|
+
* Get the internal pointer number
|
310
|
+
*/
|
311
|
+
static VALUE pointer_id(VALUE self)
|
312
|
+
{
|
313
|
+
xmlNodePtr node;
|
314
|
+
Data_Get_Struct(self, xmlNode, node);
|
315
|
+
|
316
|
+
return INT2NUM((long)(node));
|
317
|
+
}
|
318
|
+
|
319
|
+
/*
|
320
|
+
* call-seq:
|
321
|
+
* encode_special_chars(string)
|
322
|
+
*
|
323
|
+
* Encode any special characters in +string+
|
324
|
+
*/
|
325
|
+
static VALUE encode_special_chars(VALUE self, VALUE string)
|
326
|
+
{
|
327
|
+
xmlNodePtr node;
|
328
|
+
xmlChar *encoded;
|
329
|
+
VALUE encoded_str;
|
330
|
+
|
331
|
+
Data_Get_Struct(self, xmlNode, node);
|
332
|
+
encoded = xmlEncodeSpecialChars(
|
333
|
+
node->doc,
|
334
|
+
(const xmlChar *)StringValuePtr(string)
|
335
|
+
);
|
336
|
+
|
337
|
+
encoded_str = NOKOGIRI_STR_NEW2(encoded);
|
338
|
+
xmlFree(encoded);
|
339
|
+
|
340
|
+
return encoded_str;
|
341
|
+
}
|
342
|
+
|
343
|
+
/*
|
344
|
+
* call-seq:
|
345
|
+
* create_internal_subset(name, external_id, system_id)
|
346
|
+
*
|
347
|
+
* Create the internal subset of a document.
|
348
|
+
*
|
349
|
+
* doc.create_internal_subset("chapter", "-//OASIS//DTD DocBook XML//EN", "chapter.dtd")
|
350
|
+
* # => <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML//EN" "chapter.dtd">
|
351
|
+
*
|
352
|
+
* doc.create_internal_subset("chapter", nil, "chapter.dtd")
|
353
|
+
* # => <!DOCTYPE chapter SYSTEM "chapter.dtd">
|
354
|
+
*/
|
355
|
+
static VALUE create_internal_subset(VALUE self, VALUE name, VALUE external_id, VALUE system_id)
|
356
|
+
{
|
357
|
+
xmlNodePtr node;
|
358
|
+
xmlDocPtr doc;
|
359
|
+
xmlDtdPtr dtd;
|
360
|
+
|
361
|
+
Data_Get_Struct(self, xmlNode, node);
|
362
|
+
|
363
|
+
doc = node->doc;
|
364
|
+
|
365
|
+
if(xmlGetIntSubset(doc))
|
366
|
+
rb_raise(rb_eRuntimeError, "Document already has an internal subset");
|
367
|
+
|
368
|
+
dtd = xmlCreateIntSubset(
|
369
|
+
doc,
|
370
|
+
NIL_P(name) ? NULL : (const xmlChar *)StringValuePtr(name),
|
371
|
+
NIL_P(external_id) ? NULL : (const xmlChar *)StringValuePtr(external_id),
|
372
|
+
NIL_P(system_id) ? NULL : (const xmlChar *)StringValuePtr(system_id)
|
373
|
+
);
|
374
|
+
|
375
|
+
if(!dtd) return Qnil;
|
376
|
+
|
377
|
+
return Nokogiri_wrap_xml_node(Qnil, (xmlNodePtr)dtd);
|
378
|
+
}
|
379
|
+
|
380
|
+
/*
|
381
|
+
* call-seq:
|
382
|
+
* create_external_subset(name, external_id, system_id)
|
383
|
+
*
|
384
|
+
* Create an external subset
|
385
|
+
*/
|
386
|
+
static VALUE create_external_subset(VALUE self, VALUE name, VALUE external_id, VALUE system_id)
|
387
|
+
{
|
388
|
+
xmlNodePtr node;
|
389
|
+
xmlDocPtr doc;
|
390
|
+
xmlDtdPtr dtd;
|
391
|
+
|
392
|
+
Data_Get_Struct(self, xmlNode, node);
|
393
|
+
|
394
|
+
doc = node->doc;
|
395
|
+
|
396
|
+
if(doc->extSubset)
|
397
|
+
rb_raise(rb_eRuntimeError, "Document already has an external subset");
|
398
|
+
|
399
|
+
dtd = xmlNewDtd(
|
400
|
+
doc,
|
401
|
+
NIL_P(name) ? NULL : (const xmlChar *)StringValuePtr(name),
|
402
|
+
NIL_P(external_id) ? NULL : (const xmlChar *)StringValuePtr(external_id),
|
403
|
+
NIL_P(system_id) ? NULL : (const xmlChar *)StringValuePtr(system_id)
|
404
|
+
);
|
405
|
+
|
406
|
+
if(!dtd) return Qnil;
|
407
|
+
|
408
|
+
return Nokogiri_wrap_xml_node(Qnil, (xmlNodePtr)dtd);
|
409
|
+
}
|
410
|
+
|
411
|
+
/*
|
412
|
+
* call-seq:
|
413
|
+
* external_subset
|
414
|
+
*
|
415
|
+
* Get the external subset
|
416
|
+
*/
|
417
|
+
static VALUE external_subset(VALUE self)
|
418
|
+
{
|
419
|
+
xmlNodePtr node;
|
420
|
+
xmlDocPtr doc;
|
421
|
+
xmlDtdPtr dtd;
|
422
|
+
|
423
|
+
Data_Get_Struct(self, xmlNode, node);
|
424
|
+
|
425
|
+
if(!node->doc) return Qnil;
|
426
|
+
|
427
|
+
doc = node->doc;
|
428
|
+
dtd = doc->extSubset;
|
429
|
+
|
430
|
+
if(!dtd) return Qnil;
|
431
|
+
|
432
|
+
return Nokogiri_wrap_xml_node(Qnil, (xmlNodePtr)dtd);
|
433
|
+
}
|
434
|
+
|
435
|
+
/*
|
436
|
+
* call-seq:
|
437
|
+
* internal_subset
|
438
|
+
*
|
439
|
+
* Get the internal subset
|
440
|
+
*/
|
441
|
+
static VALUE internal_subset(VALUE self)
|
442
|
+
{
|
443
|
+
xmlNodePtr node;
|
444
|
+
xmlDocPtr doc;
|
445
|
+
xmlDtdPtr dtd;
|
446
|
+
|
447
|
+
Data_Get_Struct(self, xmlNode, node);
|
448
|
+
|
449
|
+
if(!node->doc) return Qnil;
|
450
|
+
|
451
|
+
doc = node->doc;
|
452
|
+
dtd = xmlGetIntSubset(doc);
|
453
|
+
|
454
|
+
if(!dtd) return Qnil;
|
455
|
+
|
456
|
+
return Nokogiri_wrap_xml_node(Qnil, (xmlNodePtr)dtd);
|
457
|
+
}
|
458
|
+
|
459
|
+
/*
|
460
|
+
* call-seq:
|
461
|
+
* dup
|
462
|
+
*
|
463
|
+
* Copy this node. An optional depth may be passed in, but it defaults
|
464
|
+
* to a deep copy. 0 is a shallow copy, 1 is a deep copy.
|
465
|
+
*/
|
466
|
+
static VALUE duplicate_node(int argc, VALUE *argv, VALUE self)
|
467
|
+
{
|
468
|
+
VALUE level;
|
469
|
+
xmlNodePtr node, dup;
|
470
|
+
|
471
|
+
if(rb_scan_args(argc, argv, "01", &level) == 0)
|
472
|
+
level = INT2NUM((long)1);
|
473
|
+
|
474
|
+
Data_Get_Struct(self, xmlNode, node);
|
475
|
+
|
476
|
+
dup = xmlDocCopyNode(node, node->doc, (int)NUM2INT(level));
|
477
|
+
if(dup == NULL) return Qnil;
|
478
|
+
|
479
|
+
nokogiri_root_node(dup);
|
480
|
+
|
481
|
+
return Nokogiri_wrap_xml_node(rb_obj_class(self), dup);
|
482
|
+
}
|
483
|
+
|
484
|
+
/*
|
485
|
+
* call-seq:
|
486
|
+
* unlink
|
487
|
+
*
|
488
|
+
* Unlink this node from its current context.
|
489
|
+
*/
|
490
|
+
static VALUE unlink_node(VALUE self)
|
491
|
+
{
|
492
|
+
xmlNodePtr node;
|
493
|
+
Data_Get_Struct(self, xmlNode, node);
|
494
|
+
xmlUnlinkNode(node);
|
495
|
+
nokogiri_root_node(node);
|
496
|
+
return self;
|
497
|
+
}
|
498
|
+
|
499
|
+
/*
|
500
|
+
* call-seq:
|
501
|
+
* blank?
|
502
|
+
*
|
503
|
+
* Is this node blank?
|
504
|
+
*/
|
505
|
+
static VALUE blank_eh(VALUE self)
|
506
|
+
{
|
507
|
+
xmlNodePtr node;
|
508
|
+
Data_Get_Struct(self, xmlNode, node);
|
509
|
+
return (1 == xmlIsBlankNode(node)) ? Qtrue : Qfalse ;
|
510
|
+
}
|
511
|
+
|
512
|
+
/*
|
513
|
+
* call-seq:
|
514
|
+
* next_sibling
|
515
|
+
*
|
516
|
+
* Returns the next sibling node
|
517
|
+
*/
|
518
|
+
static VALUE next_sibling(VALUE self)
|
519
|
+
{
|
520
|
+
xmlNodePtr node, sibling;
|
521
|
+
Data_Get_Struct(self, xmlNode, node);
|
522
|
+
|
523
|
+
sibling = node->next;
|
524
|
+
if(!sibling) return Qnil;
|
525
|
+
|
526
|
+
return Nokogiri_wrap_xml_node(Qnil, sibling) ;
|
527
|
+
}
|
528
|
+
|
529
|
+
/*
|
530
|
+
* call-seq:
|
531
|
+
* previous_sibling
|
532
|
+
*
|
533
|
+
* Returns the previous sibling node
|
534
|
+
*/
|
535
|
+
static VALUE previous_sibling(VALUE self)
|
536
|
+
{
|
537
|
+
xmlNodePtr node, sibling;
|
538
|
+
Data_Get_Struct(self, xmlNode, node);
|
539
|
+
|
540
|
+
sibling = node->prev;
|
541
|
+
if(!sibling) return Qnil;
|
542
|
+
|
543
|
+
return Nokogiri_wrap_xml_node(Qnil, sibling);
|
544
|
+
}
|
545
|
+
|
546
|
+
/*
|
547
|
+
* call-seq:
|
548
|
+
* next_element
|
549
|
+
*
|
550
|
+
* Returns the next Nokogiri::XML::Element type sibling node.
|
551
|
+
*/
|
552
|
+
static VALUE next_element(VALUE self)
|
553
|
+
{
|
554
|
+
xmlNodePtr node, sibling;
|
555
|
+
Data_Get_Struct(self, xmlNode, node);
|
556
|
+
|
557
|
+
sibling = xmlNextElementSibling(node);
|
558
|
+
if(!sibling) return Qnil;
|
559
|
+
|
560
|
+
return Nokogiri_wrap_xml_node(Qnil, sibling);
|
561
|
+
}
|
562
|
+
|
563
|
+
/*
|
564
|
+
* call-seq:
|
565
|
+
* previous_element
|
566
|
+
*
|
567
|
+
* Returns the previous Nokogiri::XML::Element type sibling node.
|
568
|
+
*/
|
569
|
+
static VALUE previous_element(VALUE self)
|
570
|
+
{
|
571
|
+
xmlNodePtr node, sibling;
|
572
|
+
Data_Get_Struct(self, xmlNode, node);
|
573
|
+
|
574
|
+
/*
|
575
|
+
* note that we don't use xmlPreviousElementSibling here because it's buggy pre-2.7.7.
|
576
|
+
*/
|
577
|
+
sibling = node->prev;
|
578
|
+
if(!sibling) return Qnil;
|
579
|
+
|
580
|
+
while(sibling && sibling->type != XML_ELEMENT_NODE)
|
581
|
+
sibling = sibling->prev;
|
582
|
+
|
583
|
+
return sibling ? Nokogiri_wrap_xml_node(Qnil, sibling) : Qnil ;
|
584
|
+
}
|
585
|
+
|
586
|
+
/* :nodoc: */
|
587
|
+
static VALUE replace(VALUE self, VALUE new_node)
|
588
|
+
{
|
589
|
+
VALUE reparent = reparent_node_with(self, new_node, xmlReplaceNodeWrapper);
|
590
|
+
|
591
|
+
xmlNodePtr pivot;
|
592
|
+
Data_Get_Struct(self, xmlNode, pivot);
|
593
|
+
nokogiri_root_node(pivot);
|
594
|
+
|
595
|
+
return reparent;
|
596
|
+
}
|
597
|
+
|
598
|
+
/*
|
599
|
+
* call-seq:
|
600
|
+
* children
|
601
|
+
*
|
602
|
+
* Get the list of children for this node as a NodeSet
|
603
|
+
*/
|
604
|
+
static VALUE children(VALUE self)
|
605
|
+
{
|
606
|
+
xmlNodePtr node;
|
607
|
+
xmlNodePtr child;
|
608
|
+
xmlNodeSetPtr set;
|
609
|
+
VALUE document;
|
610
|
+
VALUE node_set;
|
611
|
+
|
612
|
+
Data_Get_Struct(self, xmlNode, node);
|
613
|
+
|
614
|
+
child = node->children;
|
615
|
+
set = xmlXPathNodeSetCreate(child);
|
616
|
+
|
617
|
+
document = DOC_RUBY_OBJECT(node->doc);
|
618
|
+
|
619
|
+
if(!child) return Nokogiri_wrap_xml_node_set(set, document);
|
620
|
+
|
621
|
+
child = child->next;
|
622
|
+
while(NULL != child) {
|
623
|
+
xmlXPathNodeSetAddUnique(set, child);
|
624
|
+
child = child->next;
|
625
|
+
}
|
626
|
+
|
627
|
+
node_set = Nokogiri_wrap_xml_node_set(set, document);
|
628
|
+
|
629
|
+
return node_set;
|
630
|
+
}
|
631
|
+
|
632
|
+
/*
|
633
|
+
* call-seq:
|
634
|
+
* element_children
|
635
|
+
*
|
636
|
+
* Get the list of children for this node as a NodeSet. All nodes will be
|
637
|
+
* element nodes.
|
638
|
+
*
|
639
|
+
* Example:
|
640
|
+
*
|
641
|
+
* @doc.root.element_children.all? { |x| x.element? } # => true
|
642
|
+
*/
|
643
|
+
static VALUE element_children(VALUE self)
|
644
|
+
{
|
645
|
+
xmlNodePtr node;
|
646
|
+
xmlNodePtr child;
|
647
|
+
xmlNodeSetPtr set;
|
648
|
+
VALUE document;
|
649
|
+
VALUE node_set;
|
650
|
+
|
651
|
+
Data_Get_Struct(self, xmlNode, node);
|
652
|
+
|
653
|
+
child = xmlFirstElementChild(node);
|
654
|
+
set = xmlXPathNodeSetCreate(child);
|
655
|
+
|
656
|
+
document = DOC_RUBY_OBJECT(node->doc);
|
657
|
+
|
658
|
+
if(!child) return Nokogiri_wrap_xml_node_set(set, document);
|
659
|
+
|
660
|
+
child = xmlNextElementSibling(child);
|
661
|
+
while(NULL != child) {
|
662
|
+
xmlXPathNodeSetAddUnique(set, child);
|
663
|
+
child = xmlNextElementSibling(child);
|
664
|
+
}
|
665
|
+
|
666
|
+
node_set = Nokogiri_wrap_xml_node_set(set, document);
|
667
|
+
|
668
|
+
return node_set;
|
669
|
+
}
|
670
|
+
|
671
|
+
/*
|
672
|
+
* call-seq:
|
673
|
+
* child
|
674
|
+
*
|
675
|
+
* Returns the child node
|
676
|
+
*/
|
677
|
+
static VALUE child(VALUE self)
|
678
|
+
{
|
679
|
+
xmlNodePtr node, child;
|
680
|
+
Data_Get_Struct(self, xmlNode, node);
|
681
|
+
|
682
|
+
child = node->children;
|
683
|
+
if(!child) return Qnil;
|
684
|
+
|
685
|
+
return Nokogiri_wrap_xml_node(Qnil, child);
|
686
|
+
}
|
687
|
+
|
688
|
+
/*
|
689
|
+
* call-seq:
|
690
|
+
* first_element_child
|
691
|
+
*
|
692
|
+
* Returns the first child node of this node that is an element.
|
693
|
+
*
|
694
|
+
* Example:
|
695
|
+
*
|
696
|
+
* @doc.root.first_element_child.element? # => true
|
697
|
+
*/
|
698
|
+
static VALUE first_element_child(VALUE self)
|
699
|
+
{
|
700
|
+
xmlNodePtr node, child;
|
701
|
+
Data_Get_Struct(self, xmlNode, node);
|
702
|
+
|
703
|
+
child = xmlFirstElementChild(node);
|
704
|
+
if(!child) return Qnil;
|
705
|
+
|
706
|
+
return Nokogiri_wrap_xml_node(Qnil, child);
|
707
|
+
}
|
708
|
+
|
709
|
+
/*
|
710
|
+
* call-seq:
|
711
|
+
* last_element_child
|
712
|
+
*
|
713
|
+
* Returns the last child node of this node that is an element.
|
714
|
+
*
|
715
|
+
* Example:
|
716
|
+
*
|
717
|
+
* @doc.root.last_element_child.element? # => true
|
718
|
+
*/
|
719
|
+
static VALUE last_element_child(VALUE self)
|
720
|
+
{
|
721
|
+
xmlNodePtr node, child;
|
722
|
+
Data_Get_Struct(self, xmlNode, node);
|
723
|
+
|
724
|
+
child = xmlLastElementChild(node);
|
725
|
+
if(!child) return Qnil;
|
726
|
+
|
727
|
+
return Nokogiri_wrap_xml_node(Qnil, child);
|
728
|
+
}
|
729
|
+
|
730
|
+
/*
|
731
|
+
* call-seq:
|
732
|
+
* key?(attribute)
|
733
|
+
*
|
734
|
+
* Returns true if +attribute+ is set
|
735
|
+
*/
|
736
|
+
static VALUE key_eh(VALUE self, VALUE attribute)
|
737
|
+
{
|
738
|
+
xmlNodePtr node;
|
739
|
+
Data_Get_Struct(self, xmlNode, node);
|
740
|
+
if(xmlHasProp(node, (xmlChar *)StringValuePtr(attribute)))
|
741
|
+
return Qtrue;
|
742
|
+
return Qfalse;
|
743
|
+
}
|
744
|
+
|
745
|
+
/*
|
746
|
+
* call-seq:
|
747
|
+
* namespaced_key?(attribute, namespace)
|
748
|
+
*
|
749
|
+
* Returns true if +attribute+ is set with +namespace+
|
750
|
+
*/
|
751
|
+
static VALUE namespaced_key_eh(VALUE self, VALUE attribute, VALUE namespace)
|
752
|
+
{
|
753
|
+
xmlNodePtr node;
|
754
|
+
Data_Get_Struct(self, xmlNode, node);
|
755
|
+
if(xmlHasNsProp(node, (xmlChar *)StringValuePtr(attribute),
|
756
|
+
NIL_P(namespace) ? NULL : (xmlChar *)StringValuePtr(namespace)))
|
757
|
+
return Qtrue;
|
758
|
+
return Qfalse;
|
759
|
+
}
|
760
|
+
|
761
|
+
/*
|
762
|
+
* call-seq:
|
763
|
+
* []=(property, value)
|
764
|
+
*
|
765
|
+
* Set the +property+ to +value+
|
766
|
+
*/
|
767
|
+
static VALUE set(VALUE self, VALUE property, VALUE value)
|
768
|
+
{
|
769
|
+
xmlNodePtr node, cur;
|
770
|
+
xmlAttrPtr prop;
|
771
|
+
Data_Get_Struct(self, xmlNode, node);
|
772
|
+
|
773
|
+
/* If a matching attribute node already exists, then xmlSetProp will destroy
|
774
|
+
* the existing node's children. However, if Nokogiri has a node object
|
775
|
+
* pointing to one of those children, we are left with a broken reference.
|
776
|
+
*
|
777
|
+
* We can avoid this by unlinking these nodes first.
|
778
|
+
*/
|
779
|
+
if (node->type != XML_ELEMENT_NODE)
|
780
|
+
return(Qnil);
|
781
|
+
prop = xmlHasProp(node, (xmlChar *)StringValuePtr(property));
|
782
|
+
if (prop && prop->children) {
|
783
|
+
for (cur = prop->children; cur; cur = cur->next) {
|
784
|
+
if (cur->_private) {
|
785
|
+
nokogiri_root_node(cur);
|
786
|
+
xmlUnlinkNode(cur);
|
787
|
+
}
|
788
|
+
}
|
789
|
+
}
|
790
|
+
|
791
|
+
xmlSetProp(node, (xmlChar *)StringValuePtr(property),
|
792
|
+
(xmlChar *)StringValuePtr(value));
|
793
|
+
|
794
|
+
return value;
|
795
|
+
}
|
796
|
+
|
797
|
+
/*
|
798
|
+
* call-seq:
|
799
|
+
* get(attribute)
|
800
|
+
*
|
801
|
+
* Get the value for +attribute+
|
802
|
+
*/
|
803
|
+
static VALUE get(VALUE self, VALUE rattribute)
|
804
|
+
{
|
805
|
+
xmlNodePtr node;
|
806
|
+
xmlChar* value = 0;
|
807
|
+
VALUE rvalue ;
|
808
|
+
char* attribute = 0;
|
809
|
+
char *colon = 0, *attr_name = 0, *prefix = 0;
|
810
|
+
xmlNsPtr ns;
|
811
|
+
|
812
|
+
if (NIL_P(rattribute)) return Qnil;
|
813
|
+
|
814
|
+
Data_Get_Struct(self, xmlNode, node);
|
815
|
+
attribute = strdup(StringValuePtr(rattribute));
|
816
|
+
|
817
|
+
colon = strchr(attribute, ':');
|
818
|
+
if (colon) {
|
819
|
+
(*colon) = 0 ; /* create two null-terminated strings of the prefix and attribute name */
|
820
|
+
prefix = attribute ;
|
821
|
+
attr_name = colon + 1 ;
|
822
|
+
ns = xmlSearchNs(node->doc, node, (const xmlChar *)(prefix));
|
823
|
+
if (ns) {
|
824
|
+
value = xmlGetNsProp(node, (xmlChar*)(attr_name), ns->href);
|
825
|
+
} else {
|
826
|
+
value = xmlGetProp(node, (xmlChar*)StringValuePtr(rattribute));
|
827
|
+
}
|
828
|
+
} else {
|
829
|
+
value = xmlGetNoNsProp(node, (xmlChar*)attribute);
|
830
|
+
}
|
831
|
+
|
832
|
+
free(attribute);
|
833
|
+
if (!value) return Qnil;
|
834
|
+
|
835
|
+
rvalue = NOKOGIRI_STR_NEW2(value);
|
836
|
+
xmlFree(value);
|
837
|
+
|
838
|
+
return rvalue ;
|
839
|
+
}
|
840
|
+
|
841
|
+
/*
|
842
|
+
* call-seq:
|
843
|
+
* set_namespace(namespace)
|
844
|
+
*
|
845
|
+
* Set the namespace to +namespace+
|
846
|
+
*/
|
847
|
+
static VALUE set_namespace(VALUE self, VALUE namespace)
|
848
|
+
{
|
849
|
+
xmlNodePtr node;
|
850
|
+
xmlNsPtr ns = NULL;
|
851
|
+
|
852
|
+
Data_Get_Struct(self, xmlNode, node);
|
853
|
+
|
854
|
+
if(!NIL_P(namespace))
|
855
|
+
Data_Get_Struct(namespace, xmlNs, ns);
|
856
|
+
|
857
|
+
xmlSetNs(node, ns);
|
858
|
+
|
859
|
+
return self;
|
860
|
+
}
|
861
|
+
|
862
|
+
/*
|
863
|
+
* call-seq:
|
864
|
+
* attribute(name)
|
865
|
+
*
|
866
|
+
* Get the attribute node with +name+
|
867
|
+
*/
|
868
|
+
static VALUE attr(VALUE self, VALUE name)
|
869
|
+
{
|
870
|
+
xmlNodePtr node;
|
871
|
+
xmlAttrPtr prop;
|
872
|
+
Data_Get_Struct(self, xmlNode, node);
|
873
|
+
prop = xmlHasProp(node, (xmlChar *)StringValuePtr(name));
|
874
|
+
|
875
|
+
if(! prop) return Qnil;
|
876
|
+
return Nokogiri_wrap_xml_node(Qnil, (xmlNodePtr)prop);
|
877
|
+
}
|
878
|
+
|
879
|
+
/*
|
880
|
+
* call-seq:
|
881
|
+
* attribute_with_ns(name, namespace)
|
882
|
+
*
|
883
|
+
* Get the attribute node with +name+ and +namespace+
|
884
|
+
*/
|
885
|
+
static VALUE attribute_with_ns(VALUE self, VALUE name, VALUE namespace)
|
886
|
+
{
|
887
|
+
xmlNodePtr node;
|
888
|
+
xmlAttrPtr prop;
|
889
|
+
Data_Get_Struct(self, xmlNode, node);
|
890
|
+
prop = xmlHasNsProp(node, (xmlChar *)StringValuePtr(name),
|
891
|
+
NIL_P(namespace) ? NULL : (xmlChar *)StringValuePtr(namespace));
|
892
|
+
|
893
|
+
if(! prop) return Qnil;
|
894
|
+
return Nokogiri_wrap_xml_node(Qnil, (xmlNodePtr)prop);
|
895
|
+
}
|
896
|
+
|
897
|
+
/*
|
898
|
+
* call-seq:
|
899
|
+
* attribute_nodes()
|
900
|
+
*
|
901
|
+
* returns a list containing the Node attributes.
|
902
|
+
*/
|
903
|
+
static VALUE attribute_nodes(VALUE self)
|
904
|
+
{
|
905
|
+
/* this code in the mode of xmlHasProp() */
|
906
|
+
xmlNodePtr node;
|
907
|
+
VALUE attr;
|
908
|
+
|
909
|
+
Data_Get_Struct(self, xmlNode, node);
|
910
|
+
|
911
|
+
attr = rb_ary_new();
|
912
|
+
Nokogiri_xml_node_properties(node, attr);
|
913
|
+
|
914
|
+
return attr ;
|
915
|
+
}
|
916
|
+
|
917
|
+
|
918
|
+
/*
|
919
|
+
* call-seq:
|
920
|
+
* namespace()
|
921
|
+
*
|
922
|
+
* returns the namespace of the element or attribute node as a Namespace
|
923
|
+
* object, or nil if there is no namespace for the element or attribute.
|
924
|
+
*/
|
925
|
+
static VALUE namespace(VALUE self)
|
926
|
+
{
|
927
|
+
xmlNodePtr node ;
|
928
|
+
Data_Get_Struct(self, xmlNode, node);
|
929
|
+
|
930
|
+
if (node->ns)
|
931
|
+
return Nokogiri_wrap_xml_namespace(node->doc, node->ns);
|
932
|
+
|
933
|
+
return Qnil ;
|
934
|
+
}
|
935
|
+
|
936
|
+
/*
|
937
|
+
* call-seq:
|
938
|
+
* namespace_definitions()
|
939
|
+
*
|
940
|
+
* returns namespaces defined on self element directly, as an array of Namespace objects. Includes both a default namespace (as in"xmlns="), and prefixed namespaces (as in "xmlns:prefix=").
|
941
|
+
*/
|
942
|
+
static VALUE namespace_definitions(VALUE self)
|
943
|
+
{
|
944
|
+
/* this code in the mode of xmlHasProp() */
|
945
|
+
xmlNodePtr node ;
|
946
|
+
VALUE list;
|
947
|
+
xmlNsPtr ns;
|
948
|
+
|
949
|
+
Data_Get_Struct(self, xmlNode, node);
|
950
|
+
|
951
|
+
list = rb_ary_new();
|
952
|
+
|
953
|
+
ns = node->nsDef;
|
954
|
+
|
955
|
+
if(!ns) return list;
|
956
|
+
|
957
|
+
while(NULL != ns) {
|
958
|
+
rb_ary_push(list, Nokogiri_wrap_xml_namespace(node->doc, ns));
|
959
|
+
ns = ns->next;
|
960
|
+
}
|
961
|
+
|
962
|
+
return list;
|
963
|
+
}
|
964
|
+
|
965
|
+
/*
|
966
|
+
* call-seq:
|
967
|
+
* namespace_scopes()
|
968
|
+
*
|
969
|
+
* returns namespaces in scope for self -- those defined on self element
|
970
|
+
* directly or any ancestor node -- as an array of Namespace objects. Default
|
971
|
+
* namespaces ("xmlns=" style) for self are included in this array; Default
|
972
|
+
* namespaces for ancestors, however, are not. See also #namespaces
|
973
|
+
*/
|
974
|
+
static VALUE namespace_scopes(VALUE self)
|
975
|
+
{
|
976
|
+
xmlNodePtr node ;
|
977
|
+
VALUE list;
|
978
|
+
xmlNsPtr *ns_list;
|
979
|
+
int j;
|
980
|
+
|
981
|
+
Data_Get_Struct(self, xmlNode, node);
|
982
|
+
|
983
|
+
list = rb_ary_new();
|
984
|
+
ns_list = xmlGetNsList(node->doc, node);
|
985
|
+
|
986
|
+
if(!ns_list) return list;
|
987
|
+
|
988
|
+
for (j = 0 ; ns_list[j] != NULL ; ++j) {
|
989
|
+
rb_ary_push(list, Nokogiri_wrap_xml_namespace(node->doc, ns_list[j]));
|
990
|
+
}
|
991
|
+
|
992
|
+
xmlFree(ns_list);
|
993
|
+
return list;
|
994
|
+
}
|
995
|
+
|
996
|
+
/*
|
997
|
+
* call-seq:
|
998
|
+
* node_type
|
999
|
+
*
|
1000
|
+
* Get the type for this Node
|
1001
|
+
*/
|
1002
|
+
static VALUE node_type(VALUE self)
|
1003
|
+
{
|
1004
|
+
xmlNodePtr node;
|
1005
|
+
Data_Get_Struct(self, xmlNode, node);
|
1006
|
+
return INT2NUM((long)node->type);
|
1007
|
+
}
|
1008
|
+
|
1009
|
+
/*
|
1010
|
+
* call-seq:
|
1011
|
+
* content=
|
1012
|
+
*
|
1013
|
+
* Set the content for this Node
|
1014
|
+
*/
|
1015
|
+
static VALUE native_content(VALUE self, VALUE content)
|
1016
|
+
{
|
1017
|
+
xmlNodePtr node, child, next ;
|
1018
|
+
Data_Get_Struct(self, xmlNode, node);
|
1019
|
+
|
1020
|
+
child = node->children;
|
1021
|
+
while (NULL != child) {
|
1022
|
+
next = child->next ;
|
1023
|
+
xmlUnlinkNode(child) ;
|
1024
|
+
nokogiri_root_node(child);
|
1025
|
+
child = next ;
|
1026
|
+
}
|
1027
|
+
|
1028
|
+
xmlNodeSetContent(node, (xmlChar *)StringValuePtr(content));
|
1029
|
+
return content;
|
1030
|
+
}
|
1031
|
+
|
1032
|
+
/*
|
1033
|
+
* call-seq:
|
1034
|
+
* content
|
1035
|
+
*
|
1036
|
+
* Returns the content for this Node
|
1037
|
+
*/
|
1038
|
+
static VALUE get_content(VALUE self)
|
1039
|
+
{
|
1040
|
+
xmlNodePtr node;
|
1041
|
+
xmlChar * content;
|
1042
|
+
|
1043
|
+
Data_Get_Struct(self, xmlNode, node);
|
1044
|
+
|
1045
|
+
content = xmlNodeGetContent(node);
|
1046
|
+
if(content) {
|
1047
|
+
VALUE rval = NOKOGIRI_STR_NEW2(content);
|
1048
|
+
xmlFree(content);
|
1049
|
+
return rval;
|
1050
|
+
}
|
1051
|
+
return Qnil;
|
1052
|
+
}
|
1053
|
+
|
1054
|
+
/* :nodoc: */
|
1055
|
+
static VALUE add_child(VALUE self, VALUE new_child)
|
1056
|
+
{
|
1057
|
+
return reparent_node_with(self, new_child, xmlAddChild);
|
1058
|
+
}
|
1059
|
+
|
1060
|
+
/*
|
1061
|
+
* call-seq:
|
1062
|
+
* parent
|
1063
|
+
*
|
1064
|
+
* Get the parent Node for this Node
|
1065
|
+
*/
|
1066
|
+
static VALUE get_parent(VALUE self)
|
1067
|
+
{
|
1068
|
+
xmlNodePtr node, parent;
|
1069
|
+
Data_Get_Struct(self, xmlNode, node);
|
1070
|
+
|
1071
|
+
parent = node->parent;
|
1072
|
+
if(!parent) return Qnil;
|
1073
|
+
|
1074
|
+
return Nokogiri_wrap_xml_node(Qnil, parent) ;
|
1075
|
+
}
|
1076
|
+
|
1077
|
+
/*
|
1078
|
+
* call-seq:
|
1079
|
+
* name=(new_name)
|
1080
|
+
*
|
1081
|
+
* Set the name for this Node
|
1082
|
+
*/
|
1083
|
+
static VALUE set_name(VALUE self, VALUE new_name)
|
1084
|
+
{
|
1085
|
+
xmlNodePtr node;
|
1086
|
+
Data_Get_Struct(self, xmlNode, node);
|
1087
|
+
xmlNodeSetName(node, (xmlChar*)StringValuePtr(new_name));
|
1088
|
+
return new_name;
|
1089
|
+
}
|
1090
|
+
|
1091
|
+
/*
|
1092
|
+
* call-seq:
|
1093
|
+
* name
|
1094
|
+
*
|
1095
|
+
* Returns the name for this Node
|
1096
|
+
*/
|
1097
|
+
static VALUE get_name(VALUE self)
|
1098
|
+
{
|
1099
|
+
xmlNodePtr node;
|
1100
|
+
Data_Get_Struct(self, xmlNode, node);
|
1101
|
+
if(node->name)
|
1102
|
+
return NOKOGIRI_STR_NEW2(node->name);
|
1103
|
+
return Qnil;
|
1104
|
+
}
|
1105
|
+
|
1106
|
+
/*
|
1107
|
+
* call-seq:
|
1108
|
+
* path
|
1109
|
+
*
|
1110
|
+
* Returns the path associated with this Node
|
1111
|
+
*/
|
1112
|
+
static VALUE path(VALUE self)
|
1113
|
+
{
|
1114
|
+
xmlNodePtr node;
|
1115
|
+
xmlChar *path ;
|
1116
|
+
VALUE rval;
|
1117
|
+
|
1118
|
+
Data_Get_Struct(self, xmlNode, node);
|
1119
|
+
|
1120
|
+
path = xmlGetNodePath(node);
|
1121
|
+
rval = NOKOGIRI_STR_NEW2(path);
|
1122
|
+
xmlFree(path);
|
1123
|
+
return rval ;
|
1124
|
+
}
|
1125
|
+
|
1126
|
+
/* :nodoc: */
|
1127
|
+
static VALUE add_next_sibling(VALUE self, VALUE new_sibling)
|
1128
|
+
{
|
1129
|
+
return reparent_node_with(self, new_sibling, xmlAddNextSibling) ;
|
1130
|
+
}
|
1131
|
+
|
1132
|
+
/* :nodoc: */
|
1133
|
+
static VALUE add_previous_sibling(VALUE self, VALUE new_sibling)
|
1134
|
+
{
|
1135
|
+
return reparent_node_with(self, new_sibling, xmlAddPrevSibling) ;
|
1136
|
+
}
|
1137
|
+
|
1138
|
+
/*
|
1139
|
+
* call-seq:
|
1140
|
+
* native_write_to(io, encoding, options)
|
1141
|
+
*
|
1142
|
+
* Write this Node to +io+ with +encoding+ and +options+
|
1143
|
+
*/
|
1144
|
+
static VALUE native_write_to(
|
1145
|
+
VALUE self,
|
1146
|
+
VALUE io,
|
1147
|
+
VALUE encoding,
|
1148
|
+
VALUE indent_string,
|
1149
|
+
VALUE options
|
1150
|
+
) {
|
1151
|
+
xmlNodePtr node;
|
1152
|
+
const char * before_indent;
|
1153
|
+
xmlSaveCtxtPtr savectx;
|
1154
|
+
|
1155
|
+
Data_Get_Struct(self, xmlNode, node);
|
1156
|
+
|
1157
|
+
xmlIndentTreeOutput = 1;
|
1158
|
+
|
1159
|
+
before_indent = xmlTreeIndentString;
|
1160
|
+
|
1161
|
+
xmlTreeIndentString = StringValuePtr(indent_string);
|
1162
|
+
|
1163
|
+
savectx = xmlSaveToIO(
|
1164
|
+
(xmlOutputWriteCallback)io_write_callback,
|
1165
|
+
(xmlOutputCloseCallback)io_close_callback,
|
1166
|
+
(void *)io,
|
1167
|
+
RTEST(encoding) ? StringValuePtr(encoding) : NULL,
|
1168
|
+
(int)NUM2INT(options)
|
1169
|
+
);
|
1170
|
+
|
1171
|
+
xmlSaveTree(savectx, node);
|
1172
|
+
xmlSaveClose(savectx);
|
1173
|
+
|
1174
|
+
xmlTreeIndentString = before_indent;
|
1175
|
+
return io;
|
1176
|
+
}
|
1177
|
+
|
1178
|
+
/*
|
1179
|
+
* call-seq:
|
1180
|
+
* line
|
1181
|
+
*
|
1182
|
+
* Returns the line for this Node
|
1183
|
+
*/
|
1184
|
+
static VALUE line(VALUE self)
|
1185
|
+
{
|
1186
|
+
xmlNodePtr node;
|
1187
|
+
Data_Get_Struct(self, xmlNode, node);
|
1188
|
+
|
1189
|
+
return INT2NUM(xmlGetLineNo(node));
|
1190
|
+
}
|
1191
|
+
|
1192
|
+
/*
|
1193
|
+
* call-seq:
|
1194
|
+
* add_namespace_definition(prefix, href)
|
1195
|
+
*
|
1196
|
+
* Adds a namespace definition with +prefix+ using +href+ value. The result is
|
1197
|
+
* as if parsed XML for this node had included an attribute
|
1198
|
+
* 'xmlns:prefix=value'. A default namespace for this node ("xmlns=") can be
|
1199
|
+
* added by passing 'nil' for prefix. Namespaces added this way will not
|
1200
|
+
* show up in #attributes, but they will be included as an xmlns attribute
|
1201
|
+
* when the node is serialized to XML.
|
1202
|
+
*/
|
1203
|
+
static VALUE add_namespace_definition(VALUE self, VALUE prefix, VALUE href)
|
1204
|
+
{
|
1205
|
+
xmlNodePtr node, namespacee;
|
1206
|
+
xmlNsPtr ns;
|
1207
|
+
|
1208
|
+
Data_Get_Struct(self, xmlNode, node);
|
1209
|
+
namespacee = node ;
|
1210
|
+
|
1211
|
+
ns = xmlSearchNs(
|
1212
|
+
node->doc,
|
1213
|
+
node,
|
1214
|
+
(const xmlChar *)(NIL_P(prefix) ? NULL : StringValuePtr(prefix))
|
1215
|
+
);
|
1216
|
+
|
1217
|
+
if(!ns) {
|
1218
|
+
if (node->type != XML_ELEMENT_NODE) {
|
1219
|
+
namespacee = node->parent;
|
1220
|
+
}
|
1221
|
+
ns = xmlNewNs(
|
1222
|
+
namespacee,
|
1223
|
+
(const xmlChar *)StringValuePtr(href),
|
1224
|
+
(const xmlChar *)(NIL_P(prefix) ? NULL : StringValuePtr(prefix))
|
1225
|
+
);
|
1226
|
+
}
|
1227
|
+
|
1228
|
+
if (!ns) return Qnil ;
|
1229
|
+
|
1230
|
+
if(NIL_P(prefix) || node != namespacee) xmlSetNs(node, ns);
|
1231
|
+
|
1232
|
+
return Nokogiri_wrap_xml_namespace(node->doc, ns);
|
1233
|
+
}
|
1234
|
+
|
1235
|
+
/*
|
1236
|
+
* call-seq:
|
1237
|
+
* new(name, document)
|
1238
|
+
*
|
1239
|
+
* Create a new node with +name+ sharing GC lifecycle with +document+
|
1240
|
+
*/
|
1241
|
+
static VALUE new(int argc, VALUE *argv, VALUE klass)
|
1242
|
+
{
|
1243
|
+
xmlDocPtr doc;
|
1244
|
+
xmlNodePtr node;
|
1245
|
+
VALUE name;
|
1246
|
+
VALUE document;
|
1247
|
+
VALUE rest;
|
1248
|
+
VALUE rb_node;
|
1249
|
+
|
1250
|
+
rb_scan_args(argc, argv, "2*", &name, &document, &rest);
|
1251
|
+
|
1252
|
+
Data_Get_Struct(document, xmlDoc, doc);
|
1253
|
+
|
1254
|
+
node = xmlNewNode(NULL, (xmlChar *)StringValuePtr(name));
|
1255
|
+
node->doc = doc->doc;
|
1256
|
+
nokogiri_root_node(node);
|
1257
|
+
|
1258
|
+
rb_node = Nokogiri_wrap_xml_node(
|
1259
|
+
klass == cNokogiriXmlNode ? (VALUE)NULL : klass,
|
1260
|
+
node
|
1261
|
+
);
|
1262
|
+
rb_obj_call_init(rb_node, argc, argv);
|
1263
|
+
|
1264
|
+
if(rb_block_given_p()) rb_yield(rb_node);
|
1265
|
+
|
1266
|
+
return rb_node;
|
1267
|
+
}
|
1268
|
+
|
1269
|
+
/*
|
1270
|
+
* call-seq:
|
1271
|
+
* dump_html
|
1272
|
+
*
|
1273
|
+
* Returns the Node as html.
|
1274
|
+
*/
|
1275
|
+
static VALUE dump_html(VALUE self)
|
1276
|
+
{
|
1277
|
+
xmlBufferPtr buf ;
|
1278
|
+
xmlNodePtr node ;
|
1279
|
+
VALUE html;
|
1280
|
+
|
1281
|
+
Data_Get_Struct(self, xmlNode, node);
|
1282
|
+
|
1283
|
+
buf = xmlBufferCreate() ;
|
1284
|
+
htmlNodeDump(buf, node->doc, node);
|
1285
|
+
html = NOKOGIRI_STR_NEW2(buf->content);
|
1286
|
+
xmlBufferFree(buf);
|
1287
|
+
return html ;
|
1288
|
+
}
|
1289
|
+
|
1290
|
+
/*
|
1291
|
+
* call-seq:
|
1292
|
+
* compare(other)
|
1293
|
+
*
|
1294
|
+
* Compare this Node to +other+ with respect to their Document
|
1295
|
+
*/
|
1296
|
+
static VALUE compare(VALUE self, VALUE _other)
|
1297
|
+
{
|
1298
|
+
xmlNodePtr node, other;
|
1299
|
+
Data_Get_Struct(self, xmlNode, node);
|
1300
|
+
Data_Get_Struct(_other, xmlNode, other);
|
1301
|
+
|
1302
|
+
return INT2NUM((long)xmlXPathCmpNodes(other, node));
|
1303
|
+
}
|
1304
|
+
|
1305
|
+
|
1306
|
+
/*
|
1307
|
+
* call-seq:
|
1308
|
+
* process_xincludes(options)
|
1309
|
+
*
|
1310
|
+
* Loads and substitutes all xinclude elements below the node. The
|
1311
|
+
* parser context will be initialized with +options+.
|
1312
|
+
*/
|
1313
|
+
static VALUE process_xincludes(VALUE self, VALUE options)
|
1314
|
+
{
|
1315
|
+
int rcode ;
|
1316
|
+
xmlNodePtr node;
|
1317
|
+
VALUE error_list = rb_ary_new();
|
1318
|
+
|
1319
|
+
Data_Get_Struct(self, xmlNode, node);
|
1320
|
+
|
1321
|
+
xmlSetStructuredErrorFunc((void *)error_list, Nokogiri_error_array_pusher);
|
1322
|
+
rcode = xmlXIncludeProcessTreeFlags(node, (int)NUM2INT(options));
|
1323
|
+
xmlSetStructuredErrorFunc(NULL, NULL);
|
1324
|
+
|
1325
|
+
if (rcode < 0) {
|
1326
|
+
xmlErrorPtr error;
|
1327
|
+
|
1328
|
+
error = xmlGetLastError();
|
1329
|
+
if(error)
|
1330
|
+
rb_exc_raise(Nokogiri_wrap_xml_syntax_error(error));
|
1331
|
+
else
|
1332
|
+
rb_raise(rb_eRuntimeError, "Could not perform xinclude substitution");
|
1333
|
+
}
|
1334
|
+
|
1335
|
+
return self;
|
1336
|
+
}
|
1337
|
+
|
1338
|
+
|
1339
|
+
/* TODO: DOCUMENT ME */
|
1340
|
+
static VALUE in_context(VALUE self, VALUE _str, VALUE _options)
|
1341
|
+
{
|
1342
|
+
xmlNodePtr node, list = 0, tmp, child_iter, node_children, doc_children;
|
1343
|
+
xmlNodeSetPtr set;
|
1344
|
+
xmlParserErrors error;
|
1345
|
+
VALUE doc, err;
|
1346
|
+
int doc_is_empty;
|
1347
|
+
|
1348
|
+
Data_Get_Struct(self, xmlNode, node);
|
1349
|
+
|
1350
|
+
doc = DOC_RUBY_OBJECT(node->doc);
|
1351
|
+
err = rb_iv_get(doc, "@errors");
|
1352
|
+
doc_is_empty = (node->doc->children == NULL) ? 1 : 0;
|
1353
|
+
node_children = node->children;
|
1354
|
+
doc_children = node->doc->children;
|
1355
|
+
|
1356
|
+
xmlSetStructuredErrorFunc((void *)err, Nokogiri_error_array_pusher);
|
1357
|
+
|
1358
|
+
/* Twiddle global variable because of a bug in libxml2.
|
1359
|
+
* http://git.gnome.org/browse/libxml2/commit/?id=e20fb5a72c83cbfc8e4a8aa3943c6be8febadab7
|
1360
|
+
*/
|
1361
|
+
#ifndef HTML_PARSE_NOIMPLIED
|
1362
|
+
htmlHandleOmittedElem(0);
|
1363
|
+
#endif
|
1364
|
+
|
1365
|
+
/* This function adds a fake node to the child of +node+. If the parser
|
1366
|
+
* does not exit cleanly with XML_ERR_OK, the list is freed. This can
|
1367
|
+
* leave the child pointers in a bad state if they were originally empty.
|
1368
|
+
*
|
1369
|
+
* http://git.gnome.org/browse/libxml2/tree/parser.c#n13177
|
1370
|
+
* */
|
1371
|
+
error = xmlParseInNodeContext(node, StringValuePtr(_str),
|
1372
|
+
(int)RSTRING_LEN(_str),
|
1373
|
+
(int)NUM2INT(_options), &list);
|
1374
|
+
|
1375
|
+
/* xmlParseInNodeContext should not mutate the original document or node,
|
1376
|
+
* so reassigning these pointers should be OK. The reason we're reassigning
|
1377
|
+
* is because if there were errors, it's possible for the child pointers
|
1378
|
+
* to be manipulated. */
|
1379
|
+
if (error != XML_ERR_OK) {
|
1380
|
+
node->doc->children = doc_children;
|
1381
|
+
node->children = node_children;
|
1382
|
+
}
|
1383
|
+
|
1384
|
+
/* make sure parent/child pointers are coherent so an unlink will work
|
1385
|
+
* properly (#331)
|
1386
|
+
*/
|
1387
|
+
child_iter = node->doc->children ;
|
1388
|
+
while (child_iter) {
|
1389
|
+
if (child_iter->parent != (xmlNodePtr)node->doc)
|
1390
|
+
child_iter->parent = (xmlNodePtr)node->doc;
|
1391
|
+
child_iter = child_iter->next;
|
1392
|
+
}
|
1393
|
+
|
1394
|
+
#ifndef HTML_PARSE_NOIMPLIED
|
1395
|
+
htmlHandleOmittedElem(1);
|
1396
|
+
#endif
|
1397
|
+
|
1398
|
+
xmlSetStructuredErrorFunc(NULL, NULL);
|
1399
|
+
|
1400
|
+
/* Workaround for a libxml2 bug where a parsing error may leave a broken
|
1401
|
+
* node reference in node->doc->children.
|
1402
|
+
* This workaround is limited to when a parse error occurs, the document
|
1403
|
+
* went from having no children to having children, and the context node is
|
1404
|
+
* part of a document fragment.
|
1405
|
+
* https://bugzilla.gnome.org/show_bug.cgi?id=668155
|
1406
|
+
*/
|
1407
|
+
if (error != XML_ERR_OK && doc_is_empty && node->doc->children != NULL) {
|
1408
|
+
child_iter = node;
|
1409
|
+
while (child_iter->parent)
|
1410
|
+
child_iter = child_iter->parent;
|
1411
|
+
|
1412
|
+
if (child_iter->type == XML_DOCUMENT_FRAG_NODE)
|
1413
|
+
node->doc->children = NULL;
|
1414
|
+
}
|
1415
|
+
|
1416
|
+
/* FIXME: This probably needs to handle more constants... */
|
1417
|
+
switch (error) {
|
1418
|
+
case XML_ERR_INTERNAL_ERROR:
|
1419
|
+
case XML_ERR_NO_MEMORY:
|
1420
|
+
rb_raise(rb_eRuntimeError, "error parsing fragment (%d)", error);
|
1421
|
+
break;
|
1422
|
+
default:
|
1423
|
+
break;
|
1424
|
+
}
|
1425
|
+
|
1426
|
+
set = xmlXPathNodeSetCreate(NULL);
|
1427
|
+
|
1428
|
+
while (list) {
|
1429
|
+
tmp = list->next;
|
1430
|
+
list->next = NULL;
|
1431
|
+
xmlXPathNodeSetAddUnique(set, list);
|
1432
|
+
nokogiri_root_node(list);
|
1433
|
+
list = tmp;
|
1434
|
+
}
|
1435
|
+
|
1436
|
+
return Nokogiri_wrap_xml_node_set(set, doc);
|
1437
|
+
}
|
1438
|
+
|
1439
|
+
|
1440
|
+
VALUE Nokogiri_wrap_xml_node(VALUE klass, xmlNodePtr node)
|
1441
|
+
{
|
1442
|
+
VALUE document = Qnil ;
|
1443
|
+
VALUE node_cache = Qnil ;
|
1444
|
+
VALUE rb_node = Qnil ;
|
1445
|
+
nokogiriTuplePtr node_has_a_document;
|
1446
|
+
xmlDocPtr doc;
|
1447
|
+
void (*mark_method)(xmlNodePtr) = NULL ;
|
1448
|
+
|
1449
|
+
assert(node);
|
1450
|
+
|
1451
|
+
if(node->type == XML_DOCUMENT_NODE || node->type == XML_HTML_DOCUMENT_NODE)
|
1452
|
+
return DOC_RUBY_OBJECT(node->doc);
|
1453
|
+
|
1454
|
+
/* It's OK if the node doesn't have a fully-realized document (as in XML::Reader). */
|
1455
|
+
/* see https://github.com/sparklemotion/nokogiri/issues/95 */
|
1456
|
+
/* and https://github.com/sparklemotion/nokogiri/issues/439 */
|
1457
|
+
doc = node->doc;
|
1458
|
+
if (doc->type == XML_DOCUMENT_FRAG_NODE) doc = doc->doc;
|
1459
|
+
node_has_a_document = DOC_RUBY_OBJECT_TEST(doc);
|
1460
|
+
|
1461
|
+
if(node->_private && node_has_a_document)
|
1462
|
+
return (VALUE)node->_private;
|
1463
|
+
|
1464
|
+
if(!RTEST(klass)) {
|
1465
|
+
switch(node->type)
|
1466
|
+
{
|
1467
|
+
case XML_ELEMENT_NODE:
|
1468
|
+
klass = cNokogiriXmlElement;
|
1469
|
+
break;
|
1470
|
+
case XML_TEXT_NODE:
|
1471
|
+
klass = cNokogiriXmlText;
|
1472
|
+
break;
|
1473
|
+
case XML_ATTRIBUTE_NODE:
|
1474
|
+
klass = cNokogiriXmlAttr;
|
1475
|
+
break;
|
1476
|
+
case XML_ENTITY_REF_NODE:
|
1477
|
+
klass = cNokogiriXmlEntityReference;
|
1478
|
+
break;
|
1479
|
+
case XML_COMMENT_NODE:
|
1480
|
+
klass = cNokogiriXmlComment;
|
1481
|
+
break;
|
1482
|
+
case XML_DOCUMENT_FRAG_NODE:
|
1483
|
+
klass = cNokogiriXmlDocumentFragment;
|
1484
|
+
break;
|
1485
|
+
case XML_PI_NODE:
|
1486
|
+
klass = cNokogiriXmlProcessingInstruction;
|
1487
|
+
break;
|
1488
|
+
case XML_ENTITY_DECL:
|
1489
|
+
klass = cNokogiriXmlEntityDecl;
|
1490
|
+
break;
|
1491
|
+
case XML_CDATA_SECTION_NODE:
|
1492
|
+
klass = cNokogiriXmlCData;
|
1493
|
+
break;
|
1494
|
+
case XML_DTD_NODE:
|
1495
|
+
klass = cNokogiriXmlDtd;
|
1496
|
+
break;
|
1497
|
+
case XML_ATTRIBUTE_DECL:
|
1498
|
+
klass = cNokogiriXmlAttributeDecl;
|
1499
|
+
break;
|
1500
|
+
case XML_ELEMENT_DECL:
|
1501
|
+
klass = cNokogiriXmlElementDecl;
|
1502
|
+
break;
|
1503
|
+
default:
|
1504
|
+
klass = cNokogiriXmlNode;
|
1505
|
+
}
|
1506
|
+
}
|
1507
|
+
|
1508
|
+
mark_method = node_has_a_document ? mark : NULL ;
|
1509
|
+
|
1510
|
+
rb_node = Data_Wrap_Struct(klass, mark_method, debug_node_dealloc, node) ;
|
1511
|
+
node->_private = (void *)rb_node;
|
1512
|
+
|
1513
|
+
if (node_has_a_document) {
|
1514
|
+
document = DOC_RUBY_OBJECT(doc);
|
1515
|
+
node_cache = DOC_NODE_CACHE(doc);
|
1516
|
+
rb_ary_push(node_cache, rb_node);
|
1517
|
+
rb_funcall(document, decorate, 1, rb_node);
|
1518
|
+
}
|
1519
|
+
|
1520
|
+
return rb_node ;
|
1521
|
+
}
|
1522
|
+
|
1523
|
+
|
1524
|
+
void Nokogiri_xml_node_properties(xmlNodePtr node, VALUE attr_list)
|
1525
|
+
{
|
1526
|
+
xmlAttrPtr prop;
|
1527
|
+
prop = node->properties ;
|
1528
|
+
while (prop != NULL) {
|
1529
|
+
rb_ary_push(attr_list, Nokogiri_wrap_xml_node(Qnil, (xmlNodePtr)prop));
|
1530
|
+
prop = prop->next ;
|
1531
|
+
}
|
1532
|
+
}
|
1533
|
+
|
1534
|
+
VALUE cNokogiriXmlNode ;
|
1535
|
+
VALUE cNokogiriXmlElement ;
|
1536
|
+
|
1537
|
+
void init_xml_node()
|
1538
|
+
{
|
1539
|
+
VALUE nokogiri = rb_define_module("Nokogiri");
|
1540
|
+
VALUE xml = rb_define_module_under(nokogiri, "XML");
|
1541
|
+
VALUE klass = rb_define_class_under(xml, "Node", rb_cObject);
|
1542
|
+
|
1543
|
+
cNokogiriXmlNode = klass;
|
1544
|
+
|
1545
|
+
cNokogiriXmlElement = rb_define_class_under(xml, "Element", klass);
|
1546
|
+
|
1547
|
+
rb_define_singleton_method(klass, "new", new, -1);
|
1548
|
+
|
1549
|
+
rb_define_method(klass, "add_namespace_definition", add_namespace_definition, 2);
|
1550
|
+
rb_define_method(klass, "node_name", get_name, 0);
|
1551
|
+
rb_define_method(klass, "document", document, 0);
|
1552
|
+
rb_define_method(klass, "node_name=", set_name, 1);
|
1553
|
+
rb_define_method(klass, "parent", get_parent, 0);
|
1554
|
+
rb_define_method(klass, "child", child, 0);
|
1555
|
+
rb_define_method(klass, "first_element_child", first_element_child, 0);
|
1556
|
+
rb_define_method(klass, "last_element_child", last_element_child, 0);
|
1557
|
+
rb_define_method(klass, "children", children, 0);
|
1558
|
+
rb_define_method(klass, "element_children", element_children, 0);
|
1559
|
+
rb_define_method(klass, "next_sibling", next_sibling, 0);
|
1560
|
+
rb_define_method(klass, "previous_sibling", previous_sibling, 0);
|
1561
|
+
rb_define_method(klass, "next_element", next_element, 0);
|
1562
|
+
rb_define_method(klass, "previous_element", previous_element, 0);
|
1563
|
+
rb_define_method(klass, "node_type", node_type, 0);
|
1564
|
+
rb_define_method(klass, "content", get_content, 0);
|
1565
|
+
rb_define_method(klass, "path", path, 0);
|
1566
|
+
rb_define_method(klass, "key?", key_eh, 1);
|
1567
|
+
rb_define_method(klass, "namespaced_key?", namespaced_key_eh, 2);
|
1568
|
+
rb_define_method(klass, "blank?", blank_eh, 0);
|
1569
|
+
rb_define_method(klass, "attribute_nodes", attribute_nodes, 0);
|
1570
|
+
rb_define_method(klass, "attribute", attr, 1);
|
1571
|
+
rb_define_method(klass, "attribute_with_ns", attribute_with_ns, 2);
|
1572
|
+
rb_define_method(klass, "namespace", namespace, 0);
|
1573
|
+
rb_define_method(klass, "namespace_definitions", namespace_definitions, 0);
|
1574
|
+
rb_define_method(klass, "namespace_scopes", namespace_scopes, 0);
|
1575
|
+
rb_define_method(klass, "encode_special_chars", encode_special_chars, 1);
|
1576
|
+
rb_define_method(klass, "dup", duplicate_node, -1);
|
1577
|
+
rb_define_method(klass, "unlink", unlink_node, 0);
|
1578
|
+
rb_define_method(klass, "internal_subset", internal_subset, 0);
|
1579
|
+
rb_define_method(klass, "external_subset", external_subset, 0);
|
1580
|
+
rb_define_method(klass, "create_internal_subset", create_internal_subset, 3);
|
1581
|
+
rb_define_method(klass, "create_external_subset", create_external_subset, 3);
|
1582
|
+
rb_define_method(klass, "pointer_id", pointer_id, 0);
|
1583
|
+
rb_define_method(klass, "line", line, 0);
|
1584
|
+
rb_define_method(klass, "native_content=", native_content, 1);
|
1585
|
+
|
1586
|
+
rb_define_private_method(klass, "process_xincludes", process_xincludes, 1);
|
1587
|
+
rb_define_private_method(klass, "in_context", in_context, 2);
|
1588
|
+
rb_define_private_method(klass, "add_child_node", add_child, 1);
|
1589
|
+
rb_define_private_method(klass, "add_previous_sibling_node", add_previous_sibling, 1);
|
1590
|
+
rb_define_private_method(klass, "add_next_sibling_node", add_next_sibling, 1);
|
1591
|
+
rb_define_private_method(klass, "replace_node", replace, 1);
|
1592
|
+
rb_define_private_method(klass, "dump_html", dump_html, 0);
|
1593
|
+
rb_define_private_method(klass, "native_write_to", native_write_to, 4);
|
1594
|
+
rb_define_private_method(klass, "get", get, 1);
|
1595
|
+
rb_define_private_method(klass, "set", set, 2);
|
1596
|
+
rb_define_private_method(klass, "set_namespace", set_namespace, 1);
|
1597
|
+
rb_define_private_method(klass, "compare", compare, 1);
|
1598
|
+
|
1599
|
+
decorate = rb_intern("decorate");
|
1600
|
+
decorate_bang = rb_intern("decorate!");
|
1601
|
+
}
|
1602
|
+
|
1603
|
+
/* vim: set noet sw=4 sws=4 */
|