libxml-ruby 5.0.6 → 6.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.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/{HISTORY → CHANGELOG.md} +875 -930
  3. data/LICENSE +20 -20
  4. data/README.md +67 -0
  5. data/Rakefile +13 -34
  6. data/ext/libxml/extconf.rb +34 -20
  7. data/ext/libxml/libxml.c +2 -14
  8. data/ext/libxml/ruby_libxml.h +1 -1
  9. data/ext/libxml/ruby_xml_attr.c +27 -22
  10. data/ext/libxml/ruby_xml_attr.h +1 -0
  11. data/ext/libxml/ruby_xml_attr_decl.c +19 -12
  12. data/ext/libxml/ruby_xml_attributes.c +18 -9
  13. data/ext/libxml/ruby_xml_document.c +111 -98
  14. data/ext/libxml/ruby_xml_document.h +1 -0
  15. data/ext/libxml/ruby_xml_dtd.c +49 -19
  16. data/ext/libxml/ruby_xml_dtd.h +1 -0
  17. data/ext/libxml/ruby_xml_html_parser.c +1 -1
  18. data/ext/libxml/ruby_xml_html_parser_context.c +19 -6
  19. data/ext/libxml/ruby_xml_html_parser_context.h +1 -0
  20. data/ext/libxml/ruby_xml_input_cbg.c +45 -17
  21. data/ext/libxml/ruby_xml_io.c +3 -1
  22. data/ext/libxml/ruby_xml_namespace.c +20 -12
  23. data/ext/libxml/ruby_xml_namespace.h +1 -0
  24. data/ext/libxml/ruby_xml_namespaces.c +40 -20
  25. data/ext/libxml/ruby_xml_node.c +71 -32
  26. data/ext/libxml/ruby_xml_node.h +2 -0
  27. data/ext/libxml/ruby_xml_parser.c +1 -1
  28. data/ext/libxml/ruby_xml_parser_context.c +54 -47
  29. data/ext/libxml/ruby_xml_parser_context.h +1 -0
  30. data/ext/libxml/ruby_xml_reader.c +25 -15
  31. data/ext/libxml/ruby_xml_registry.c +31 -0
  32. data/ext/libxml/ruby_xml_registry.h +22 -0
  33. data/ext/libxml/ruby_xml_relaxng.c +21 -5
  34. data/ext/libxml/ruby_xml_relaxng.h +1 -0
  35. data/ext/libxml/ruby_xml_sax_parser.c +1 -1
  36. data/ext/libxml/ruby_xml_schema.c +18 -11
  37. data/ext/libxml/ruby_xml_schema.h +1 -0
  38. data/ext/libxml/ruby_xml_schema_attribute.c +7 -7
  39. data/ext/libxml/ruby_xml_schema_element.c +8 -8
  40. data/ext/libxml/ruby_xml_schema_facet.c +7 -7
  41. data/ext/libxml/ruby_xml_schema_type.c +12 -19
  42. data/ext/libxml/ruby_xml_version.h +4 -4
  43. data/ext/libxml/ruby_xml_writer.c +18 -6
  44. data/ext/libxml/ruby_xml_xpath.c +2 -2
  45. data/ext/libxml/ruby_xml_xpath.h +1 -1
  46. data/ext/libxml/ruby_xml_xpath_context.c +72 -26
  47. data/ext/libxml/ruby_xml_xpath_expression.c +11 -5
  48. data/ext/libxml/ruby_xml_xpath_expression.h +1 -0
  49. data/ext/libxml/ruby_xml_xpath_object.c +69 -54
  50. data/ext/libxml/ruby_xml_xpath_object.h +3 -1
  51. data/ext/vc/libxml_ruby/libxml_ruby.vcxproj +271 -0
  52. data/ext/xcode/libxml-ruby.xcodeproj/project.pbxproj +633 -0
  53. data/ext/xcode/libxml-ruby.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  54. data/ext/xcode/libxml-ruby.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  55. data/ext/xcode/libxml-ruby.xcodeproj/xcshareddata/xcschemes/libxml-ruby.xcscheme +80 -0
  56. data/lib/libxml/document.rb +0 -29
  57. data/lib/libxml/error.rb +30 -3
  58. data/lib/libxml/html_parser.rb +0 -16
  59. data/lib/libxml/node.rb +1 -3
  60. data/lib/libxml/parser.rb +0 -8
  61. data/lib/libxml/schema/attribute.rb +27 -19
  62. data/lib/libxml/schema/element.rb +20 -0
  63. data/lib/libxml/schema/type.rb +44 -21
  64. data/lib/libxml/schema.rb +47 -47
  65. data/lib/libxml-ruby.rb +30 -30
  66. data/libxml-ruby.gemspec +12 -16
  67. data/test/c14n/result/1-1-without-comments/example-1 +3 -3
  68. data/test/c14n/result/1-1-without-comments/example-2 +10 -10
  69. data/test/c14n/result/1-1-without-comments/example-3 +13 -13
  70. data/test/c14n/result/1-1-without-comments/example-4 +8 -8
  71. data/test/c14n/result/1-1-without-comments/example-5 +2 -2
  72. data/test/c14n/result/with-comments/example-1 +5 -5
  73. data/test/c14n/result/with-comments/example-2 +10 -10
  74. data/test/c14n/result/with-comments/example-3 +13 -13
  75. data/test/c14n/result/with-comments/example-4 +8 -8
  76. data/test/c14n/result/with-comments/example-5 +3 -3
  77. data/test/c14n/result/without-comments/example-1 +3 -3
  78. data/test/c14n/result/without-comments/example-2 +10 -10
  79. data/test/c14n/result/without-comments/example-3 +13 -13
  80. data/test/c14n/result/without-comments/example-4 +8 -8
  81. data/test/c14n/result/without-comments/example-5 +2 -2
  82. data/test/test_attr.rb +179 -180
  83. data/test/test_attr_decl.rb +131 -131
  84. data/test/test_attributes.rb +135 -135
  85. data/test/test_canonicalize.rb +122 -120
  86. data/test/test_document.rb +2 -4
  87. data/test/test_dtd.rb +12 -4
  88. data/test/test_encoding_sax.rb +114 -114
  89. data/test/test_error.rb +1 -1
  90. data/test/test_html_parser.rb +6 -2
  91. data/test/test_html_parser_context.rb +22 -22
  92. data/test/test_input_callbacks.rb +36 -0
  93. data/test/test_namespace.rb +1 -1
  94. data/test/test_namespaces.rb +200 -200
  95. data/test/test_node.rb +16 -0
  96. data/test/test_node_cdata.rb +50 -50
  97. data/test/test_node_comment.rb +32 -32
  98. data/test/test_node_copy.rb +40 -40
  99. data/test/test_node_edit.rb +176 -158
  100. data/test/test_node_pi.rb +37 -37
  101. data/test/test_node_text.rb +69 -69
  102. data/test/test_node_xlink.rb +28 -28
  103. data/test/test_parser.rb +5 -41
  104. data/test/test_parser_context.rb +198 -198
  105. data/test/test_properties.rb +38 -38
  106. data/test/test_reader.rb +55 -6
  107. data/test/test_relaxng.rb +59 -53
  108. data/test/test_sax_parser.rb +345 -345
  109. data/test/test_schema.rb +28 -0
  110. data/test/test_traversal.rb +152 -152
  111. data/test/test_writer.rb +0 -31
  112. data/test/test_xinclude.rb +20 -20
  113. data/test/test_xml.rb +3 -7
  114. data/test/test_xpath.rb +244 -244
  115. data/test/test_xpath_context.rb +87 -87
  116. data/test/test_xpath_expression.rb +37 -37
  117. metadata +32 -25
  118. data/README.rdoc +0 -208
  119. data/ext/libxml/extconf.h +0 -4
  120. data/ext/libxml/ruby_xml_cbg.c +0 -85
  121. data/lib/libxml/hpricot.rb +0 -78
  122. data/lib/libxml.rb +0 -5
  123. data/lib/xml/libxml.rb +0 -10
  124. data/lib/xml.rb +0 -14
  125. data/script/benchmark/depixelate +0 -634
  126. data/script/benchmark/hamlet.xml +0 -9055
  127. data/script/benchmark/parsecount +0 -170
  128. data/script/benchmark/sock_entries.xml +0 -507
  129. data/script/benchmark/throughput +0 -41
  130. data/script/test +0 -6
  131. data/test/test_deprecated_require.rb +0 -12
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ <FileRef
5
+ location = "self:">
6
+ </FileRef>
7
+ </Workspace>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>IDEDidComputeMac32BitWarning</key>
6
+ <true/>
7
+ </dict>
8
+ </plist>
@@ -0,0 +1,80 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Scheme
3
+ LastUpgradeVersion = "1530"
4
+ version = "1.7">
5
+ <BuildAction
6
+ parallelizeBuildables = "YES"
7
+ buildImplicitDependencies = "YES">
8
+ <BuildActionEntries>
9
+ <BuildActionEntry
10
+ buildForTesting = "YES"
11
+ buildForRunning = "YES"
12
+ buildForProfiling = "YES"
13
+ buildForArchiving = "YES"
14
+ buildForAnalyzing = "YES">
15
+ <BuildableReference
16
+ BuildableIdentifier = "primary"
17
+ BlueprintIdentifier = "C7F2B59A2B4B608E004E0A86"
18
+ BuildableName = "libxml_ruby.bundle"
19
+ BlueprintName = "libxml_ruby"
20
+ ReferencedContainer = "container:libxml-ruby.xcodeproj">
21
+ </BuildableReference>
22
+ </BuildActionEntry>
23
+ </BuildActionEntries>
24
+ </BuildAction>
25
+ <TestAction
26
+ buildConfiguration = "Debug"
27
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29
+ shouldUseLaunchSchemeArgsEnv = "YES"
30
+ shouldAutocreateTestPlan = "YES">
31
+ </TestAction>
32
+ <LaunchAction
33
+ buildConfiguration = "Debug"
34
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
35
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
36
+ launchStyle = "0"
37
+ useCustomWorkingDirectory = "NO"
38
+ ignoresPersistentStateOnLaunch = "NO"
39
+ debugDocumentVersioning = "YES"
40
+ debugServiceExtension = "internal"
41
+ allowLocationSimulation = "YES">
42
+ <PathRunnable
43
+ runnableDebuggingMode = "0"
44
+ FilePath = "/usr/local/Cellar/ruby/3.2.2_1/bin/ruby">
45
+ </PathRunnable>
46
+ <CommandLineArguments>
47
+ <CommandLineArgument
48
+ argument = "/usr/local/src/libxml-ruby/test/test_attr.rb"
49
+ isEnabled = "YES">
50
+ </CommandLineArgument>
51
+ </CommandLineArguments>
52
+ <LocationScenarioReference
53
+ identifier = "com.apple.dt.IDEFoundation.CurrentLocationScenarioIdentifier"
54
+ referenceType = "1">
55
+ </LocationScenarioReference>
56
+ </LaunchAction>
57
+ <ProfileAction
58
+ buildConfiguration = "Release"
59
+ shouldUseLaunchSchemeArgsEnv = "YES"
60
+ savedToolIdentifier = ""
61
+ useCustomWorkingDirectory = "NO"
62
+ debugDocumentVersioning = "YES">
63
+ <MacroExpansion>
64
+ <BuildableReference
65
+ BuildableIdentifier = "primary"
66
+ BlueprintIdentifier = "C7F2B59A2B4B608E004E0A86"
67
+ BuildableName = "libxml_ruby.bundle"
68
+ BlueprintName = "libxml_ruby"
69
+ ReferencedContainer = "container:libxml-ruby.xcodeproj">
70
+ </BuildableReference>
71
+ </MacroExpansion>
72
+ </ProfileAction>
73
+ <AnalyzeAction
74
+ buildConfiguration = "Debug">
75
+ </AnalyzeAction>
76
+ <ArchiveAction
77
+ buildConfiguration = "Release"
78
+ revealArchiveInOrganizer = "YES">
79
+ </ArchiveAction>
80
+ </Scheme>
@@ -160,35 +160,6 @@ module LibXML
160
160
  node_type == XML::Node::HTML_DOCUMENT_NODE
