libxml-ruby 2.9.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/HISTORY +811 -790
 - data/LICENSE +20 -20
 - data/MANIFEST +166 -166
 - data/README.rdoc +188 -184
 - data/Rakefile +1 -1
 - data/ext/libxml/libxml.c +80 -80
 - data/ext/libxml/ruby_libxml.h +75 -75
 - data/ext/libxml/ruby_xml.c +0 -84
 - data/ext/libxml/ruby_xml.h +0 -10
 - data/ext/libxml/ruby_xml_attr.h +12 -12
 - data/ext/libxml/ruby_xml_attr_decl.c +153 -153
 - data/ext/libxml/ruby_xml_attr_decl.h +11 -11
 - data/ext/libxml/ruby_xml_attributes.c +275 -275
 - data/ext/libxml/ruby_xml_attributes.h +15 -15
 - data/ext/libxml/ruby_xml_document.c +21 -27
 - data/ext/libxml/ruby_xml_document.h +11 -11
 - data/ext/libxml/ruby_xml_dtd.c +2 -13
 - data/ext/libxml/ruby_xml_dtd.h +9 -9
 - data/ext/libxml/ruby_xml_error.c +996 -996
 - data/ext/libxml/ruby_xml_error.h +12 -12
 - data/ext/libxml/ruby_xml_html_parser.c +89 -92
 - data/ext/libxml/ruby_xml_html_parser.h +10 -10
 - data/ext/libxml/ruby_xml_html_parser_context.h +10 -10
 - data/ext/libxml/ruby_xml_html_parser_options.c +46 -46
 - data/ext/libxml/ruby_xml_html_parser_options.h +10 -10
 - data/ext/libxml/ruby_xml_input_cbg.h +20 -20
 - data/ext/libxml/ruby_xml_io.c +0 -1
 - data/ext/libxml/ruby_xml_io.h +10 -10
 - data/ext/libxml/ruby_xml_namespace.c +153 -153
 - data/ext/libxml/ruby_xml_namespace.h +10 -10
 - data/ext/libxml/ruby_xml_namespaces.c +293 -293
 - data/ext/libxml/ruby_xml_namespaces.h +9 -9
 - data/ext/libxml/ruby_xml_node.c +100 -143
 - data/ext/libxml/ruby_xml_node.h +13 -11
 - data/ext/libxml/ruby_xml_parser.c +91 -94
 - data/ext/libxml/ruby_xml_parser.h +12 -12
 - data/ext/libxml/ruby_xml_parser_context.h +10 -10
 - data/ext/libxml/ruby_xml_parser_options.c +66 -66
 - data/ext/libxml/ruby_xml_parser_options.h +12 -12
 - data/ext/libxml/ruby_xml_reader.c +45 -37
 - data/ext/libxml/ruby_xml_reader.h +17 -17
 - data/ext/libxml/ruby_xml_relaxng.h +10 -10
 - data/ext/libxml/ruby_xml_sax2_handler.c +3 -3
 - data/ext/libxml/ruby_xml_sax2_handler.h +10 -10
 - data/ext/libxml/ruby_xml_sax_parser.c +116 -120
 - data/ext/libxml/ruby_xml_sax_parser.h +10 -10
 - data/ext/libxml/ruby_xml_schema.h +809 -809
 - data/ext/libxml/ruby_xml_schema_attribute.c +109 -109
 - data/ext/libxml/ruby_xml_schema_attribute.h +15 -15
 - data/ext/libxml/ruby_xml_schema_element.c +94 -94
 - data/ext/libxml/ruby_xml_schema_element.h +14 -14
 - data/ext/libxml/ruby_xml_schema_facet.c +52 -52
 - data/ext/libxml/ruby_xml_schema_facet.h +13 -13
 - data/ext/libxml/ruby_xml_schema_type.c +259 -259
 - data/ext/libxml/ruby_xml_schema_type.h +9 -9
 - data/ext/libxml/ruby_xml_version.h +9 -9
 - data/ext/libxml/ruby_xml_writer.c +1136 -1136
 - data/ext/libxml/ruby_xml_writer.h +10 -10
 - data/ext/libxml/ruby_xml_xinclude.c +16 -16
 - data/ext/libxml/ruby_xml_xinclude.h +11 -11
 - data/ext/libxml/ruby_xml_xpath.c +42 -36
 - data/ext/libxml/ruby_xml_xpath.h +13 -13
 - data/ext/libxml/ruby_xml_xpath_context.c +1 -1
 - data/ext/libxml/ruby_xml_xpath_context.h +9 -9
 - data/ext/libxml/ruby_xml_xpath_expression.c +81 -81
 - data/ext/libxml/ruby_xml_xpath_expression.h +10 -10
 - data/ext/libxml/ruby_xml_xpath_object.c +5 -2
 - data/ext/libxml/ruby_xml_xpath_object.h +17 -17
 - data/ext/libxml/ruby_xml_xpointer.c +99 -99
 - data/ext/libxml/ruby_xml_xpointer.h +11 -11
 - data/ext/vc/libxml_ruby.sln +17 -15
 - data/lib/libxml.rb +1 -6
 - data/lib/libxml/node.rb +2 -78
 - data/lib/libxml/parser.rb +0 -266
 - data/lib/libxml/sax_parser.rb +0 -17
 - data/lib/libxml/schema.rb +66 -66
 - data/lib/libxml/schema/attribute.rb +19 -19
 - data/lib/libxml/schema/element.rb +27 -27
 - data/lib/libxml/schema/type.rb +29 -29
 - data/script/benchmark/depixelate +634 -634
 - data/script/benchmark/hamlet.xml +9054 -9054
 - data/script/benchmark/parsecount +170 -170
 - data/script/benchmark/throughput +41 -41
 - data/script/test +6 -6
 - data/test/c14n/given/example-1.xml +14 -14
 - data/test/c14n/given/example-2.xml +11 -11
 - data/test/c14n/given/example-3.xml +18 -18
 - data/test/c14n/given/example-4.xml +9 -9
 - data/test/c14n/given/example-5.xml +12 -12
 - data/test/c14n/given/example-6.xml +2 -2
 - data/test/c14n/given/example-7.xml +11 -11
 - data/test/c14n/given/example-8.xml +11 -11
 - data/test/c14n/given/example-8.xpath +9 -9
 - data/test/c14n/result/1-1-without-comments/example-1 +3 -3
 - data/test/c14n/result/1-1-without-comments/example-2 +10 -10
 - data/test/c14n/result/1-1-without-comments/example-3 +13 -13
 - data/test/c14n/result/1-1-without-comments/example-4 +8 -8
 - data/test/c14n/result/1-1-without-comments/example-5 +2 -2
 - data/test/c14n/result/with-comments/example-1 +5 -5
 - data/test/c14n/result/with-comments/example-2 +10 -10
 - data/test/c14n/result/with-comments/example-3 +13 -13
 - data/test/c14n/result/with-comments/example-4 +8 -8
 - data/test/c14n/result/with-comments/example-5 +3 -3
 - data/test/c14n/result/without-comments/example-1 +3 -3
 - data/test/c14n/result/without-comments/example-2 +10 -10
 - data/test/c14n/result/without-comments/example-3 +13 -13
 - data/test/c14n/result/without-comments/example-4 +8 -8
 - data/test/c14n/result/without-comments/example-5 +2 -2
 - data/test/model/atom.xml +12 -12
 - data/test/model/bands.iso-8859-1.xml +4 -4
 - data/test/model/bands.utf-8.xml +4 -4
 - data/test/model/bands.xml +4 -4
 - data/test/model/books.xml +153 -153
 - data/test/model/merge_bug_data.xml +58 -58
 - data/test/model/ruby-lang.html +238 -238
 - data/test/model/rubynet.xml +79 -79
 - data/test/model/shiporder.rnc +28 -28
 - data/test/model/shiporder.rng +86 -86
 - data/test/model/shiporder.xml +22 -22
 - data/test/model/shiporder.xsd +39 -39
 - data/test/model/soap.xml +27 -27
 - data/test/model/xinclude.xml +4 -4
 - data/test/tc_attributes.rb +0 -6
 - data/test/tc_error.rb +157 -158
 - data/test/tc_node.rb +33 -17
 - data/test/tc_node_edit.rb +0 -15
 - data/test/tc_node_pi.rb +39 -39
 - data/test/tc_parser.rb +0 -48
 - data/test/tc_reader.rb +12 -53
 - data/test/tc_writer.rb +447 -447
 - data/test/tc_xpath.rb +1 -1
 - data/test/test_helper.rb +2 -2
 - metadata +3 -8
 - data/ext/libxml/extconf.h +0 -4
 - data/lib/libxml/ns.rb +0 -22
 - data/lib/libxml/properties.rb +0 -23
 - data/lib/libxml/reader.rb +0 -29
 - data/lib/libxml/xpath_object.rb +0 -16
 
    
        data/test/model/soap.xml
    CHANGED
    
    | 
         @@ -1,27 +1,27 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            <?xml version="1.0" encoding="utf-8"?>
         
     | 
