libxml-ruby 3.2.3 → 3.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY +5 -0
  3. data/ext/libxml/extconf.h +3 -0
  4. data/ext/libxml/ruby_libxml.h +0 -22
  5. data/ext/libxml/ruby_xml.c +2 -0
  6. data/ext/libxml/ruby_xml_document.c +6 -0
  7. data/ext/libxml/ruby_xml_encoding.h +2 -0
  8. data/ext/libxml/ruby_xml_error.h +2 -0
  9. data/ext/libxml/ruby_xml_html_parser.c +2 -0
  10. data/ext/libxml/ruby_xml_html_parser_context.c +1 -0
  11. data/ext/libxml/ruby_xml_html_parser_options.c +2 -0
  12. data/ext/libxml/ruby_xml_node.c +4 -0
  13. data/ext/libxml/ruby_xml_parser_context.c +2 -0
  14. data/ext/libxml/ruby_xml_reader.c +3 -0
  15. data/ext/libxml/ruby_xml_reader.h +0 -3
  16. data/ext/libxml/ruby_xml_relaxng.c +2 -0
  17. data/ext/libxml/ruby_xml_relaxng.h +0 -2
  18. data/ext/libxml/ruby_xml_schema.c +72 -2
  19. data/ext/libxml/ruby_xml_schema.h +4 -785
  20. data/ext/libxml/ruby_xml_schema_attribute.c +46 -0
  21. data/ext/libxml/ruby_xml_schema_attribute.h +25 -3
  22. data/ext/libxml/ruby_xml_schema_element.h +0 -3
  23. data/ext/libxml/ruby_xml_schema_facet.c +4 -0
  24. data/ext/libxml/ruby_xml_schema_facet.h +0 -4
  25. data/ext/libxml/ruby_xml_schema_type.c +37 -0
  26. data/ext/libxml/ruby_xml_version.h +3 -3
  27. data/ext/libxml/ruby_xml_writer.c +4 -0
  28. data/ext/libxml/ruby_xml_writer.h +0 -4
  29. data/ext/libxml/ruby_xml_xinclude.c +4 -0
  30. data/ext/libxml/ruby_xml_xpath.c +1 -0
  31. data/ext/libxml/ruby_xml_xpath.h +2 -0
  32. data/ext/libxml/ruby_xml_xpath_context.c +2 -0
  33. data/ext/libxml/ruby_xml_xpath_object.c +1 -0
  34. data/ext/libxml/ruby_xml_xpointer.c +5 -1
  35. data/lib/libxml-ruby.rb +1 -1
  36. data/test/test_helper.rb +4 -0
  37. data/test/test_xml.rb +15 -3
  38. metadata +4 -3
@@ -2,6 +2,52 @@
2
2
  #include "ruby_xml_schema_attribute.h"
3
3
  #include "ruby_xml_schema_type.h"
4
4
 
5
+ /**
6
+ * xmlSchemaBasicItem:
7
+ *
8
+ * The abstract base type for schema components.
9
+ */
10
+ typedef struct _xmlSchemaBasicItem xmlSchemaBasicItem;
11
+ typedef xmlSchemaBasicItem *xmlSchemaBasicItemPtr;
12
+ struct _xmlSchemaBasicItem {
13
+ xmlSchemaTypeType type;
14
+ };
15
+
16
+ /**
17
+ * xmlSchemaQNameRef:
18
+ *
19
+ * A component reference item (not a schema component)
20
+ * (Extends xmlSchemaBasicItem)
21
+ */
22
+ typedef struct _xmlSchemaQNameRef xmlSchemaQNameRef;
23
+ typedef xmlSchemaQNameRef *xmlSchemaQNameRefPtr;
24
+ struct _xmlSchemaQNameRef {
25
+ xmlSchemaTypeType type;
26
+ xmlSchemaBasicItemPtr item;
27
+ /* The resolved referenced item. */
28
+ xmlSchemaTypeType itemType;
29
+ const xmlChar *name;
30
+ const xmlChar *targetNamespace;
31
+ xmlNodePtr node;
32
+ };
33
+
34
+ /**
35
+ * xmlSchemaAttributeUseProhibPtr:
36
+ *
37
+ * A helper component to reflect attribute prohibitions.
38
+ * (Extends xmlSchemaBasicItem)
39
+ */
40
+ typedef struct _xmlSchemaAttributeUseProhib xmlSchemaAttributeUseProhib;
41
+ typedef xmlSchemaAttributeUseProhib *xmlSchemaAttributeUseProhibPtr;
42
+ struct _xmlSchemaAttributeUseProhib {
43
+ xmlSchemaTypeType type;
44
+ /* == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB */
45
+ xmlNodePtr node;
46
+ const xmlChar *name;
47
+ const xmlChar *targetNamespace;
48
+ int isRef;
49
+ };
50
+
5
51
  VALUE cXMLSchemaAttribute;