161
161
  end
162
162
 
163
- def dump
164
- warn('Document#dump is deprecated. Use Document#to_s instead.')
165
- self.to_s
166
- end
167
-
168
- def format_dump
169
- warn('Document#format_dump is deprecated. Use Document#to_s instead.')
170
- self.to_s
171
- end
172
-
173
- def debug_dump
174
- warn('Document#debug_dump is deprecated. Use Document#debug instead.')
175
- self.debug
176
- end
177
-
178
- def debug_dump_head
179
- warn('Document#debug_dump_head is deprecated. Use Document#debug instead.')
180
- self.debug
181
- end
182
-
183
- def debug_format_dump
184
- warn('Document#debug_format_dump is deprecated. Use Document#to_s instead.')
185
- self.to_s
186
- end
187
-
188
- def reader
189
- warn('Document#reader is deprecated. Use XML::Reader.document(self) instead.')
190
- XML::Reader.document(self)
191
- end
192
163
  end
193
164
  end
194
165
  end
data/lib/libxml/error.rb CHANGED
@@ -23,7 +23,7 @@ module LibXML
23
23
  map[const_get(code)] = code
24
24
  end
25
25
  end
26
-
26
+
27
27
  # Verbose error handler
28
28
  VERBOSE_HANDLER = lambda do |error|