| 
       2 
     | 
    
         
            -
            <soap:Envelope
         
     | 
| 
       3 
     | 
    
         
            -
                  xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
         
     | 
| 
       4 
     | 
    
         
            -
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
         
     | 
| 
       5 
     | 
    
         
            -
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         
     | 
| 
       6 
     | 
    
         
            -
                  soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
         
     | 
| 
       7 
     | 
    
         
            -
              <soap:Body>
         
     | 
| 
       8 
     | 
    
         
            -
                <getManufacturerNamesResponse name="widgestRus" xmlns="http://services.somewhere.com">
         
     | 
| 
       9 
     | 
    
         
            -
                  <IDAndNameList xmlns="http://services.somewhere.com">
         
     | 
| 
       10 
     | 
    
         
            -
                    <ns1:IdAndName xmlns:ns1="http://domain.somewhere.com">
         
     | 
| 
       11 
     | 
    
         
            -
                      <id xmlns="http://domain.somewhere.com">1</id>
         
     | 
| 
       12 
     | 
    
         
            -
                      <name xmlns="http://domain.somewhere.com">man1</name>
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
                    </ns1:IdAndName>
         
     | 
| 
       15 
     | 
    
         
            -
                    <ns1:IdAndName xmlns:ns1="http://domain.somewhere.com">
         
     | 
| 
       16 
     | 
    
         
            -
                      <id xmlns="http://domain.somewhere.com">2</id>
         
     | 
| 
       17 
     | 
    
         
            -
                      <name xmlns="http://domain.somewhere.com">man2</name>
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
                    </ns1:IdAndName>
         
     | 
| 
       20 
     | 
    
         
            -
                    <ns1:IdAndName xmlns:ns1="http://domain.somewhere.com">
         
     | 
| 
       21 
     | 
    
         
            -
                      <id xmlns="http://domain.somewhere.com">3</id>
         
     | 
| 
       22 
     | 
    
         
            -
                      <name xmlns="http://domain.somewhere.com">man3</name>
         
     | 
| 
       23 
     | 
    
         
            -
                    </ns1:IdAndName>
         
     | 
| 
       24 
     | 
    
         
            -
                  </IDAndNameList>
         
     | 
| 
       25 
     | 
    
         
            -
                </getManufacturerNamesResponse>
         
     | 
| 
       26 
     | 
    
         
            -
              </soap:Body>
         
     | 
| 
       27 
     | 
    
         
            -
            </soap:Envelope>
         
     | 