6
52
 
7
53
  static void rxml_schema_attribute_free(xmlSchemaAttributeUsePtr attr)
@@ -2,12 +2,34 @@
2
2
  #define __RXML_SCHEMA_ATTRIBUTE__
3
3
 
4
4
  #include "ruby_xml_schema.h"
5
- #include <libxml/schemasInternals.h>
6
- #include <libxml/xmlschemas.h>
7
- #include <libxml/xmlschemastypes.h>
8
5
 
9
6
  extern VALUE cXMLSchemaAttribute;
10
7
 
8
+ /**
9
+ * xmlSchemaAttributeUsePtr:
10
+ *
11
+ * The abstract base type for tree-like structured schema components.
12
+ * (Extends xmlSchemaTreeItem)
13
+ */
14
+ typedef struct _xmlSchemaAttributeUse xmlSchemaAttributeUse;
15
+ typedef xmlSchemaAttributeUse *xmlSchemaAttributeUsePtr;
16
+ struct _xmlSchemaAttributeUse {
17
+ xmlSchemaTypeType type;
18
+ xmlSchemaAnnotPtr annot;
19
+ xmlSchemaAttributeUsePtr next; /* The next attr. use. */
20
+ /*
21
+ * The attr. decl. OR a QName-ref. to an attr. decl. OR
22
+ * a QName-ref. to an attribute group definition.
23
+ */
24
+ xmlSchemaAttributePtr attrDecl;
25
+
26
+ int flags;
27
+ xmlNodePtr node;
28
+ int occurs;
29
+ /* required, optional */
30
+ const xmlChar *defValue;
31
+ xmlSchemaValPtr defVal;
32
+ };
11
33
 
12
34
  void rxml_init_schema_attribute(void);
13
35
  VALUE rxml_wrap_schema_attribute(xmlSchemaAttributeUsePtr attr);
@@ -2,9 +2,6 @@
2
2
  #define __RXML_SCHEMA_ELEMENT__
3
3
 
4
4
  #include "ruby_xml_schema.h"
5
- #include <libxml/schemasInternals.h>
6
- #include <libxml/xmlschemas.h>
7
- #include <libxml/xmlschemastypes.h>
8
5
 
9
6
  extern VALUE cXMLSchemaElement;
10
7
 
@@ -1,6 +1,10 @@
1
1
  #include "ruby_libxml.h"
2
2
  #include "ruby_xml_schema_facet.h"
3
3
 
4
+ #include <libxml/schemasInternals.h>
5
+ #include <libxml/xmlschemas.h>
6
+ #include <libxml/xmlschemastypes.h>
7
+
4
8
  VALUE cXMLSchemaFacet;
5
9
 
6
10
  static void rxml_schema_facet_free(xmlSchemaFacetPtr xschema_type)
@@ -1,10 +1,6 @@
1
1
  #ifndef __RXML_SCHEMA_FACET__
2
2
  #define __RXML_SCHEMA_FACET__
3
3
 
4
- #include <libxml/schemasInternals.h>
5
- #include <libxml/xmlschemas.h>
6
- #include <libxml/xmlschemastypes.h>
7
-
8
4
  extern VALUE cXMLSchemaFacet;
9
5
 
10
6
  VALUE rxml_wrap_schema_facet(xmlSchemaFacetPtr facet);
@@ -7,6 +7,43 @@
7
7
  #define UNBOUNDED 1 << 30
8
8
  #define FREE_AND_NULL(str) if ((str) != NULL) { xmlFree((xmlChar *) (str)); str = NULL; }
9
9
 