29
29
  STDERR << error.to_s << "\n"
@@ -33,11 +33,20 @@ module LibXML
33
33
  # Quiet error handler
34
34
  QUIET_HANDLER = lambda do |error|
35
35
  end
36
-
36
+
37
+ # call-seq:
38
+ # error == other -> true or false
39
+ #
40
+ # Returns whether two errors have the same attributes.
37
41
  def ==(other)
38
42
  eql?(other)
39
43
  end
40
-
44
+
45
+ # call-seq:
46
+ # error.eql?(other) -> true or false
47
+ #
48
+ # Returns whether two errors have identical code, domain, message,
49
+ # level, file, line, and all other attributes.
41
50
  def eql?(other)
42
51
  self.code == other.code and
43
52
  self.domain == other.domain and
@@ -56,6 +65,11 @@ module LibXML
56
65
  false
57
66
  end
58
67
 
68
+ # call-seq:
69
+ # error.level_to_s -> String
70
+ #
71
+ # Returns a human-readable string for the error level:
72
+ # "Warning:", "Error:", "Fatal error:", or "".
59
73
  def level_to_s
60
74
  case self.level
61
75
  when NONE
@@ -69,14 +83,27 @@ module LibXML
69
83
  end
70
84
  end
71
85
 
86
+ # call-seq:
87
+ # error.domain_to_s -> String
88
+ #
89
+ # Returns the name of the error domain (e.g. "PARSER", "XPATH").
72
90
  def domain_to_s