| 
      
 1 
     | 
    
         
            +
            <?xml version="1.0" encoding="utf-8"?>
         
     | 
| 
      
 2 
     | 
    
         
            +
            <soap:Envelope
         
     | 
| 
      
 3 
     | 
    
         
            +
                  xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
         
     | 
| 
      
 4 
     | 
    
         
            +
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
         
     | 
| 
      
 5 
     | 
    
         
            +
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         
     | 
| 
      
 6 
     | 
    
         
            +
                  soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
         
     | 
| 
      
 7 
     | 
    
         
            +
              <soap:Body>
         
     | 
| 
      
 8 
     | 
    
         
            +
                <getManufacturerNamesResponse name="widgestRus" xmlns="http://services.somewhere.com">
         
     | 
| 
      
 9 
     | 
    
         
            +
                  <IDAndNameList xmlns="http://services.somewhere.com">
         
     | 
| 
      
 10 
     | 
    
         
            +
                    <ns1:IdAndName xmlns:ns1="http://domain.somewhere.com">
         
     | 
| 
      
 11 
     | 
    
         
            +
                      <id xmlns="http://domain.somewhere.com">1</id>
         
     | 
| 
      
 12 
     | 
    
         
            +
                      <name xmlns="http://domain.somewhere.com">man1</name>
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                    </ns1:IdAndName>
         
     | 
| 
      
 15 
     | 
    
         
            +
                    <ns1:IdAndName xmlns:ns1="http://domain.somewhere.com">
         
     | 
| 
      
 16 
     | 
    
         
            +
                      <id xmlns="http://domain.somewhere.com">2</id>
         
     | 
| 
      
 17 
     | 
    
         
            +
                      <name xmlns="http://domain.somewhere.com">man2</name>
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                    </ns1:IdAndName>
         
     | 
| 
      
 20 
     | 
    
         
            +
                    <ns1:IdAndName xmlns:ns1="http://domain.somewhere.com">
         
     | 
| 
      
 21 
     | 
    
         
            +
                      <id xmlns="http://domain.somewhere.com">3</id>
         
     | 
| 
      
 22 
     | 
    
         
            +
                      <name xmlns="http://domain.somewhere.com">man3</name>
         
     | 
| 
      
 23 
     | 
    
         
            +
                    </ns1:IdAndName>
         
     | 
| 
      
 24 
     | 
    
         
            +
                  </IDAndNameList>
         
     | 
| 
      
 25 
     | 
    
         
            +
                </getManufacturerNamesResponse>
         
     | 
| 
      
 26 
     | 
    
         
            +
              </soap:Body>
         
     | 
| 
      
 27 
     | 
    
         
            +
            </soap:Envelope>
         
     | 
    
        data/test/model/xinclude.xml
    CHANGED
    
    | 
         @@ -1,5 +1,5 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            <?xml version="1.0"?>
         
     | 
| 
       2 
     | 
    
         
            -
            <document xmlns:xi="http://www.w3.org/2001/XInclude">
         
     | 
| 
       3 
     | 
    
         
            -
              <p>This libxml2 binding has the following project information:
         
     | 
| 
       4 
     | 
    
         
            -
               <code><xi:include href="rubynet_project" parse="text"/></code></p>
         
     | 
| 
      
 1 
     | 
    
         
            +
            <?xml version="1.0"?>
         
     | 
| 
      
 2 
     | 
    
         
            +
            <document xmlns:xi="http://www.w3.org/2001/XInclude">
         
     | 
| 
      
 3 
     | 
    
         
            +
              <p>This libxml2 binding has the following project information:
         
     | 
| 
      
 4 
     | 
    
         
            +
               <code><xi:include href="rubynet_project" parse="text"/></code></p>
         
     | 
| 
       5 
5 
     | 
    
         
             
            </document>
         
     | 
    
        data/test/tc_attributes.rb
    CHANGED
    
    | 
         @@ -74,12 +74,6 @@ class AttributesTest < Minitest::Test 
     | 
|
| 
       74 
74 
     | 
    
         
             
                assert_nil(attr)
         
     | 
| 
       75 
75 
     | 
    
         
             
              end
         
     | 
| 
       76 
76 
     | 
    
         | 
| 
       77 
     | 
    
         
            -
              def test_property
         
     | 
| 
       78 
     | 
    
         
            -
                attr = city_member.property('name')
         
     | 
| 
       79 
     | 
    
         
            -
                assert_instance_of(String, attr)
         
     | 
| 
       80 
     | 
    
         
            -
                assert_equal('Cambridge', attr)
         
     | 
| 
       81 
     | 
    
         
            -
              end
         
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
77 
     | 
    
         
             
              def test_get_values
         
     | 
| 
       84 
78 
     | 
    
         
             
                assert_equal('Cambridge', city_member[:name])
         
     | 
| 
       85 
79 
     | 
    
         
             
                assert_equal('http://www.foo.net/cgi-bin/wfs?FeatureID=C10239', city_member[:href])
         
     | 
    
        data/test/tc_error.rb
    CHANGED
    
    | 
         @@ -4,133 +4,133 @@ require './test_helper' 
     | 
|
| 
       4 
4 
     | 
    
         
             
            require 'stringio'
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            class TestError < Minitest::Test
         
     | 
| 
       7 
     | 
    
         
            -
              def test_error_codes
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
              end
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
              def test_invalid_handler
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
              end
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
              def test_handler
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
              end
         
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
              def test_reset_handler
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
              end
         
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
              def test_get_handler
         
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
              end
         
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
              def test_verbose_handler
         
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
             
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
       86 
     | 
    
         
            -
             
     | 
| 
       87 
     | 
    
         
            -
              end
         
     | 
| 
       88 
     | 
    
         
            -
             
     | 