10
+ /**
11
+ * xmlSchemaTreeItem:
12
+ *
13
+ * The abstract base type for tree-like structured schema components.
14
+ * (Extends xmlSchemaAnnotItem)
15
+ */
16
+ typedef struct _xmlSchemaTreeItem xmlSchemaTreeItem;
17
+ typedef xmlSchemaTreeItem *xmlSchemaTreeItemPtr;
18
+ struct _xmlSchemaTreeItem {
19
+ xmlSchemaTypeType type;
20
+ xmlSchemaAnnotPtr annot;
21
+ xmlSchemaTreeItemPtr next;
22
+ xmlSchemaTreeItemPtr children;
23
+ };
24
+
25
+ /**
26
+ * xmlSchemaParticle:
27
+ *
28
+ * A particle component.
29
+ * (Extends xmlSchemaTreeItem)
30
+ */
31
+ typedef struct _xmlSchemaParticle xmlSchemaParticle;
32
+ typedef xmlSchemaParticle *xmlSchemaParticlePtr;
33
+ struct _xmlSchemaParticle {
34
+ xmlSchemaTypeType type;
35
+ xmlSchemaAnnotPtr annot;
36
+ xmlSchemaTreeItemPtr next;
37
+ /* next particle */
38
+ xmlSchemaTreeItemPtr children;
39
+ /* the "term" (e.g. a model group,
40
+ a group definition, a XML_SCHEMA_EXTRA_QNAMEREF (if a reference),
41
+ etc.) */
42
+ int minOccurs;
43
+ int maxOccurs;
44
+ xmlNodePtr node;
45
+ };
46
+
10
47
  VALUE cXMLSchemaType;
11
48
 
12
49
  static void rxml_schema_type_free(xmlSchemaTypePtr xschema_type)
@@ -1,9 +1,9 @@
1
1
  /* Don't nuke this block! It is used for automatically updating the
2
2
  * versions below. VERSION = string formatting, VERNUM = numbered
3
3
  * version for inline testing: increment both or none at all.*/
4
- #define RUBY_LIBXML_VERSION "3.2.3"
5
- #define RUBY_LIBXML_VERNUM 323
4
+ #define RUBY_LIBXML_VERSION "3.2.4"
5
+ #define RUBY_LIBXML_VERNUM 324
6
6
  #define RUBY_LIBXML_VER_MAJ 3
7
7
  #define RUBY_LIBXML_VER_MIN 2
8
- #define RUBY_LIBXML_VER_MIC 3
8
+ #define RUBY_LIBXML_VER_MIC 4
9
9
  #define RUBY_LIBXML_VER_PATCH 0
@@ -1,6 +1,10 @@
1
1
  #include "ruby_libxml.h"
2
2
  #include "ruby_xml_writer.h"
3
3
 
4
+ #ifdef LIBXML_WRITER_ENABLED
5
+ #include <libxml/xmlwriter.h>
6
+ #endif
7
+
4
8
  VALUE cXMLWriter;
5
9
  static VALUE sEncoding, sStandalone;
6
10
 
@@ -1,10 +1,6 @@
1
1
  #ifndef __RXML_WRITER__
2
2
  #define __RXML_WRITER__
3
3
 
4
- #ifdef LIBXML_WRITER_ENABLED
5
- #include <libxml/xmlwriter.h>
6
- #endif
7
-
8
4
  extern VALUE cXMLWriter;
9
5
  void rxml_init_writer(void);
10
6
  #endif
@@ -1,6 +1,10 @@
1
1
  #include "ruby_libxml.h"
2
2
  #include "ruby_xml_xinclude.h"
3
3
 
4
+ #ifdef LIBXML_XINCLUDE_ENABLED
5
+ #include <libxml/xinclude.h>
6
+ #endif
7
+
4
8
  VALUE cXMLXInclude;
5
9
 
6
10
  /*
@@ -75,6 +75,7 @@
75
75
  */
76
76
 
77
77
  #include "ruby_libxml.h"
78
+ #include <libxml/xpathInternals.h>
78
79
 
79
80
  VALUE mXPath;
80
81
 
@@ -3,6 +3,8 @@
3
3
  #ifndef __RXML_XPATH__
4
4
  #define __RXML_XPATH__
5
5
 
6
+ #include <libxml/xpath.h>
7
+
6
8
  extern VALUE mXPath;
7
9
 
8
10
  void rxml_init_xpath(void);
@@ -10,6 +10,8 @@
10
10
  #include <st.h>
11
11
  #endif
12
12
 