73
91
  DOMAIN_CODE_MAP[self.domain].to_s
74
92
  end
75
93
 
94
+ # call-seq:
95
+ # error.code_to_s -> String
96
+ #
97
+ # Returns the name of the error code constant.
76
98
  def code_to_s
77
99
  ERROR_CODE_MAP[self.code].to_s
78
100
  end
79
101
 
102
+ # call-seq:
103
+ # error.to_s -> String
104
+ #
105
+ # Returns a formatted error string including the level, message,
106
+ # and file/line when available.
80
107
  def to_s
81
108
  msg = super
82
109
  msg = msg ? msg.strip: ''
@@ -75,22 +75,6 @@ module LibXML
75
75
  self.new(context)
76
76
  end
77
77
 
78
- # :enddoc:
79
-
80
- def file=(value)
81
- warn("XML::HTMLParser#file is deprecated. Use XML::HTMLParser.file instead")
82
- @context = XML::HTMLParser::Context.file(value)
83
- end
84
-
85
- def io=(value)
86
- warn("XML::HTMLParser#io is deprecated. Use XML::HTMLParser.io instead")
87
- @context = XML::HTMLParser::Context.io(value)
88
- end
89
-
90
- def string=(value)
91
- warn("XML::HTMLParser#string is deprecated. Use XML::HTMLParser.string instead")
92
- @context = XML::HTMLParser::Context.string(value)
93
- end
94
78
  end
95
79
  end
96
80
  end
data/lib/libxml/node.rb CHANGED
@@ -313,9 +313,7 @@ module LibXML
313
313
 
314
314
  def create_string_io(xml)
315
315
  result = StringIO.new("")
316
- if defined?(::Encoding)
317
- result.set_encoding(xml.encoding)
318
- end
316
+ result.set_encoding(xml.encoding)
319
317
  result
320
318
  end
321
319
  end
data/lib/libxml/parser.rb CHANGED
@@ -90,14 +90,6 @@ module LibXML
90
90
  self.new(context)
91
91
  end
92
92
 
93
- def self.register_error_handler(proc)
94
- warn('Parser.register_error_handler is deprecated. Use Error.set_handler instead')
95
- if proc.nil?
96
- Error.reset_handler
97
- else
98
- Error.set_handler(&proc)
99
- end
100
- end
101
93
  end
102
94
  end
103
95
  end