| 
       89 
     | 
    
         
            -
              def test_no_hanlder
         
     | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
       94 
     | 
    
         
            -
             
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
       102 
     | 
    
         
            -
             
     | 
| 
       103 
     | 
    
         
            -
              end
         
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
     | 
    
         
            -
              def test_parse_error
         
     | 
| 
       106 
     | 
    
         
            -
             
     | 
| 
       107 
     | 
    
         
            -
             
     | 
| 
       108 
     | 
    
         
            -
             
     | 
| 
       109 
     | 
    
         
            -
             
     | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
       111 
     | 
    
         
            -
             
     | 
| 
       112 
     | 
    
         
            -
             
     | 
| 
       113 
     | 
    
         
            -
             
     | 
| 
       114 
     | 
    
         
            -
             
     | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
       116 
     | 
    
         
            -
             
     | 
| 
       117 
     | 
    
         
            -
              end
         
     | 
| 
       118 
     | 
    
         
            -
             
     | 
| 
       119 
     | 
    
         
            -
              def test_xpath_error
         
     | 
| 
       120 
     | 
    
         
            -
             
     | 
| 
       121 
     | 
    
         
            -
             
     | 
| 
       122 
     | 
    
         
            -
             
     | 
| 
       123 
     | 
    
         
            -
             
     | 
| 
       124 
     | 
    
         
            -
             
     | 
| 
       125 
     | 
    
         
            -
             
     | 
| 
       126 
     | 
    
         
            -
             
     | 
| 
       127 
     | 
    
         
            -
             
     | 
| 
       128 
     | 
    
         
            -
             
     | 
| 
       129 
     | 
    
         
            -
             
     | 
| 
       130 
     | 
    
         
            -
             
     | 
| 
       131 
     | 
    
         
            -
             
     | 
| 
       132 
     | 
    
         
            -
             
     | 
| 
       133 
     | 
    
         
            -
              end
         
     | 
| 
      
 7 
     | 
    
         
            +
              # def test_error_codes
         
     | 
| 
      
 8 
     | 
    
         
            +
              #   assert_equal(4, XML::Error::DTD)
         
     | 
| 
      
 9 
     | 
    
         
            +
              #   assert_equal(4, XML::Error.const_get('DTD'))
         
     | 
| 
      
 10 
     | 
    
         
            +
              #
         
     | 
| 
      
 11 
     | 
    
         
            +
              #   assert_equal(4, XML::Error::DOCUMENT_EMPTY)
         
     | 
| 
      
 12 
     | 
    
         
            +
              #   assert_equal(4, XML::Error.const_get('DOCUMENT_EMPTY'))
         
     | 
| 
      
 13 
     | 
    
         
            +
              # end
         
     | 
| 
      
 14 
     | 
    
         
            +
              #
         
     | 
| 
      
 15 
     | 
    
         
            +
              # def test_invalid_handler
         
     | 
| 
      
 16 
     | 
    
         
            +
              #   assert_raises(RuntimeError) do
         
     | 
| 
      
 17 
     | 
    
         
            +
              #     XML::Error.set_handler
         
     | 
| 
      
 18 
     | 
    
         
            +
              #   end
         
     | 
| 
      
 19 
     | 
    
         
            +
              # end
         
     | 
| 
      
 20 
     | 
    
         
            +
              #
         
     | 
| 
      
 21 
     | 
    
         
            +
              # def test_handler
         
     | 
| 
      
 22 
     | 
    
         
            +
              #   exception = nil
         
     | 
| 
      
 23 
     | 
    
         
            +
              #   XML::Error.set_handler do |error|
         
     | 
| 
      
 24 
     | 
    
         
            +
              #     exception = error
         
     | 
| 
      
 25 
     | 
    
         
            +
              #   end
         
     | 
| 
      
 26 
     | 
    
         
            +
              #
         
     | 
| 
      
 27 
     | 
    
         
            +
              #   # Raise the error
         
     | 
| 
      
 28 
     | 
    
         
            +
              #   error = assert_raises(XML::Error) do
         
     | 
| 
      
 29 
     | 
    
         
            +
              #     XML::Reader.string('<foo').read
         
     | 
| 
      
 30 
     | 
    
         
            +
              #   end
         
     | 
| 
      
 31 
     | 
    
         
            +
              #   assert_equal(exception, error)
         
     | 
| 
      
 32 
     | 
    
         
            +
              #
         
     | 
| 
      
 33 
     | 
    
         
            +
              #   # Check the handler worked
         
     | 
| 
      
 34 
     | 
    
         
            +
              #   refute_nil(exception)
         
     | 
| 
      
 35 
     | 
    
         
            +
              #   assert_kind_of(XML::Error, exception)
         
     | 
| 
      
 36 
     | 
    
         
            +
              #   assert_equal("Fatal error: Couldn't find end of Start Tag foo at :1.", exception.message)
         
     | 
| 
      
 37 
     | 
    
         
            +
              #   assert_equal(XML::Error::PARSER, exception.domain)
         
     | 
| 
      
 38 
     | 
    
         
            +
              #   assert_equal(XML::Error::GT_REQUIRED, exception.code)
         
     | 
| 
      
 39 
     | 
    
         
            +
              #   assert_equal(XML::Error::FATAL, exception.level)
         
     | 
| 
      
 40 
     | 
    
         
            +
              #   assert_nil(exception.file)
         
     | 
| 
      
 41 
     | 
    
         
            +
              #   assert_equal(1, exception.line)
         
     | 
| 
      
 42 
     | 
    
         
            +
              #   assert_equal('foo', exception.str1)
         
     | 
| 
      
 43 
     | 
    
         
            +
              #   assert_nil(exception.str2)
         
     | 
| 
      
 44 
     | 
    
         
            +
              #   assert_nil(exception.str3)
         
     | 
| 
      
 45 
     | 
    
         
            +
              #   assert_equal(0, exception.int1)
         
     | 