13
+ #include <libxml/xpathInternals.h>
14
+
13
15
  /*
14
16
  * Document-class: LibXML::XML::XPath::Context
15
17
  *
@@ -1,4 +1,5 @@
1
1
  #include "ruby_libxml.h"
2
+ #include <libxml/xpathInternals.h>
2
3
 
3
4
  /*
4
5
  * Document-class: LibXML::XML::XPath::Object
@@ -3,6 +3,10 @@
3
3
  #include "ruby_libxml.h"
4
4
  #include "ruby_xml_xpointer.h"
5
5
 
6
+ #ifdef LIBXML_XPTR_ENABLED
7
+ #include <libxml/xpointer.h>
8
+ #endif
9
+
6
10
  VALUE cXMLXPointer;
7
11
 
8
12
  /*
@@ -62,7 +66,7 @@ VALUE rxml_xpointer_point2(VALUE node, VALUE xptr_str)
62
66
  */
63
67
  static VALUE rxml_xpointer_range(VALUE class, VALUE rstart, VALUE rend)
64
68
  {
65
- #ifdef LIBXML_XPTR_ENABLED
69
+ #if defined LIBXML_XPTR_ENABLED && defined LIBXML_XPTR_LOCS_ENABLED
66
70
  xmlNodePtr start, end;
67
71
  VALUE rxxp;
68
72
  xmlXPathObjectPtr xpath;
data/lib/libxml-ruby.rb CHANGED
@@ -4,7 +4,7 @@
4
4
  begin
5
5
  RUBY_VERSION =~ /(\d+.\d+)/
6
6
  require "#{$1}/libxml_ruby"
7
- rescue LoadError
7
+ rescue LoadError => e
8
8
  require "libxml_ruby"
9
9
  end
10
10
 
data/test/test_helper.rb CHANGED
@@ -6,4 +6,8 @@ require 'bundler/setup'
6
6
  require 'minitest/autorun'
7
7
  require 'libxml-ruby'
8
8
 
9
+ def windows?
10
+ !(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/).nil?
11
+ end
12
+
9
13
  STDOUT.write "\nlibxml2: #{LibXML::XML::LIBXML_VERSION}\n#{RUBY_DESCRIPTION}\n\n"
data/test/test_xml.rb CHANGED
@@ -167,11 +167,19 @@ class TestXml < Minitest::Test
167
167
  end
168
168
 
169
169
  def test_enabled_docbook
170
- assert(LibXML::XML.enabled_docbook?)
170
+ if windows?
171
+ refute(LibXML::XML.enabled_docbook?)
172
+ else
173
+ assert(LibXML::XML.enabled_docbook?)
174
+ end
171
175
  end
172
176
 
173
177
  def test_enabled_ftp
174
- assert(LibXML::XML.enabled_ftp?)
178
+ if windows?
179
+ refute(LibXML::XML.enabled_ftp?)
180
+ else
181
+ assert(LibXML::XML.enabled_ftp?)
182
+ end
175
183
  end
176
184
 
177
185
  def test_enabled_http
@@ -242,7 +250,11 @@ class TestXml < Minitest::Test
242
250
  end
243
251
 
244
252
  def test_libxml_parser_features
245
- assert_instance_of(Array, LibXML::XML.features)
253
+ if windows?
254
+ assert_nil(LibXML::XML.features)
255
+ else
256
+ assert_instance_of(Array, LibXML::XML.features)
257
+ end
246
258
  end
247
259
 
248
260
  def test_default_options
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libxml-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.3
4
+ version: 3.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ross Bamform
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2022-05-22 00:00:00.000000000 Z
17
+ date: 2022-10-29 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: rake-compiler
@@ -61,6 +61,7 @@ files:
61
61
  - MANIFEST
62
62
  - README.rdoc
63
63
  - Rakefile
64
+ - ext/libxml/extconf.h
64
65
  - ext/libxml/extconf.rb
65
66
  - ext/libxml/libxml.c
66
67
  - ext/libxml/libxml_ruby.def
@@ -279,7 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
279
280
  - !ruby/object:Gem::Version
280
281
  version: '0'
281
282
  requirements: []
282
- rubygems_version: 3.3.4
283
+ rubygems_version: 3.3.14
283
284
  signing_key:
284
285
  specification_version: 4
285
286
  summary: Ruby Bindings for LibXML2