@@ -1,19 +1,27 @@
1
- # encoding: UTF-8
2
-
3
- module LibXML
4
- module XML
5
- class Schema::Attribute
6
- REQUIRED = 1
7
- OPTIONAL = 2
8
-
9
- def default
10
- node['default']
11
- end
12
-
13
- def required?
14
- occurs == REQUIRED
15
- end
16
-
17
- end
18
- end
19
- end
1
+ # encoding: UTF-8
2
+
3
+ module LibXML
4
+ module XML
5
+ class Schema::Attribute
6
+ REQUIRED = 1
7
+ OPTIONAL = 2
8
+
9
+ # call-seq:
10
+ # attribute.default -> String or nil
11
+ #
12
+ # Returns the default value for this attribute, or nil if none.
13
+ def default
14
+ node['default']
15
+ end
16
+
17
+ # call-seq:
18
+ # attribute.required? -> true or false
19
+ #
20
+ # Returns whether this attribute is required.
21
+ def required?
22
+ occurs == REQUIRED
23
+ end
24
+
25
+ end
26
+ end
27
+ end
@@ -3,22 +3,42 @@
3
3
  module LibXML
4
4
  module XML
5
5
  class Schema::Element
6
+ # call-seq:
7
+ # element.min_occurs -> Integer
8
+ #
9
+ # Returns the minimum number of times this element must appear.
6
10
  def min_occurs
7
11
  @min
8
12
  end
9
13
 
14
+ # call-seq:
15
+ # element.max_occurs -> Integer
16
+ #
17
+ # Returns the maximum number of times this element may appear.
10
18
  def max_occurs
11
19
  @max
12
20
  end
13
21
 
22
+ # call-seq:
23
+ # element.required? -> true or false
24
+ #
25
+ # Returns whether this element is required (min_occurs > 0).
14
26
  def required?
15
27
  !min_occurs.zero?
16
28
  end
17
29
 
30
+ # call-seq:
31
+ # element.array? -> true or false
32
+ #
33
+ # Returns whether this element can appear more than once (max_occurs > 1).
18
34
  def array?
19
35
  max_occurs > 1
20
36
  end
21
37
 
38
+ # call-seq:
39
+ # element.elements -> Hash
40
+ #
41
+ # Returns the child elements of this element's type.
22
42
  def elements
23
43
  type.elements
24
44
  end