| 
      
 46 
     | 
    
         
            +
              #   assert_equal(5, exception.int2)
         
     | 
| 
      
 47 
     | 
    
         
            +
              #   assert_nil(exception.node)
         
     | 
| 
      
 48 
     | 
    
         
            +
              # end
         
     | 
| 
      
 49 
     | 
    
         
            +
              #
         
     | 
| 
      
 50 
     | 
    
         
            +
              # def test_reset_handler
         
     | 
| 
      
 51 
     | 
    
         
            +
              #   exception = nil
         
     | 
| 
      
 52 
     | 
    
         
            +
              #   XML::Error.set_handler do |error|
         
     | 
| 
      
 53 
     | 
    
         
            +
              #     exception = error
         
     | 
| 
      
 54 
     | 
    
         
            +
              #   end
         
     | 
| 
      
 55 
     | 
    
         
            +
              #
         
     | 
| 
      
 56 
     | 
    
         
            +
              #   XML::Error.reset_handler
         
     | 
| 
      
 57 
     | 
    
         
            +
              #   XML::Reader.string('<foo')
         
     | 
| 
      
 58 
     | 
    
         
            +
              #   assert_nil(exception)
         
     | 
| 
      
 59 
     | 
    
         
            +
              # end
         
     | 
| 
      
 60 
     | 
    
         
            +
              #
         
     | 
| 
      
 61 
     | 
    
         
            +
              # def test_get_handler
         
     | 
| 
      
 62 
     | 
    
         
            +
              #   assert_respond_to(XML::Error, :get_handler)
         
     | 
| 
      
 63 
     | 
    
         
            +
              #   assert_equal(0, XML::Error.method(:get_handler).arity)
         
     | 
| 
      
 64 
     | 
    
         
            +
              #
         
     | 
| 
      
 65 
     | 
    
         
            +
              #   saved_handler = XML::Error.get_handler
         
     | 
| 
      
 66 
     | 
    
         
            +
              #   XML::Error.set_handler{ puts "New handler" }
         
     | 
| 
      
 67 
     | 
    
         
            +
              #   refute_equal(XML::Error.get_handler, saved_handler)
         
     | 
| 
      
 68 
     | 
    
         
            +
              #
         
     | 
| 
      
 69 
     | 
    
         
            +
              #   XML::Error.set_handler(&saved_handler)
         
     | 
| 
      
 70 
     | 
    
         
            +
              #   assert_equal(XML::Error.get_handler, saved_handler)
         
     | 
| 
      
 71 
     | 
    
         
            +
              # end
         
     | 
| 
      
 72 
     | 
    
         
            +
              #
         
     | 
| 
      
 73 
     | 
    
         
            +
              # def test_verbose_handler
         
     | 
| 
      
 74 
     | 
    
         
            +
              #   XML::Error.set_handler(&XML::Error::VERBOSE_HANDLER)
         
     | 
| 
      
 75 
     | 
    
         
            +
              #   output = StringIO.new
         
     | 
| 
      
 76 
     | 
    
         
            +
              #   original_stderr = Object::STDERR
         
     | 
| 
      
 77 
     | 
    
         
            +
              #
         
     | 
| 
      
 78 
     | 
    
         
            +
              #   Object.const_set(:STDERR, output)
         
     | 
| 
      
 79 
     | 
    
         
            +
              #   begin
         
     | 
| 
      
 80 
     | 
    
         
            +
              #     assert_raises(XML::Error) do
         
     | 
| 
      
 81 
     | 
    
         
            +
              #       XML::Parser.string('<foo><bar/></foz>').parse
         
     | 
| 
      
 82 
     | 
    
         
            +
              #     end
         
     | 
| 
      
 83 
     | 
    
         
            +
              #   ensure
         
     | 
| 
      
 84 
     | 
    
         
            +
              #     Object.const_set(:STDERR, original_stderr)
         
     | 
| 
      
 85 
     | 
    
         
            +
              #   end
         
     | 
| 
      
 86 
     | 
    
         
            +
              #   assert_equal("Fatal error: Opening and ending tag mismatch: foo line 1 and foz at :1.\n", output.string)
         
     | 
| 
      
 87 
     | 
    
         
            +
              # end
         
     | 
| 
      
 88 
     | 
    
         
            +
              #
         
     | 
| 
      
 89 
     | 
    
         
            +
              # def test_no_hanlder
         
     | 
| 
      
 90 
     | 
    
         
            +
              #   XML::Error.reset_handler
         
     | 
| 
      
 91 
     | 
    
         
            +
              #   output = StringIO.new
         
     | 
| 
      
 92 
     | 
    
         
            +
              #   original_stderr = Object::STDERR
         
     | 
| 
      
 93 
     | 
    
         
            +
              #
         
     | 
| 
      
 94 
     | 
    
         
            +
              #   Object.const_set(:STDERR, output)
         
     | 
| 
      
 95 
     | 
    
         
            +
              #   begin
         
     | 
| 
      
 96 
     | 
    
         
            +
              #     assert_raises(XML::Error) do
         
     | 
| 
      
 97 
     | 
    
         
            +
              #       XML::Parser.string('<foo><bar/></foz>').parse
         
     | 
| 
      
 98 
     | 
    
         
            +
              #     end
         
     | 
| 
      
 99 
     | 
    
         
            +
              #   ensure
         
     | 
| 
      
 100 
     | 
    
         
            +
              #     Object.const_set(:STDERR, original_stderr)
         
     | 
| 
      
 101 
     | 
    
         
            +
              #   end
         
     | 
| 
      
 102 
     | 
    
         
            +
              #   assert_equal('', output.string)
         
     | 
| 
      
 103 
     | 
    
         
            +
              # end
         
     | 
| 
      
 104 
     | 
    
         
            +
              #
         
     | 