@@ -1,21 +1,44 @@
1
- module LibXML
2
- module XML
3
- class Schema::Type
4
- def kind_name
5
- Schema::Types.constants.find { |k| Schema::Types.const_get(k) == kind }
6
- end
7
-
8
- def annonymus_subtypes
9
- elements.select { |_, e| e.type.name.nil? }
10
- end
11
-
12
- def annonymus_subtypes_recursively(parent=nil)
13
- annonymus_subtypes.map do |element_name, e|
14
- [{[parent, element_name].compact.join('::') => e.type},
15
- e.type.annonymus_subtypes_recursively(element_name)]
16
- end.flatten
17
- end
18
-
19
- end
20
- end
21
- end
1
+ module LibXML
2
+ module XML
3
+ class Schema::Type
4
+ # call-seq:
5
+ # type.kind_name -> String
6
+ #
7
+ # Returns the name of the constant that matches this type's +kind+ value.
8
+ #
9
+ # schema.types['shiporderType'].kind_name
10
+ # # => :XML_SCHEMA_TYPE_COMPLEX
11
+ def kind_name
12
+ Schema::Types.constants.find { |k| Schema::Types.const_get(k) == kind }
13
+ end
14
+
15
+ # call-seq:
16
+ # type.anonymous_subtypes -> Hash
17
+ #
18
+ # Returns a Hash of child elements whose types are anonymous
19
+ # (inline complex types with no global name).
20
+ #
21
+ # type.anonymous_subtypes
22
+ # # => {"shipto" => #<Schema::Element>, "item" => #<Schema::Element>}
23
+ def anonymous_subtypes
24
+ elements.select { |_, e| e.type.name.nil? }
25
+ end
26
+
27
+ # call-seq:
28
+ # type.anonymous_subtypes_recursively -> Array
29
+ #
30
+ # Returns a flattened Array of Hashes mapping qualified names to
31
+ # anonymous Schema::Type instances, descending into nested types.
32
+ #
33
+ # type.anonymous_subtypes_recursively
34
+ # # => [{"shipto" => #<Schema::Type>}, {"item" => #<Schema::Type>}]
35
+ def anonymous_subtypes_recursively(parent=nil)
36
+ anonymous_subtypes.map do |element_name, e|
37
+ [{[parent, element_name].compact.join('::') => e.type},
38
+ e.type.anonymous_subtypes_recursively(element_name)]
39
+ end.flatten
40
+ end
41
+
42
+ end
43
+ end
44
+ end
data/lib/libxml/schema.rb CHANGED
@@ -1,48 +1,48 @@
1
- module LibXML
2
- module XML
3
- class Schema
4
- module Types
5
- XML_SCHEMA_TYPE_BASIC = 1 # A built-in datatype
6
- XML_SCHEMA_TYPE_ANY = 2
7
- XML_SCHEMA_TYPE_FACET = 3
8
- XML_SCHEMA_TYPE_SIMPLE = 4
9
- XML_SCHEMA_TYPE_COMPLEX = 5
10
- XML_SCHEMA_TYPE_SEQUENCE = 6
11
- XML_SCHEMA_TYPE_CHOICE = 7
12
- XML_SCHEMA_TYPE_ALL = 8
13
- XML_SCHEMA_TYPE_SIMPLE_CONTENT = 9
14
- XML_SCHEMA_TYPE_COMPLEX_CONTENT = 10
15
- XML_SCHEMA_TYPE_UR = 11
16
- XML_SCHEMA_TYPE_RESTRICTION = 12
17
- XML_SCHEMA_TYPE_EXTENSION = 13
18
- XML_SCHEMA_TYPE_ELEMENT = 14
19
- XML_SCHEMA_TYPE_ATTRIBUTE = 15
20
- XML_SCHEMA_TYPE_ATTRIBUTEGROUP = 16
21
- XML_SCHEMA_TYPE_GROUP = 17
22
- XML_SCHEMA_TYPE_NOTATION = 18
23
- XML_SCHEMA_TYPE_LIST = 19
24
- XML_SCHEMA_TYPE_UNION = 20
25
- XML_SCHEMA_TYPE_ANY_ATTRIBUTE = 21
26
- XML_SCHEMA_TYPE_IDC_UNIQUE = 22
27
- XML_SCHEMA_TYPE_IDC_KEY = 23
28
- XML_SCHEMA_TYPE_IDC_KEYREF = 24
29
- XML_SCHEMA_TYPE_PARTICLE = 25
30
- XML_SCHEMA_TYPE_ATTRIBUTE_USE = 26
31
- XML_SCHEMA_FACET_MININCLUSIVE = 1000
32
- XML_SCHEMA_FACET_MINEXCLUSIVE = 1001
33
- XML_SCHEMA_FACET_MAXINCLUSIVE = 1002
34
- XML_SCHEMA_FACET_MAXEXCLUSIVE = 1003
35
- XML_SCHEMA_FACET_TOTALDIGITS = 1004
36
- XML_SCHEMA_FACET_FRACTIONDIGITS = 1005
37
- XML_SCHEMA_FACET_PATTERN = 1006
38
- XML_SCHEMA_FACET_ENUMERATION = 1007
39
- XML_SCHEMA_FACET_WHITESPACE = 1008
40
- XML_SCHEMA_FACET_LENGTH = 1009
41
- XML_SCHEMA_FACET_MAXLENGTH = 1010
42
- XML_SCHEMA_FACET_MINLENGTH = 1011
43
- XML_SCHEMA_EXTRA_QNAMEREF = 2000
44
- XML_SCHEMA_EXTRA_ATTR_USE_PROHIB = 2001
45
- end
46
- end
47
- end
1
+ module LibXML
2
+ module XML
3
+ class Schema
4
+ module Types
5
+ XML_SCHEMA_TYPE_BASIC = 1 # A built-in datatype
6
+ XML_SCHEMA_TYPE_ANY = 2
7
+ XML_SCHEMA_TYPE_FACET = 3
8
+ XML_SCHEMA_TYPE_SIMPLE = 4
9
+ XML_SCHEMA_TYPE_COMPLEX = 5
10
+ XML_SCHEMA_TYPE_SEQUENCE = 6
11
+ XML_SCHEMA_TYPE_CHOICE = 7
12
+ XML_SCHEMA_TYPE_ALL = 8
13
+ XML_SCHEMA_TYPE_SIMPLE_CONTENT = 9
14
+ XML_SCHEMA_TYPE_COMPLEX_CONTENT = 10
15
+ XML_SCHEMA_TYPE_UR = 11
16
+ XML_SCHEMA_TYPE_RESTRICTION = 12
17
+ XML_SCHEMA_TYPE_EXTENSION = 13
18
+ XML_SCHEMA_TYPE_ELEMENT = 14
19
+ XML_SCHEMA_TYPE_ATTRIBUTE = 15
20
+ XML_SCHEMA_TYPE_ATTRIBUTEGROUP = 16
21
+ XML_SCHEMA_TYPE_GROUP = 17
22
+ XML_SCHEMA_TYPE_NOTATION = 18
23
+ XML_SCHEMA_TYPE_LIST = 19
24
+ XML_SCHEMA_TYPE_UNION = 20
25
+ XML_SCHEMA_TYPE_ANY_ATTRIBUTE = 21
26
+ XML_SCHEMA_TYPE_IDC_UNIQUE = 22
27
+ XML_SCHEMA_TYPE_IDC_KEY = 23
28
+ XML_SCHEMA_TYPE_IDC_KEYREF = 24
29
+ XML_SCHEMA_TYPE_PARTICLE = 25
30
+ XML_SCHEMA_TYPE_ATTRIBUTE_USE = 26
31
+ XML_SCHEMA_FACET_MININCLUSIVE = 1000
32
+ XML_SCHEMA_FACET_MINEXCLUSIVE = 1001
33
+ XML_SCHEMA_FACET_MAXINCLUSIVE = 1002
34
+ XML_SCHEMA_FACET_MAXEXCLUSIVE = 1003
35
+ XML_SCHEMA_FACET_TOTALDIGITS = 1004
36
+ XML_SCHEMA_FACET_FRACTIONDIGITS = 1005
37
+ XML_SCHEMA_FACET_PATTERN = 1006
38
+ XML_SCHEMA_FACET_ENUMERATION = 1007
39
+ XML_SCHEMA_FACET_WHITESPACE = 1008
40
+ XML_SCHEMA_FACET_LENGTH = 1009
41
+ XML_SCHEMA_FACET_MAXLENGTH = 1010
42
+ XML_SCHEMA_FACET_MINLENGTH = 1011
43
+ XML_SCHEMA_EXTRA_QNAMEREF = 2000
44
+ XML_SCHEMA_EXTRA_ATTR_USE_PROHIB = 2001
45
+ end
46
+ end
47
+ end
48
48
  end
data/lib/libxml-ruby.rb CHANGED
@@ -1,30 +1,30 @@
1
- # encoding: UTF-8
2
-
3
- # Load the C-based binding.
4
- begin
5
- RUBY_VERSION =~ /(\d+.\d+)/
6
- require_relative "#{$1}/libxml_ruby"
7
- rescue LoadError
8
- require_relative "libxml_ruby"
9
- end
10
-
11
- # Load Ruby supporting code.
12
- require 'libxml/error'
13
- require 'libxml/parser'
14
- require 'libxml/document'
15
- require 'libxml/namespaces'
16
- require 'libxml/namespace'
17
- require 'libxml/node'
18
- require 'libxml/attributes'
19
- require 'libxml/attr'
20
- require 'libxml/attr_decl'
21
- require 'libxml/tree'
22
- require 'libxml/html_parser'
23
- require 'libxml/sax_parser'
24
- require 'libxml/sax_callbacks'
25
-
26
- #Schema Interface
27
- require 'libxml/schema'
28
- require 'libxml/schema/type'
29
- require 'libxml/schema/element'
30
- require 'libxml/schema/attribute'
1
+ # encoding: UTF-8
2
+
3
+ # Load the C-based binding.
4
+ begin
5
+ RUBY_VERSION =~ /(\d+.\d+)/
6
+ require "#{$1}/libxml_ruby"
7
+ rescue LoadError
8
+ require "libxml_ruby"
9
+ end
10
+
11
+ # Load Ruby supporting code.
12
+ require 'libxml/error'
13
+ require 'libxml/parser'
14
+ require 'libxml/document'
15
+ require 'libxml/namespaces'
16
+ require 'libxml/namespace'
17
+ require 'libxml/node'
18
+ require 'libxml/attributes'
19
+ require 'libxml/attr'
20
+ require 'libxml/attr_decl'
21
+ require 'libxml/tree'
22
+ require 'libxml/html_parser'
23
+ require 'libxml/sax_parser'
24
+ require 'libxml/sax_callbacks'
25
+
26
+ #Schema Interface
27
+ require 'libxml/schema'
28
+ require 'libxml/schema/type'
29
+ require 'libxml/schema/element'
30
+ require 'libxml/schema/attribute'
data/libxml-ruby.gemspec CHANGED
@@ -1,5 +1,4 @@
1
1
  # encoding: utf-8