| 
      
 105 
     | 
    
         
            +
              # def test_parse_error
         
     | 
| 
      
 106 
     | 
    
         
            +
              #   exception = assert_raises(XML::Error) do
         
     | 
| 
      
 107 
     | 
    
         
            +
              #     XML::Parser.string('<foo><bar/></foz>').parse
         
     | 
| 
      
 108 
     | 
    
         
            +
              #   end
         
     | 
| 
      
 109 
     | 
    
         
            +
              #
         
     | 
| 
      
 110 
     | 
    
         
            +
              #   assert_instance_of(XML::Error, exception)
         
     | 
| 
      
 111 
     | 
    
         
            +
              #   assert_equal("Fatal error: Opening and ending tag mismatch: foo line 1 and foz at :1.", exception.message)
         
     | 
| 
      
 112 
     | 
    
         
            +
              #   assert_equal(XML::Error::PARSER, exception.domain)
         
     | 
| 
      
 113 
     | 
    
         
            +
              #   assert_equal(XML::Error::TAG_NAME_MISMATCH, exception.code)
         
     | 
| 
      
 114 
     | 
    
         
            +
              #   assert_equal(XML::Error::FATAL, exception.level)
         
     | 
| 
      
 115 
     | 
    
         
            +
              #   assert_nil(exception.file)
         
     | 
| 
      
 116 
     | 
    
         
            +
              #   assert_equal(1, exception.line)
         
     | 
| 
      
 117 
     | 
    
         
            +
              # end
         
     | 
| 
      
 118 
     | 
    
         
            +
              #
         
     | 
| 
      
 119 
     | 
    
         
            +
              # def test_xpath_error
         
     | 
| 
      
 120 
     | 
    
         
            +
              #   doc = XML::Document.file(File.join(File.dirname(__FILE__), 'model/soap.xml'))
         
     | 
| 
      
 121 
     | 
    
         
            +
              #
         
     | 
| 
      
 122 
     | 
    
         
            +
              #   exception = assert_raises(XML::Error) do
         
     | 
| 
      
 123 
     | 
    
         
            +
              #     doc.find('/foo[bar=test')
         
     | 
| 
      
 124 
     | 
    
         
            +
              #   end
         
     | 
| 
      
 125 
     | 
    
         
            +
              #
         
     | 
| 
      
 126 
     | 
    
         
            +
              #   assert_instance_of(XML::Error, exception)
         
     | 
| 
      
 127 
     | 
    
         
            +
              #   assert_equal("Error: Invalid predicate.", exception.message)
         
     | 
| 
      
 128 
     | 
    
         
            +
              #   assert_equal(XML::Error::XPATH, exception.domain)
         
     | 
| 
      
 129 
     | 
    
         
            +
              #   assert_equal(XML::Error::XPATH_INVALID_PREDICATE_ERROR, exception.code)
         
     | 
| 
      
 130 
     | 
    
         
            +
              #   assert_equal(XML::Error::ERROR, exception.level)
         
     | 
| 
      
 131 
     | 
    
         
            +
              #   assert_nil(exception.file)
         
     | 
| 
      
 132 
     | 
    
         
            +
              #   assert_nil(nil)
         
     | 
| 
      
 133 
     | 
    
         
            +
              # end
         
     | 
| 
       134 
134 
     | 
    
         | 
| 
       135 
135 
     | 
    
         
             
              def test_double_parse
         
     | 
| 
       136 
136 
     | 
    
         
             
                XML::Parser.register_error_handler(lambda {|msg| nil })
         
     | 
| 
         @@ -145,35 +145,34 @@ class TestError < Minitest::Test 
     | 
|
| 
       145 
145 
     | 
    
         
             
                assert_equal(" LibXML::XML::Error.", error.to_s)
         
     | 
| 
       146 
146 
     | 
    
         
             
              end
         
     | 
| 
       147 
147 
     | 
    
         | 
| 
       148 
     | 
    
         
            -
              def test_libxml_parser_empty_string
         
     | 
| 
       149 
     | 
    
         
            -
             
     | 
| 
       150 
     | 
    
         
            -
             
     | 
| 
       151 
     | 
    
         
            -
             
     | 
| 
       152 
     | 
    
         
            -
             
     | 
| 
       153 
     | 
    
         
            -
             
     | 
| 
       154 
     | 
    
         
            -
             
     | 
| 
       155 
     | 
    
         
            -
             
     | 
| 
       156 
     | 
    
         
            -
             
     | 
| 
       157 
     | 
    
         
            -
             
     | 
| 
       158 
     | 
    
         
            -
             
     | 
| 
       159 
     | 
    
         
            -
             
     | 
| 
       160 
     | 
    
         
            -
              end
         
     | 
| 
       161 
     | 
    
         
            -
             
     | 
| 
       162 
     | 
    
         
            -
              def test_error_domain_to_s
         
     | 
| 
       163 
     | 
    
         
            -
             
     | 
| 
       164 
     | 
    
         
            -
             
     | 
| 
       165 
     | 
    
         
            -
             
     | 
| 
       166 
     | 
    
         
            -
             
     | 
| 
       167 
     | 
    
         
            -
             
     | 
| 
       168 
     | 
    
         
            -
             
     | 
| 
       169 
     | 
    
         
            -
              end
         
     | 
| 
       170 
     | 
    
         
            -
             
     | 
| 
       171 
     | 
    
         
            -
              def test_error_code_to_s
         
     | 
| 
       172 
     | 
    
         
            -
             
     | 
| 
       173 
     | 
    
         
            -
             
     | 
| 
       174 
     | 
    
         
            -
             
     | 
| 
       175 
     | 
    
         
            -
             
     | 
| 
       176 
     | 
    
         
            -
             
     | 
| 
       177 
     | 
    
         
            -
              end
         
     | 