2
- require 'date'
3
2
 
4
3
  # Determine the current version of the software
5
4
  version = File.read('ext/libxml/ruby_xml_version.h').match(/\s*RUBY_LIBXML_VERSION\s*['"](\d.+)['"]/)[1]
@@ -10,11 +9,9 @@ Gem::Specification.new do |spec|
10
9
  spec.homepage = 'https://xml4r.github.io/libxml-ruby/'
11
10
  spec.summary = 'Ruby Bindings for LibXML2'
12
11
  spec.description = <<-EOS
13
- The Libxml-Ruby project provides Ruby language bindings for the GNOME
14
- Libxml2 XML toolkit. It is free software, released under the MIT License.
15
- Libxml-ruby's primary advantage over REXML is performance - if speed
16
- is your need, these are good libraries to consider, as demonstrated
17
- by the informal benchmark below.
12
+ libxml-Ruby provides Ruby language bindings for libxml2 It is free software,
13
+ released under the MIT License. libxml-ruby provides DOM, SAX, Reader, and
14
+ Writer APIs along with XPath support and validation via DTD, RelaxNG, and XML Schema.
18
15
  EOS
19
16
  spec.authors = ['Ross Bamform', 'Wai-Sun Chia', 'Sean Chittenden',
20
17
  'Dan Janwoski', 'Anurag Priyam', 'Charlie Savage',
@@ -23,28 +20,27 @@ Gem::Specification.new do |spec|
23
20
  spec.bindir = 'bin'
24
21
  spec.extensions = ['ext/libxml/extconf.rb']
25
22
  spec.metadata = {'documentation_uri' => 'https://xml4r.github.io/libxml-ruby/'}
26
- spec.files = Dir.glob(['HISTORY',
23
+ spec.files = Dir.glob(['CHANGELOG.md',
27
24
  'LICENSE',
28
25
  'libxml-ruby.gemspec',
29
- 'MANIFEST',
30
26
  'Rakefile',
31
- 'README.rdoc',
32
- 'setup.rb',
27
+ 'README.md',
33
28
  'ext/libxml/*.def',
34
29
  'ext/libxml/*.h',
35
30
  'ext/libxml/*.c',
36
31
  'ext/libxml/*.rb',
37
- 'ext/vc/*.sln',
38
- 'ext/vc/*.vcprojx',
32
+ 'ext/vc/**/*.sln',
33
+ 'ext/vc/**/*.vcxproj',
34
+ 'ext/xcode/**/*',
39
35
  'lib/**/*.rb',
40
- 'script/**/*',
41
- 'test/**/*'])
36
+ 'test/**/*']) -
37
+ Dir.glob(['ext/libxml/extconf.h'])
42
38
 
43
39
  spec.test_files = Dir.glob('test/test_*.rb')
44
- spec.required_ruby_version = '>= 2.5'
45
- spec.date = DateTime.now
40
+ spec.required_ruby_version = '>= 3.2'
46
41
  spec.add_development_dependency('logger')
47
42
  spec.add_development_dependency('rake-compiler')
48
43
  spec.add_development_dependency('minitest')
44
+ spec.add_development_dependency('rdoc')
49
45
  spec.license = 'MIT'
50
46
  end
@@ -1,4 +1,4 @@
1
- <?xml-stylesheet href="doc.xsl"
2
- type="text/xsl" ?>
3
- <doc>Hello, world!</doc>
1
+ <?xml-stylesheet href="doc.xsl"
2
+ type="text/xsl" ?>
3
+ <doc>Hello, world!</doc>
4
4
  <?pi-without-data?>
@@ -1,11 +1,11 @@
1
- <doc>
2
- <clean> </clean>
3
- <dirty> A B </dirty>
4
- <mixed>
5
- A
6
- <clean> </clean>
7
- B
8
- <dirty> A B </dirty>
9
- C
10
- </mixed>
1
+ <doc>
2
+ <clean> </clean>
3
+ <dirty> A B </dirty>
4
+ <mixed>
5
+ A
6
+ <clean> </clean>
7
+ B
8
+ <dirty> A B </dirty>
9
+ C
10
+ </mixed>
11
11
  </doc>