| 
       178 
     | 
    
         
            -
             
     | 
| 
      
 148 
     | 
    
         
            +
              # def test_libxml_parser_empty_string
         
     | 
| 
      
 149 
     | 
    
         
            +
              #   xp = XML::Parser.new
         
     | 
| 
      
 150 
     | 
    
         
            +
              #
         
     | 
| 
      
 151 
     | 
    
         
            +
              #   error = assert_raises(TypeError) do
         
     | 
| 
      
 152 
     | 
    
         
            +
              #     xp.string = nil
         
     | 
| 
      
 153 
     | 
    
         
            +
              #   end
         
     | 
| 
      
 154 
     | 
    
         
            +
              #   assert_equal('wrong argument type nil (expected String)', error.to_s)
         
     | 
| 
      
 155 
     | 
    
         
            +
              #
         
     | 
| 
      
 156 
     | 
    
         
            +
              #   error = assert_raises(ArgumentError) do
         
     | 
| 
      
 157 
     | 
    
         
            +
              #     xp.string = ''
         
     | 
| 
      
 158 
     | 
    
         
            +
              #   end
         
     | 
| 
      
 159 
     | 
    
         
            +
              #   assert_equal('Must specify a string with one or more characters', error.to_s)
         
     | 
| 
      
 160 
     | 
    
         
            +
              # end
         
     | 
| 
      
 161 
     | 
    
         
            +
              #
         
     | 
| 
      
 162 
     | 
    
         
            +
              # def test_error_domain_to_s
         
     | 
| 
      
 163 
     | 
    
         
            +
              #   exception = assert_raises(XML::Error) do
         
     | 
| 
      
 164 
     | 
    
         
            +
              #     XML::Parser.string('<foo href="http://example.org/cgi?k1=v1&k2=v2"></foo>').parse
         
     | 
| 
      
 165 
     | 
    
         
            +
              #   end
         
     | 
| 
      
 166 
     | 
    
         
            +
              #
         
     | 
| 
      
 167 
     | 
    
         
            +
              #   assert_equal(XML::Error::PARSER, exception.domain)
         
     | 
| 
      
 168 
     | 
    
         
            +
              #   assert_equal("PARSER",exception.domain_to_s)
         
     | 
| 
      
 169 
     | 
    
         
            +
              # end
         
     | 
| 
      
 170 
     | 
    
         
            +
              #
         
     | 
| 
      
 171 
     | 
    
         
            +
              # def test_error_code_to_s
         
     | 
| 
      
 172 
     | 
    
         
            +
              #   exception = assert_raises(XML::Error) do
         
     | 
| 
      
 173 
     | 
    
         
            +
              #     XML::Parser.string('<foo href="http://example.org/cgi?k1=v1&k2=v2"></foo>').parse
         
     | 
| 
      
 174 
     | 
    
         
            +
              #   end
         
     | 
| 
      
 175 
     | 
    
         
            +
              #   assert_equal(XML::Error::ENTITYREF_SEMICOL_MISSING, exception.code)
         
     | 
| 
      
 176 
     | 
    
         
            +
              #   assert_equal("ENTITYREF_SEMICOL_MISSING",exception.code_to_s)
         
     | 
| 
      
 177 
     | 
    
         
            +
              # end
         
     | 
| 
       179 
178 
     | 
    
         
             
            end
         
     | 
    
        data/test/tc_node.rb
    CHANGED
    
    | 
         @@ -71,7 +71,7 @@ class TestNode < Minitest::Test 
     | 
|
| 
       71 
71 
     | 
    
         
             
                  assert_instance_of(XML::Document, n.doc) if n.document?
         
     | 
| 
       72 
72 
     | 
    
         
             
                end
         
     | 
| 
       73 
73 
     | 
    
         
             
              end
         
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
       75 
75 
     | 
    
         
             
              def test_name
         
     | 
| 
       76 
76 
     | 
    
         
             
                node = @doc.root.children.last
         
     | 
| 
       77 
77 
     | 
    
         
             
                assert_equal("iron_maiden", node.name)
         
     | 
| 
         @@ -84,23 +84,39 @@ class TestNode < Minitest::Test 
     | 
|
| 
       84 
84 
     | 
    
         
             
                end
         
     | 
| 
       85 
85 
     | 
    
         
             
              end
         
     | 
| 
       86 
86 
     | 
    
         | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
      
 87 
     | 
    
         
            +
               def test_equality
         
     | 
| 
       88 
88 
     | 
    
         
             
                node_a = @doc.find_first('*[@country]')
         
     | 
| 
       89 
89 
     | 
    
         
             
                node_b = @doc.root.child
         
     | 
| 
       90 
90 
     | 
    
         | 
| 
      
 91 
     | 
    
         
            +
                # On the ruby side these are different objects
         
     | 
| 
      
 92 
     | 
    
         
            +
                refute(node_a.equal?(node_b))
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
                # But they are the same underlying libxml node so specify they are equal
         
     | 
| 
       91 
95 
     | 
    
         
             
                assert(node_a == node_b)
         
     | 
| 
       92 
96 
     | 
    
         
             
                assert(node_a.eql?(node_b))
         
     | 
| 
       93 
     | 
    
         
            -
                assert(node_a.equal?(node_b))
         
     | 
| 
       94 
97 
     | 
    
         | 
| 
       95 
98 
     | 
    
         
             
                file = File.join(File.dirname(__FILE__), @file_name)
         
     | 
| 
       96 
99 
     | 
    
         
             
                doc2 = XML::Document.file(file)
         
     | 
| 
       97 
100 
     | 
    
         | 
| 
       98 
101 
     | 
    
         
             
                node_a2 = doc2.find_first('*[@country]')
         
     | 
| 
       99 
102 
     | 
    
         | 
| 
      
 103 
     | 
    
         
            +
                refute(node_a == node_a2)
         
     | 
| 
      
 104 
     | 
    
         
            +
                refute(node_a.eql?(node_a2))
         
     | 
| 
       100 
105 
     | 
    
         
             
                assert_equal(node_a.to_s, node_a2.to_s)
         
     | 
| 
       101 
     | 
    
         
            -
                 
     | 
| 
       102 
     | 
    
         
            -
             
     | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
      
 106 
     | 
    
         
            +
                refute(node_a.equal?(node_a2))
         
     | 
| 
      
 107 
     | 
    
         
            +
              end
         
     | 
| 
      
 108 
     | 
    
         
            +
             
     | 
| 
      
 109 
     | 
    
         
            +
              def test_equality_2
         
     | 
| 
      
 110 
     | 
    
         
            +
                parent = XML::Node.new('parent')
         
     | 
| 
      
 111 
     | 
    
         
            +
                child = XML::Node.new('child')
         
     | 
| 
      
 112 
     | 
    
         
            +
                parent << child
         
     | 
| 
      
 113 
     | 
    
         
            +
             
     | 
| 
      
 114 
     | 
    
         
            +
                node_a = child.parent
         
     | 
| 
      
 115 
     | 
    
         
            +
                node_b = child.parent
         
     | 
| 
      
 116 
     | 
    
         
            +
                # In this case the nodes are equal - the parent being the root
         
     | 
| 
      
 117 
     | 
    
         
            +
                assert(node_a.equal?(node_b))
         
     | 
| 
      
 118 
     | 
    
         
            +
                assert(node_a == node_b)
         
     | 
| 
      
 119 
     | 
    
         
            +
                assert(node_a.eql?(node_b))
         
     | 
| 
       104 
120 
     | 
    
         
             
              end
         
     | 
| 
       105 
121 
     | 
    
         | 
| 
       106 
122 
     | 
    
         
             
              def test_equality_nil
         
     | 
| 
         @@ -127,14 +143,14 @@ class TestNode < Minitest::Test 
     | 
|
| 
       127 
143 
     | 
    
         
             
                assert_nil(doc.root.base_uri)
         
     | 
| 
       128 
144 
     | 
    
         
             
              end
         
     | 
| 
       129 
145 
     | 
    
         | 
| 
       130 
     | 
    
         
            -
             
     | 
| 
       131 
     | 
    
         
            -
             
     | 
| 
       132 
     | 
    
         
            -
             
     | 
| 
       133 
     | 
    
         
            -
             
     | 
| 
       134 
     | 
    
         
            -
             
     | 
| 
       135 
     | 
    
         
            -
             
     | 
| 
       136 
     | 
    
         
            -
             
     | 
| 
       137 
     | 
    
         
            -
             
     | 
| 
      
 146 
     | 
    
         
            +
              # We use the same facility that libXSLT does here to disable output escaping.
         
     | 
| 
      
 147 
     | 
    
         
            +
              # This lets you specify that the node's content should be rendered unaltered
         
     | 
| 
      
 148 
     | 
    
         
            +
              # whenever it is being output.  This is useful for things like <script> and
         
     | 
| 
      
 149 
     | 
    
         
            +
              # <style> nodes in HTML documents if you don't want to be forced to wrap them
         
     | 
| 
      
 150 
     | 
    
         
            +
              # in CDATA nodes.  Or if you are sanitizing existing HTML documents and want
         
     | 
| 
      
 151 
     | 
    
         
            +
              # to preserve the content of any of the text nodes.
         
     | 
| 
      
 152 
     | 
    
         
            +
              #
         
     | 
| 
      
 153 
     | 
    
         
            +
              def test_output_escaping
         
     | 
| 
       138 
154 
     | 
    
         
             
            		text = '<bad-script>if (a < b || b > c) { return "text"; }<stop/>return ">>>snip<<<";</bad-script>'
         
     | 
| 
       139 
155 
     | 
    
         
             
                node = XML::Parser.string(text).parse.root
         
     | 
| 
       140 
156 
     | 
    
         
             
            		assert_equal text, node.to_s
         
     | 
| 
         @@ -153,8 +169,8 @@ class TestNode < Minitest::Test 
     | 
|
| 
       153 
169 
     | 
    
         
             
            		assert_equal text, node.to_s
         
     | 
| 
       154 
170 
     | 
    
         
             
              end
         
     | 
| 
       155 
171 
     | 
    
         | 
| 
       156 
     | 
    
         
            -
             
     | 
| 
       157 
     | 
    
         
            -
             
     | 
| 
      
 172 
     | 
    
         
            +
              # Just a sanity check for output escaping.
         
     | 
| 
      
 173 
     | 
    
         
            +
              def test_output_escaping_sanity
         
     | 
| 
       158 
174 
     | 
    
         
             
            		text = '<bad-script>if (a < b || b > c) { return "text"; }<stop/>return ">>>snip<<<";</bad-script>'
         
     | 
| 
       159 
175 
     | 
    
         
             
                node = XML::Parser.string(text).parse.root
         
     | 
| 
       160 
176 
     | 
    
         
             
            		affected = node.find('//text()')
         
     | 
| 
         @@ -201,7 +217,7 @@ class TestNode < Minitest::Test 
     | 
|
| 
       201 
217 
     | 
    
         | 
| 
       202 
218 
     | 
    
         
             
                node = doc.root
         
     | 
| 
       203 
219 
     | 
    
         
             
                assert(!node.empty?)
         
     | 
| 
       204 
     | 
    
         
            -
             
     | 
| 
      
 220 
     | 
    
         
            +
             
     | 
| 
       205 
221 
     | 
    
         
             
                text_node = node.first
         
     | 
| 
       206 
222 
     | 
    
         
             
                assert(text_node.empty?)
         
     | 
| 
       207 
223 
     | 
    
         
             
              end
         
     |