Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37745406
en ru br
Репозитории ALT

Группа :: Разработка/Ruby
Пакет: gem-libxml-ruby

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: gem-libxml-ruby-3.2.3-alt2.patch
Скачать


 ext/libxml/ruby_libxml.h                  |  22 -
 ext/libxml/ruby_xml.c                     |   2 +
 ext/libxml/ruby_xml_document.c            |   6 +
 ext/libxml/ruby_xml_encoding.h            |   2 +
 ext/libxml/ruby_xml_error.h               |   2 +
 ext/libxml/ruby_xml_html_parser.c         |   2 +
 ext/libxml/ruby_xml_html_parser_context.c |   1 +
 ext/libxml/ruby_xml_html_parser_options.c |   2 +
 ext/libxml/ruby_xml_node.c                |   4 +
 ext/libxml/ruby_xml_parser_context.c      |   2 +
 ext/libxml/ruby_xml_reader.c              |   3 +
 ext/libxml/ruby_xml_reader.h              |   3 -
 ext/libxml/ruby_xml_relaxng.c             |   2 +
 ext/libxml/ruby_xml_relaxng.h             |   2 -
 ext/libxml/ruby_xml_schema.c              |  74 ++-
 ext/libxml/ruby_xml_schema.h              | 789 +-----------------------------
 ext/libxml/ruby_xml_schema_attribute.c    |  46 ++
 ext/libxml/ruby_xml_schema_attribute.h    |  28 +-
 ext/libxml/ruby_xml_schema_element.h      |   3 -
 ext/libxml/ruby_xml_schema_facet.c        |   4 +
 ext/libxml/ruby_xml_schema_facet.h        |   4 -
 ext/libxml/ruby_xml_schema_type.c         |  37 ++
 ext/libxml/ruby_xml_writer.c              |   4 +
 ext/libxml/ruby_xml_writer.h              |   4 -
 ext/libxml/ruby_xml_xinclude.c            |   4 +
 ext/libxml/ruby_xml_xpath.c               |   1 +
 ext/libxml/ruby_xml_xpath.h               |   2 +
 ext/libxml/ruby_xml_xpath_context.c       |   2 +
 ext/libxml/ruby_xml_xpath_object.c        |   1 +
 ext/libxml/ruby_xml_xpointer.c            |   6 +-
 lib/libxml-ruby.rb                        |   2 +-
 test/test_helper.rb                       |   4 +
 test/test_xml.rb                          |  18 +-
 33 files changed, 255 insertions(+), 833 deletions(-)
diff --git a/ext/libxml/ruby_libxml.h b/ext/libxml/ruby_libxml.h
index a66b722..891f746 100644
--- a/ext/libxml/ruby_libxml.h
+++ b/ext/libxml/ruby_libxml.h
@@ -4,29 +4,7 @@
 #define __RUBY_LIBXML_H__
 
 #include <ruby.h>
-#include <libxml/parser.h>
-#include <libxml/parserInternals.h>
-#include <libxml/debugXML.h>
 #include <libxml/xmlversion.h>
-#include <libxml/xmlmemory.h>
-#include <libxml/xpath.h>
-#include <libxml/valid.h>
-#include <libxml/catalog.h>
-#include <libxml/HTMLparser.h>
-#include <libxml/xmlreader.h>
-#include <libxml/c14n.h>
-
-#include <ruby/encoding.h>
-
-#ifdef LIBXML_DEBUG_ENABLED
-#include <libxml/xpathInternals.h>
-#endif
-#ifdef LIBXML_XINCLUDE_ENABLED
-#include <libxml/xinclude.h>
-#endif
-#ifdef LIBXML_XPTR_ENABLED
-#include <libxml/xpointer.h>
-#endif
 
 #include "ruby_xml_version.h"
 #include "ruby_xml.h"
diff --git a/ext/libxml/ruby_xml.c b/ext/libxml/ruby_xml.c
index a3bd312..25ff94c 100644
--- a/ext/libxml/ruby_xml.c
+++ b/ext/libxml/ruby_xml.c
@@ -1,6 +1,8 @@
 #include "ruby_libxml.h"
 #include "ruby_xml.h"
 
+#include <libxml/catalog.h>
+
 VALUE mXML;
 
 /*
diff --git a/ext/libxml/ruby_xml_document.c b/ext/libxml/ruby_xml_document.c
index 0dce1c1..e372761 100644
--- a/ext/libxml/ruby_xml_document.c
+++ b/ext/libxml/ruby_xml_document.c
@@ -52,6 +52,12 @@
 #include "ruby_libxml.h"
 #include "ruby_xml_document.h"
 
+#include <libxml/c14n.h>
+#include <libxml/debugXML.h>
+#include <libxml/relaxng.h>
+#include <libxml/xmlschemas.h>
+#include <libxml/xinclude.h>
+
 VALUE cXMLDocument;
 
 void rxml_document_free(xmlDocPtr xdoc)
diff --git a/ext/libxml/ruby_xml_encoding.h b/ext/libxml/ruby_xml_encoding.h
index e0d89b4..3055e37 100644
--- a/ext/libxml/ruby_xml_encoding.h
+++ b/ext/libxml/ruby_xml_encoding.h
@@ -3,6 +3,8 @@
 #ifndef __RXML_ENCODING__
 #define __RXML_ENCODING__
 
+#include <ruby/encoding.h>
+
 extern VALUE mXMLEncoding;
 
 void rxml_init_encoding();
diff --git a/ext/libxml/ruby_xml_error.h b/ext/libxml/ruby_xml_error.h
index ed276c8..b86bec3 100644
--- a/ext/libxml/ruby_xml_error.h
+++ b/ext/libxml/ruby_xml_error.h
@@ -3,6 +3,8 @@
 #ifndef __RXML_ERROR__
 #define __RXML_ERROR__
 
+#include <libxml/xmlerror.h>
+
 extern VALUE eXMLError;
 
 void rxml_init_error();
diff --git a/ext/libxml/ruby_xml_html_parser.c b/ext/libxml/ruby_xml_html_parser.c
index 8f7cc0f..eb44d6d 100644
--- a/ext/libxml/ruby_xml_html_parser.c
+++ b/ext/libxml/ruby_xml_html_parser.c
@@ -2,6 +2,8 @@
 
 #include "ruby_libxml.h"
 
+#include <libxml/HTMLparser.h>
+
 /* Document-class: LibXML::XML::HTMLParser
  *
  * The HTML parser implements an HTML 4.0 non-verifying parser with an API
diff --git a/ext/libxml/ruby_xml_html_parser_context.c b/ext/libxml/ruby_xml_html_parser_context.c
index 4161d4c..53c2525 100644
--- a/ext/libxml/ruby_xml_html_parser_context.c
+++ b/ext/libxml/ruby_xml_html_parser_context.c
@@ -3,6 +3,7 @@
 #include "ruby_libxml.h"
 #include "ruby_xml_html_parser_context.h"
 
+#include <libxml/parserInternals.h>
 
 /*
  * Document-class: LibXML::XML::HTMLParser::Context
diff --git a/ext/libxml/ruby_xml_html_parser_options.c b/ext/libxml/ruby_xml_html_parser_options.c
index a068f4a..7d18b40 100644
--- a/ext/libxml/ruby_xml_html_parser_options.c
+++ b/ext/libxml/ruby_xml_html_parser_options.c
@@ -2,6 +2,8 @@
 
 #include "ruby_libxml.h"
 
+#include <libxml/HTMLparser.h>
+
 /* Document-class: LibXML::XML::HTMLParser::Options
  *
  * Options to control the operation of the HTMLParser.  The easiest
diff --git a/ext/libxml/ruby_xml_node.c b/ext/libxml/ruby_xml_node.c
index 4211fb6..2fdea63 100644
--- a/ext/libxml/ruby_xml_node.c
+++ b/ext/libxml/ruby_xml_node.c
@@ -2,6 +2,10 @@
 #include "ruby_xml_node.h"
 #include <assert.h>
 
+#include <libxml/debugXML.h>
+#include <libxml/parserInternals.h>
+#include <libxml/xlink.h>
+
 VALUE cXMLNode;
 
 /* Document-class: LibXML::XML::Node
diff --git a/ext/libxml/ruby_xml_parser_context.c b/ext/libxml/ruby_xml_parser_context.c
index e9f7a04..a30818a 100644
--- a/ext/libxml/ruby_xml_parser_context.c
+++ b/ext/libxml/ruby_xml_parser_context.c
@@ -3,6 +3,8 @@
 #include "ruby_libxml.h"
 #include "ruby_xml_parser_context.h"
 
+#include <libxml/parserInternals.h>
+
 VALUE cXMLParserContext;
 static ID IO_ATTR;
 
diff --git a/ext/libxml/ruby_xml_reader.c b/ext/libxml/ruby_xml_reader.c
index 3fcdecc..924efa7 100644
--- a/ext/libxml/ruby_xml_reader.c
+++ b/ext/libxml/ruby_xml_reader.c
@@ -4,6 +4,9 @@
 #include "ruby_libxml.h"
 #include "ruby_xml_reader.h"
 
+#include <libxml/xmlreader.h>
+#include <libxml/xmlschemas.h>
+
 /*
  * Document-class: LibXML::XML::Reader
  *
diff --git a/ext/libxml/ruby_xml_reader.h b/ext/libxml/ruby_xml_reader.h
index b7c2707..451bd23 100644
--- a/ext/libxml/ruby_xml_reader.h
+++ b/ext/libxml/ruby_xml_reader.h
@@ -4,9 +4,6 @@
 #ifndef __RXML_READER__
 #define __RXML_READER__
 
-#include <libxml/xmlreader.h>
-#include <libxml/xmlschemas.h>
-
 extern VALUE cXMLReader;
 
 void rxml_init_reader(void);
diff --git a/ext/libxml/ruby_xml_relaxng.c b/ext/libxml/ruby_xml_relaxng.c
index 053df40..395e403 100644
--- a/ext/libxml/ruby_xml_relaxng.c
+++ b/ext/libxml/ruby_xml_relaxng.c
@@ -1,6 +1,8 @@
 #include "ruby_libxml.h"
 #include "ruby_xml_relaxng.h"
 
+#include <libxml/relaxng.h>
+
 /*
  * Document-class: LibXML::XML::RelaxNG
  *
diff --git a/ext/libxml/ruby_xml_relaxng.h b/ext/libxml/ruby_xml_relaxng.h
index 47dc89f..f1542ae 100644
--- a/ext/libxml/ruby_xml_relaxng.h
+++ b/ext/libxml/ruby_xml_relaxng.h
@@ -1,8 +1,6 @@
 #ifndef __RXML_RELAXNG__
 #define __RXML_RELAXNG__
 
-#include <libxml/relaxng.h>
-
 extern VALUE cXMLRelaxNG;
 
 void  rxml_init_relaxng(void);
diff --git a/ext/libxml/ruby_xml_schema.c b/ext/libxml/ruby_xml_schema.c
index e56edba..5aad475 100644
--- a/ext/libxml/ruby_xml_schema.c
+++ b/ext/libxml/ruby_xml_schema.c
@@ -1,6 +1,4 @@
 #include "ruby_libxml.h"
-#define LIBXML_OUTPUT_ENABLED
-#define DUMP_CONTENT_MODEL
 #include "ruby_xml_schema.h"
 
 #include "ruby_xml_schema_type.h"
@@ -8,6 +6,78 @@
 #include "ruby_xml_schema_attribute.h"
 #include "ruby_xml_schema_facet.h"
 
+#include <libxml/xmlschemas.h>
+
+typedef struct _xmlSchemaBucket xmlSchemaBucket;
+typedef xmlSchemaBucket *xmlSchemaBucketPtr;
+
+/**
+ * xmlSchemaSchemaRelation:
+ *
+ * Used to create a graph of schema relationships.
+ */
+typedef struct _xmlSchemaSchemaRelation xmlSchemaSchemaRelation;
+typedef xmlSchemaSchemaRelation *xmlSchemaSchemaRelationPtr;
+struct _xmlSchemaSchemaRelation {
+    xmlSchemaSchemaRelationPtr next;
+    int type;
+    /* E.g. XML_SCHEMA_SCHEMA_IMPORT */
+    const xmlChar *importNamespace;
+    xmlSchemaBucketPtr bucket;
+};
+
+struct _xmlSchemaBucket {
+    int type;
+    int flags;
+    const xmlChar *schemaLocation;
+    const xmlChar *origTargetNamespace;
+    const xmlChar *targetNamespace;
+    xmlDocPtr doc;
+    xmlSchemaSchemaRelationPtr relations;
+    int located;
+    int parsed;
+    int imported;
+    int preserveDoc;
+    xmlSchemaItemListPtr globals;
+    /* Global components. */
+    xmlSchemaItemListPtr locals; /* Local components. */
+};
+
+/**
+ * xmlSchemaImport:
+ * (extends xmlSchemaBucket)
+ *
+ * Reflects a schema. Holds some information
+ * about the schema and its toplevel components. Duplicate
+ * toplevel components are not checked at this level.
+ */
+typedef struct _xmlSchemaImport xmlSchemaImport;
+typedef xmlSchemaImport *xmlSchemaImportPtr;
+struct _xmlSchemaImport {
+    int type;
+    /* Main OR import OR include. */
+    int flags;
+    const xmlChar *schemaLocation; /* The URI of the schema document. */
+    /* For chameleon includes, @origTargetNamespace will be NULL */
+    const xmlChar *origTargetNamespace;
+    /*
+    * For chameleon includes, @targetNamespace will be the
+    * targetNamespace of the including schema.
+    */
+    const xmlChar *targetNamespace;
+    xmlDocPtr doc; /* The schema node-tree. */
+    /* @relations will hold any included/imported/redefined schemas. */
+    xmlSchemaSchemaRelationPtr relations;
+    int located;
+    int parsed;
+    int imported;
+    int preserveDoc;
+    xmlSchemaItemListPtr globals;
+    xmlSchemaItemListPtr locals;
+    /* The imported schema. */
+    xmlSchemaPtr schema;
+};
+
 /*
  * Document-class: LibXML::XML::Schema
  *
diff --git a/ext/libxml/ruby_xml_schema.h b/ext/libxml/ruby_xml_schema.h
index ed6e53f..961d0e2 100644
--- a/ext/libxml/ruby_xml_schema.h
+++ b/ext/libxml/ruby_xml_schema.h
@@ -2,25 +2,8 @@
 #define __RXML_SCHEMA__
 
 #include <libxml/schemasInternals.h>
-#include <libxml/xmlschemas.h>
 #include <libxml/xmlschemastypes.h>
 
-extern VALUE cXMLSchema;
-
-void rxml_init_schema(void);
-
-#define QNIL_OR_STRING(slot) \
-    (slot == NULL) ? Qnil : rb_str_new2((const char *)slot)
-
-#define SUBSET_RESTRICTION  1<<0
-#define SUBSET_EXTENSION    1<<1
-#define SUBSET_SUBSTITUTION 1<<2
-#define SUBSET_LIST         1<<3
-#define SUBSET_UNION        1<<4
-
-typedef struct _xmlSchemaNodeInfo xmlSchemaNodeInfo;
-typedef xmlSchemaNodeInfo *xmlSchemaNodeInfoPtr;
-
 typedef struct _xmlSchemaItemList xmlSchemaItemList;
 typedef xmlSchemaItemList *xmlSchemaItemListPtr;
 struct _xmlSchemaItemList {
@@ -31,776 +14,12 @@ struct _xmlSchemaItemList {
     int sizeItems; /* used for dynamic addition of schemata */
 };
 
-#define XML_SCHEMA_CTXT_PARSER 1
-#define XML_SCHEMA_CTXT_VALIDATOR 2
-
-typedef struct _xmlSchemaAbstractCtxt xmlSchemaAbstractCtxt;
-typedef xmlSchemaAbstractCtxt *xmlSchemaAbstractCtxtPtr;
-struct _xmlSchemaAbstractCtxt {
-    int type; /* E.g. XML_SCHEMA_CTXT_VALIDATOR */
-};
-
-typedef struct _xmlSchemaBucket xmlSchemaBucket;
-typedef xmlSchemaBucket *xmlSchemaBucketPtr;
-
-#define XML_SCHEMA_SCHEMA_MAIN 0
-#define XML_SCHEMA_SCHEMA_IMPORT 1
-#define XML_SCHEMA_SCHEMA_INCLUDE 2
-#define XML_SCHEMA_SCHEMA_REDEFINE 3
-
-/**
- * xmlSchemaSchemaRelation:
- *
- * Used to create a graph of schema relationships.
- */
-typedef struct _xmlSchemaSchemaRelation xmlSchemaSchemaRelation;
-typedef xmlSchemaSchemaRelation *xmlSchemaSchemaRelationPtr;
-struct _xmlSchemaSchemaRelation {
-    xmlSchemaSchemaRelationPtr next;
-    int type;
-    /* E.g. XML_SCHEMA_SCHEMA_IMPORT */
-    const xmlChar *importNamespace;
-    xmlSchemaBucketPtr bucket;
-};
-
-#define XML_SCHEMA_BUCKET_MARKED 1<<0
-#define XML_SCHEMA_BUCKET_COMPS_ADDED 1<<1
-
-struct _xmlSchemaBucket {
-    int type;
-    int flags;
-    const xmlChar *schemaLocation;
-    const xmlChar *origTargetNamespace;
-    const xmlChar *targetNamespace;
-    xmlDocPtr doc;
-    xmlSchemaSchemaRelationPtr relations;
-    int located;
-    int parsed;
-    int imported;
-    int preserveDoc;
-    xmlSchemaItemListPtr globals;
-    /* Global components. */
-    xmlSchemaItemListPtr locals; /* Local components. */
-};
-
-/**
- * xmlSchemaImport:
- * (extends xmlSchemaBucket)
- *
- * Reflects a schema. Holds some information
- * about the schema and its toplevel components. Duplicate
- * toplevel components are not checked at this level.
- */
-typedef struct _xmlSchemaImport xmlSchemaImport;
-typedef xmlSchemaImport *xmlSchemaImportPtr;
-struct _xmlSchemaImport {
-    int type;
-    /* Main OR import OR include. */
-    int flags;
-    const xmlChar *schemaLocation; /* The URI of the schema document. */
-    /* For chameleon includes, @origTargetNamespace will be NULL */
-    const xmlChar *origTargetNamespace;
-    /*
-    * For chameleon includes, @targetNamespace will be the
-    * targetNamespace of the including schema.
-    */
-    const xmlChar *targetNamespace;
-    xmlDocPtr doc; /* The schema node-tree. */
-    /* @relations will hold any included/imported/redefined schemas. */
-    xmlSchemaSchemaRelationPtr relations;
-    int located;
-    int parsed;
-    int imported;
-    int preserveDoc;
-    xmlSchemaItemListPtr globals;
-    xmlSchemaItemListPtr locals;
-    /* The imported schema. */
-    xmlSchemaPtr schema;
-};
-
-/*
-* (extends xmlSchemaBucket)
-*/
-typedef struct _xmlSchemaInclude xmlSchemaInclude;
-typedef xmlSchemaInclude *xmlSchemaIncludePtr;
-struct _xmlSchemaInclude {
-    int type;
-    int flags;
-    const xmlChar *schemaLocation;
-    const xmlChar *origTargetNamespace;
-    const xmlChar *targetNamespace;
-    xmlDocPtr doc;
-    xmlSchemaSchemaRelationPtr relations;
-    int located;
-    int parsed;
-    int imported;
-    int preserveDoc;
-    xmlSchemaItemListPtr globals;
-    /* Global components. */
-    xmlSchemaItemListPtr locals; /* Local components. */
-
-    /* The owning main or import schema bucket. */
-    xmlSchemaImportPtr ownerImport;
-};
-
-/**
- * xmlSchemaBasicItem:
- *
- * The abstract base type for schema components.
- */
-typedef struct _xmlSchemaBasicItem xmlSchemaBasicItem;
-typedef xmlSchemaBasicItem *xmlSchemaBasicItemPtr;
-struct _xmlSchemaBasicItem {
-    xmlSchemaTypeType type;
-};
-
-/**
- * xmlSchemaAnnotItem:
- *
- * The abstract base type for annotated schema components.
- * (Extends xmlSchemaBasicItem)
- */
-typedef struct _xmlSchemaAnnotItem xmlSchemaAnnotItem;
-typedef xmlSchemaAnnotItem *xmlSchemaAnnotItemPtr;
-struct _xmlSchemaAnnotItem {
-    xmlSchemaTypeType type;
-    xmlSchemaAnnotPtr annot;
-};
-
-/**
- * xmlSchemaTreeItem:
- *
- * The abstract base type for tree-like structured schema components.
- * (Extends xmlSchemaAnnotItem)
- */
-typedef struct _xmlSchemaTreeItem xmlSchemaTreeItem;
-typedef xmlSchemaTreeItem *xmlSchemaTreeItemPtr;
-struct _xmlSchemaTreeItem {
-    xmlSchemaTypeType type;
-    xmlSchemaAnnotPtr annot;
-    xmlSchemaTreeItemPtr next;
-    xmlSchemaTreeItemPtr children;
-};
-
-
-#define XML_SCHEMA_ATTR_USE_FIXED 1<<0
-/**
- * xmlSchemaAttributeUsePtr:
- *
- * The abstract base type for tree-like structured schema components.
- * (Extends xmlSchemaTreeItem)
- */
-typedef struct _xmlSchemaAttributeUse xmlSchemaAttributeUse;
-typedef xmlSchemaAttributeUse *xmlSchemaAttributeUsePtr;
-struct _xmlSchemaAttributeUse {
-    xmlSchemaTypeType type;
-    xmlSchemaAnnotPtr annot;
-    xmlSchemaAttributeUsePtr next; /* The next attr. use. */
-    /*
-    * The attr. decl. OR a QName-ref. to an attr. decl. OR
-    * a QName-ref. to an attribute group definition.
-    */
-    xmlSchemaAttributePtr attrDecl;
-
-    int flags;
-    xmlNodePtr node;
-    int occurs;
-    /* required, optional */
-    const xmlChar *defValue;
-    xmlSchemaValPtr defVal;
-};
-
-/**
- * xmlSchemaAttributeUseProhibPtr:
- *
- * A helper component to reflect attribute prohibitions.
- * (Extends xmlSchemaBasicItem)
- */
-typedef struct _xmlSchemaAttributeUseProhib xmlSchemaAttributeUseProhib;
-typedef xmlSchemaAttributeUseProhib *xmlSchemaAttributeUseProhibPtr;
-struct _xmlSchemaAttributeUseProhib {
-    xmlSchemaTypeType type;
-    /* == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB */
-    xmlNodePtr node;
-    const xmlChar *name;
-    const xmlChar *targetNamespace;
-    int isRef;
-};
-
-/**
- * xmlSchemaRedef:
- */
-typedef struct _xmlSchemaRedef xmlSchemaRedef;
-typedef xmlSchemaRedef *xmlSchemaRedefPtr;
-struct _xmlSchemaRedef {
-    xmlSchemaRedefPtr next;
-    xmlSchemaBasicItemPtr item;
-    /* The redefining component. */
-    xmlSchemaBasicItemPtr reference;
-    /* The referencing component. */
-    xmlSchemaBasicItemPtr target;
-    /* The to-be-redefined component. */
-    const xmlChar *refName;
-    /* The name of the to-be-redefined component. */
-    const xmlChar *refTargetNs;
-    /* The target namespace of the
-  to-be-redefined comp. */
-    xmlSchemaBucketPtr targetBucket; /* The redefined schema. */
-};
-
-/**
- * xmlSchemaConstructionCtxt:
- */
-typedef struct _xmlSchemaConstructionCtxt xmlSchemaConstructionCtxt;
-typedef xmlSchemaConstructionCtxt *xmlSchemaConstructionCtxtPtr;
-struct _xmlSchemaConstructionCtxt {
-    xmlSchemaPtr mainSchema;
-    /* The main schema. */
-    xmlSchemaBucketPtr mainBucket;
-    /* The main schema bucket */
-    xmlDictPtr dict;
-    xmlSchemaItemListPtr buckets; /* List of schema buckets. */
-    /* xmlSchemaItemListPtr relations; */ /* List of schema relations. */
-xmlSchemaBucketPtr bucket;
-    /* The current schema bucket */
-    xmlSchemaItemListPtr pending;
-    /* All Components of all schemas that
-need to be fixed. */
-    xmlHashTablePtr substGroups;
-    xmlSchemaRedefPtr redefs;
-    xmlSchemaRedefPtr lastRedef;
-};
-
-#define XML_SCHEMAS_PARSE_ERROR        1
-#define SCHEMAS_PARSE_OPTIONS XML_PARSE_NOENT
-
-struct _xmlSchemaParserCtxt {
-    int type;
-    void *errCtxt;
-    /* user specific error context */
-    xmlSchemaValidityErrorFunc error;
-    /* the callback in case of errors */
-    xmlSchemaValidityWarningFunc warning;
-    /* the callback in case of warning */
-    int err;
-    int nberrors;
-    xmlStructuredErrorFunc serror;
-
-    xmlSchemaConstructionCtxtPtr constructor;
-    int ownsConstructor; /* TODO: Move this to parser *flags*. */
-
-    /* xmlSchemaPtr topschema;	*/
-    /* xmlHashTablePtr namespaces;  */
-
-    xmlSchemaPtr schema;
-    /* The main schema in use */
-    int counter;
-
-    const xmlChar *URL;
-    xmlDocPtr doc;
-    int preserve;
-    /* Whether the doc should be freed  */
-
-    const char *buffer;
-    int size;
-
-    /*
-     * Used to build complex element content models
-     */
-    xmlAutomataPtr am;
-    xmlAutomataStatePtr start;
-    xmlAutomataStatePtr end;
-    xmlAutomataStatePtr state;
-
-    xmlDictPtr dict;
-    /* dictionnary for interned string names */
-    xmlSchemaTypePtr ctxtType;
-    /* The current context simple/complex type */
-    int options;
-    xmlSchemaValidCtxtPtr vctxt;
-    int isS4S;
-    int isRedefine;
-    int xsiAssemble;
-    int stop;
-    /* If the parser should stop; i.e. a critical error. */
-    const xmlChar *targetNamespace;
-    xmlSchemaBucketPtr redefined;
-    /* The schema to be redefined. */
-
-    xmlSchemaRedefPtr redef;
-    /* Used for redefinitions. */
-    int redefCounter;
-    /* Used for redefinitions. */
-    xmlSchemaItemListPtr attrProhibs;
-};
-
-/**
- * xmlSchemaQNameRef:
- *
- * A component reference item (not a schema component)
- * (Extends xmlSchemaBasicItem)
- */
-typedef struct _xmlSchemaQNameRef xmlSchemaQNameRef;
-typedef xmlSchemaQNameRef *xmlSchemaQNameRefPtr;
-struct _xmlSchemaQNameRef {
-    xmlSchemaTypeType type;
-    xmlSchemaBasicItemPtr item;
-    /* The resolved referenced item. */
-    xmlSchemaTypeType itemType;
-    const xmlChar *name;
-    const xmlChar *targetNamespace;
-    xmlNodePtr node;
-};
-
-/**
- * xmlSchemaParticle:
- *
- * A particle component.
- * (Extends xmlSchemaTreeItem)
- */
-typedef struct _xmlSchemaParticle xmlSchemaParticle;
-typedef xmlSchemaParticle *xmlSchemaParticlePtr;
-struct _xmlSchemaParticle {
-    xmlSchemaTypeType type;
-    xmlSchemaAnnotPtr annot;
-    xmlSchemaTreeItemPtr next;
-    /* next particle */
-    xmlSchemaTreeItemPtr children;
-    /* the "term" (e.g. a model group,
-a group definition, a XML_SCHEMA_EXTRA_QNAMEREF (if a reference),
-   etc.) */
-    int minOccurs;
-    int maxOccurs;
-    xmlNodePtr node;
-};
-
-/**
- * xmlSchemaModelGroup:
- *
- * A model group component.
- * (Extends xmlSchemaTreeItem)
- */
-typedef struct _xmlSchemaModelGroup xmlSchemaModelGroup;
-typedef xmlSchemaModelGroup *xmlSchemaModelGroupPtr;
-struct _xmlSchemaModelGroup {
-    xmlSchemaTypeType type;
-    /* XML_SCHEMA_TYPE_SEQUENCE, XML_SCHEMA_TYPE_CHOICE, XML_SCHEMA_TYPE_ALL */
-    xmlSchemaAnnotPtr annot;
-    xmlSchemaTreeItemPtr next;
-    /* not used */
-    xmlSchemaTreeItemPtr children;
-    /* first particle (OR "element decl" OR "wildcard") */
-    xmlNodePtr node;
-};
-
-#define XML_SCHEMA_MODEL_GROUP_DEF_MARKED 1<<0
-#define XML_SCHEMA_MODEL_GROUP_DEF_REDEFINED 1<<1
-/**
- * xmlSchemaModelGroupDef:
- *
- * A model group definition component.
- * (Extends xmlSchemaTreeItem)
- */
-typedef struct _xmlSchemaModelGroupDef xmlSchemaModelGroupDef;
-typedef xmlSchemaModelGroupDef *xmlSchemaModelGroupDefPtr;
-struct _xmlSchemaModelGroupDef {
-    xmlSchemaTypeType type;
-    /* XML_SCHEMA_TYPE_GROUP */
-    xmlSchemaAnnotPtr annot;
-    xmlSchemaTreeItemPtr next;
-    /* not used */
-    xmlSchemaTreeItemPtr children;
-    /* the "model group" */
-    const xmlChar *name;
-    const xmlChar *targetNamespace;
-    xmlNodePtr node;
-    int flags;
-};
-
-typedef struct _xmlSchemaIDC xmlSchemaIDC;
-typedef xmlSchemaIDC *xmlSchemaIDCPtr;
-
-/**
- * xmlSchemaIDCSelect:
- *
- * The identity-constraint "field" and "selector" item, holding the
- * XPath expression.
- */
-typedef struct _xmlSchemaIDCSelect xmlSchemaIDCSelect;
-typedef xmlSchemaIDCSelect *xmlSchemaIDCSelectPtr;
-struct _xmlSchemaIDCSelect {
-    xmlSchemaIDCSelectPtr next;
-    xmlSchemaIDCPtr idc;
-    int index;
-    /* an index position if significant for IDC key-sequences */
-    const xmlChar *xpath;
-    /* the XPath expression */
-    void *xpathComp; /* the compiled XPath expression */
-};
-
-/**
- * xmlSchemaIDC:
- *
- * The identity-constraint definition component.
- * (Extends xmlSchemaAnnotItem)
- */
-
-struct _xmlSchemaIDC {
-    xmlSchemaTypeType type;
-    xmlSchemaAnnotPtr annot;
-    xmlSchemaIDCPtr next;
-    xmlNodePtr node;
-    const xmlChar *name;
-    const xmlChar *targetNamespace;
-    xmlSchemaIDCSelectPtr selector;
-    xmlSchemaIDCSelectPtr fields;
-    int nbFields;
-    xmlSchemaQNameRefPtr ref;
-};
-
-/**
- * xmlSchemaIDCAug:
- *
- * The augmented IDC information used for validation.
- */
-typedef struct _xmlSchemaIDCAug xmlSchemaIDCAug;
-typedef xmlSchemaIDCAug *xmlSchemaIDCAugPtr;
-struct _xmlSchemaIDCAug {
-    xmlSchemaIDCAugPtr next;
-    /* next in a list */
-    xmlSchemaIDCPtr def;
-    /* the IDC definition */
-    int keyrefDepth; /* the lowest tree level to which IDC
-                        tables need to be bubbled upwards */
-};
-
-/**
- * xmlSchemaPSVIIDCKeySequence:
- *
- * The key sequence of a node table item.
- */
-typedef struct _xmlSchemaPSVIIDCKey xmlSchemaPSVIIDCKey;
-typedef xmlSchemaPSVIIDCKey *xmlSchemaPSVIIDCKeyPtr;
-struct _xmlSchemaPSVIIDCKey {
-    xmlSchemaTypePtr type;
-    xmlSchemaValPtr val;
-};
-
-/**
- * xmlSchemaPSVIIDCNode:
- *
- * The node table item of a node table.
- */
-typedef struct _xmlSchemaPSVIIDCNode xmlSchemaPSVIIDCNode;
-typedef xmlSchemaPSVIIDCNode *xmlSchemaPSVIIDCNodePtr;
-struct _xmlSchemaPSVIIDCNode {
-    xmlNodePtr node;
-    xmlSchemaPSVIIDCKeyPtr *keys;
-    int nodeLine;
-    int nodeQNameID;
-
-};
-
-/**
- * xmlSchemaPSVIIDCBinding:
- *
- * The identity-constraint binding item of the [identity-constraint table].
- */
-typedef struct _xmlSchemaPSVIIDCBinding xmlSchemaPSVIIDCBinding;
-typedef xmlSchemaPSVIIDCBinding *xmlSchemaPSVIIDCBindingPtr;
-struct _xmlSchemaPSVIIDCBinding {
-    xmlSchemaPSVIIDCBindingPtr next;
-    /* next binding of a specific node */
-    xmlSchemaIDCPtr definition;
-    /* the IDC definition */
-    xmlSchemaPSVIIDCNodePtr *nodeTable;
-    /* array of key-sequences */
-    int nbNodes;
-    /* number of entries in the node table */
-    int sizeNodes;
-    /* size of the node table */
-    xmlSchemaItemListPtr dupls;
-};
-
-
-#define XPATH_STATE_OBJ_TYPE_IDC_SELECTOR 1
-#define XPATH_STATE_OBJ_TYPE_IDC_FIELD 2
-
-#define XPATH_STATE_OBJ_MATCHES -2
-#define XPATH_STATE_OBJ_BLOCKED -3
-
-typedef struct _xmlSchemaIDCMatcher xmlSchemaIDCMatcher;
-typedef xmlSchemaIDCMatcher *xmlSchemaIDCMatcherPtr;
-
-/**
- * xmlSchemaIDCStateObj:
- *
- * The state object used to evaluate XPath expressions.
- */
-typedef struct _xmlSchemaIDCStateObj xmlSchemaIDCStateObj;
-typedef xmlSchemaIDCStateObj *xmlSchemaIDCStateObjPtr;
-struct _xmlSchemaIDCStateObj {
-    int type;
-    xmlSchemaIDCStateObjPtr next;
-    /* next if in a list */
-    int depth;
-    /* depth of creation */
-    int *history;
-    /* list of (depth, state-id) tuples */
-    int nbHistory;
-    int sizeHistory;
-    xmlSchemaIDCMatcherPtr matcher;
-    /* the correspondent field/selector
-   matcher */
-    xmlSchemaIDCSelectPtr sel;
-    void *xpathCtxt;
-};
-
-#define IDC_MATCHER 0
-
-/**
- * xmlSchemaIDCMatcher:
- *
- * Used to evaluate IDC selectors (and fields).
- */
-struct _xmlSchemaIDCMatcher {
-    int type;
-    int depth;
-    /* the tree depth at creation time */
-    xmlSchemaIDCMatcherPtr next;
-    /* next in the list */
-    xmlSchemaIDCMatcherPtr nextCached;
-    /* next in the cache list */
-    xmlSchemaIDCAugPtr aidc;
-    /* the augmented IDC item */
-    int idcType;
-    xmlSchemaPSVIIDCKeyPtr **keySeqs;
-    /* the key-sequences of the target
-   elements */
-    int sizeKeySeqs;
-    xmlSchemaItemListPtr targets; /* list of target-node
-                                     (xmlSchemaPSVIIDCNodePtr) entries */
-};
-
-/*
-* Element info flags.
-*/
-#define XML_SCHEMA_NODE_INFO_FLAG_OWNED_NAMES  1<<0
-#define XML_SCHEMA_NODE_INFO_FLAG_OWNED_VALUES 1<<1
-#define XML_SCHEMA_ELEM_INFO_NILLED           1<<2
-#define XML_SCHEMA_ELEM_INFO_LOCAL_TYPE           1<<3
-
-#define XML_SCHEMA_NODE_INFO_VALUE_NEEDED      1<<4
-#define XML_SCHEMA_ELEM_INFO_EMPTY             1<<5
-#define XML_SCHEMA_ELEM_INFO_HAS_CONTENT       1<<6
-
-#define XML_SCHEMA_ELEM_INFO_HAS_ELEM_CONTENT  1<<7
-#define XML_SCHEMA_ELEM_INFO_ERR_BAD_CONTENT  1<<8
-#define XML_SCHEMA_NODE_INFO_ERR_NOT_EXPECTED  1<<9
-#define XML_SCHEMA_NODE_INFO_ERR_BAD_TYPE  1<<10
-
-/**
- * xmlSchemaNodeInfo:
- *
- * Holds information of an element node.
- */
-struct _xmlSchemaNodeInfo {
-    int nodeType;
-    xmlNodePtr node;
-    int nodeLine;
-    const xmlChar *localName;
-    const xmlChar *nsName;
-    const xmlChar *value;
-    xmlSchemaValPtr val;
-    /* the pre-computed value if any */
-    xmlSchemaTypePtr typeDef;
-    /* the complex/simple type definition if any */
-
-    int flags;
-    /* combination of node info flags */
-
-    int valNeeded;
-    int normVal;
-
-    xmlSchemaElementPtr decl;
-    /* the element/attribute declaration */
-    int depth;
-    xmlSchemaPSVIIDCBindingPtr idcTable;
-    /* the table of PSVI IDC bindings
- for the scope element*/
-    xmlSchemaIDCMatcherPtr idcMatchers;
-    /* the IDC matchers for the scope
-   element */
-    xmlRegExecCtxtPtr regexCtxt;
-
-    const xmlChar **nsBindings;
-    /* Namespace bindings on this element */
-    int nbNsBindings;
-    int sizeNsBindings;
-
-    int hasKeyrefs;
-    int appliedXPath; /* Indicates that an XPath has been applied. */
-};
-
-#define XML_SCHEMAS_ATTR_UNKNOWN 1
-#define XML_SCHEMAS_ATTR_ASSESSED 2
-#define XML_SCHEMAS_ATTR_PROHIBITED 3
-#define XML_SCHEMAS_ATTR_ERR_MISSING 4
-#define XML_SCHEMAS_ATTR_INVALID_VALUE 5
-#define XML_SCHEMAS_ATTR_ERR_NO_TYPE 6
-#define XML_SCHEMAS_ATTR_ERR_FIXED_VALUE 7
-#define XML_SCHEMAS_ATTR_DEFAULT 8
-#define XML_SCHEMAS_ATTR_VALIDATE_VALUE 9
-#define XML_SCHEMAS_ATTR_ERR_WILD_STRICT_NO_DECL 10
-#define XML_SCHEMAS_ATTR_HAS_ATTR_USE 11
-#define XML_SCHEMAS_ATTR_HAS_ATTR_DECL 12
-#define XML_SCHEMAS_ATTR_WILD_SKIP 13
-#define XML_SCHEMAS_ATTR_WILD_LAX_NO_DECL 14
-#define XML_SCHEMAS_ATTR_ERR_WILD_DUPLICATE_ID 15
-#define XML_SCHEMAS_ATTR_ERR_WILD_AND_USE_ID 16
-#define XML_SCHEMAS_ATTR_META 17
-/*
-* @metaType values of xmlSchemaAttrInfo.
-*/
-#define XML_SCHEMA_ATTR_INFO_META_XSI_TYPE 1
-#define XML_SCHEMA_ATTR_INFO_META_XSI_NIL 2
-#define XML_SCHEMA_ATTR_INFO_META_XSI_SCHEMA_LOC 3
-#define XML_SCHEMA_ATTR_INFO_META_XSI_NO_NS_SCHEMA_LOC 4
-#define XML_SCHEMA_ATTR_INFO_META_XMLNS 5
-
-typedef struct _xmlSchemaAttrInfo xmlSchemaAttrInfo;
-typedef xmlSchemaAttrInfo *xmlSchemaAttrInfoPtr;
-struct _xmlSchemaAttrInfo {
-    int nodeType;
-    xmlNodePtr node;
-    int nodeLine;
-    const xmlChar *localName;
-    const xmlChar *nsName;
-    const xmlChar *value;
-    xmlSchemaValPtr val;
-    /* the pre-computed value if any */
-    xmlSchemaTypePtr typeDef;
-    /* the complex/simple type definition if any */
-    int flags;
-    /* combination of node info flags */
-
-    xmlSchemaAttributePtr decl;
-    /* the attribute declaration */
-    xmlSchemaAttributeUsePtr use;
-    /* the attribute use */
-    int state;
-    int metaType;
-    const xmlChar *vcValue;
-    /* the value constraint value */
-    xmlSchemaNodeInfoPtr parent;
-};
-
-
-#define XML_SCHEMA_VALID_CTXT_FLAG_STREAM 1
-/**
- * xmlSchemaValidCtxt:
- *
- * A Schemas validation context
- */
-struct _xmlSchemaValidCtxt {
-    int type;
-    void *errCtxt;
-    /* user specific data block */
-    xmlSchemaValidityErrorFunc error;
-    /* the callback in case of errors */
-    xmlSchemaValidityWarningFunc warning;
-    /* the callback in case of warning */
-    xmlStructuredErrorFunc serror;
-
-    xmlSchemaPtr schema;
-    /* The schema in use */
-    xmlDocPtr doc;
-    xmlParserInputBufferPtr input;
-    xmlCharEncoding enc;
-    xmlSAXHandlerPtr sax;
-    xmlParserCtxtPtr parserCtxt;
-    void *user_data;
-    /* TODO: What is this for? */
-
-    int err;
-    int nberrors;
-
-    xmlNodePtr node;
-    xmlNodePtr cur;
-    /* xmlSchemaTypePtr type; */
-
-    xmlRegExecCtxtPtr regexp;
-    xmlSchemaValPtr value;
-
-    int valueWS;
-    int options;
-    xmlNodePtr validationRoot;
-    xmlSchemaParserCtxtPtr pctxt;
-    int xsiAssemble;
-
-    int depth;
-    xmlSchemaNodeInfoPtr *elemInfos;
-    /* array of element informations */
-    int sizeElemInfos;
-    xmlSchemaNodeInfoPtr inode;
-    /* the current element information */
-
-    xmlSchemaIDCAugPtr aidcs;
-    /* a list of augmented IDC informations */
-
-    xmlSchemaIDCStateObjPtr xpathStates;
-    /* first active state object. */
-    xmlSchemaIDCStateObjPtr xpathStatePool;
-    /* first stored state object. */
-    xmlSchemaIDCMatcherPtr idcMatcherCache;
-    /* Cache for IDC matcher objects. */
-
-    xmlSchemaPSVIIDCNodePtr *idcNodes;
-    /* list of all IDC node-table entries*/
-    int nbIdcNodes;
-    int sizeIdcNodes;
-
-    xmlSchemaPSVIIDCKeyPtr *idcKeys;
-    /* list of all IDC node-table entries */
-    int nbIdcKeys;
-    int sizeIdcKeys;
-
-    int flags;
-
-    xmlDictPtr dict;
-
-#ifdef LIBXML_READER_ENABLED
-    xmlTextReaderPtr reader;
-#endif
-
-    xmlSchemaAttrInfoPtr *attrInfos;
-    int nbAttrInfos;
-    int sizeAttrInfos;
-
-    int skipDepth;
-    xmlSchemaItemListPtr nodeQNames;
-    int hasKeyrefs;
-    int createIDCNodeTables;
-    int psviExposeIDCNodeTables;
-};
-
-/**
- * xmlSchemaSubstGroup:
- *
- *
- */
-typedef struct _xmlSchemaSubstGroup xmlSchemaSubstGroup;
-typedef xmlSchemaSubstGroup *xmlSchemaSubstGroupPtr;
-struct _xmlSchemaSubstGroup {
-    xmlSchemaElementPtr head;
-    xmlSchemaItemListPtr members;
-};
+#define QNIL_OR_STRING(slot) \
+    (slot == NULL) ? Qnil : rb_str_new2((const char *)slot)
 
-/*static xmlSchemaQNameRefPtr
-        xmlSchemaParseAttributeGroupRef(xmlSchemaParserCtxtPtr pctxt,
-        xmlSchemaPtr schema,
-        xmlNodePtr node);*/
+extern VALUE cXMLSchema;
 
+void rxml_init_schema(void);
 
 #endif
 
diff --git a/ext/libxml/ruby_xml_schema_attribute.c b/ext/libxml/ruby_xml_schema_attribute.c
index 6238d86..aabb10c 100644
--- a/ext/libxml/ruby_xml_schema_attribute.c
+++ b/ext/libxml/ruby_xml_schema_attribute.c
@@ -2,6 +2,52 @@
 #include "ruby_xml_schema_attribute.h"
 #include "ruby_xml_schema_type.h"
 
+/**
+ * xmlSchemaBasicItem:
+ *
+ * The abstract base type for schema components.
+ */
+typedef struct _xmlSchemaBasicItem xmlSchemaBasicItem;
+typedef xmlSchemaBasicItem *xmlSchemaBasicItemPtr;
+struct _xmlSchemaBasicItem {
+    xmlSchemaTypeType type;
+};
+
+/**
+ * xmlSchemaQNameRef:
+ *
+ * A component reference item (not a schema component)
+ * (Extends xmlSchemaBasicItem)
+ */
+typedef struct _xmlSchemaQNameRef xmlSchemaQNameRef;
+typedef xmlSchemaQNameRef *xmlSchemaQNameRefPtr;
+struct _xmlSchemaQNameRef {
+    xmlSchemaTypeType type;
+    xmlSchemaBasicItemPtr item;
+    /* The resolved referenced item. */
+    xmlSchemaTypeType itemType;
+    const xmlChar *name;
+    const xmlChar *targetNamespace;
+    xmlNodePtr node;
+};
+
+/**
+ * xmlSchemaAttributeUseProhibPtr:
+ *
+ * A helper component to reflect attribute prohibitions.
+ * (Extends xmlSchemaBasicItem)
+ */
+typedef struct _xmlSchemaAttributeUseProhib xmlSchemaAttributeUseProhib;
+typedef xmlSchemaAttributeUseProhib *xmlSchemaAttributeUseProhibPtr;
+struct _xmlSchemaAttributeUseProhib {
+    xmlSchemaTypeType type;
+    /* == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB */
+    xmlNodePtr node;
+    const xmlChar *name;
+    const xmlChar *targetNamespace;
+    int isRef;
+};
+
 VALUE cXMLSchemaAttribute;
 
 static void rxml_schema_attribute_free(xmlSchemaAttributeUsePtr attr)
diff --git a/ext/libxml/ruby_xml_schema_attribute.h b/ext/libxml/ruby_xml_schema_attribute.h
index 03570e1..b542905 100644
--- a/ext/libxml/ruby_xml_schema_attribute.h
+++ b/ext/libxml/ruby_xml_schema_attribute.h
@@ -2,12 +2,34 @@
 #define __RXML_SCHEMA_ATTRIBUTE__
 
 #include "ruby_xml_schema.h"
-#include <libxml/schemasInternals.h>
-#include <libxml/xmlschemas.h>
-#include <libxml/xmlschemastypes.h>
 
 extern VALUE cXMLSchemaAttribute;
 
+/**
+ * xmlSchemaAttributeUsePtr:
+ *
+ * The abstract base type for tree-like structured schema components.
+ * (Extends xmlSchemaTreeItem)
+ */
+typedef struct _xmlSchemaAttributeUse xmlSchemaAttributeUse;
+typedef xmlSchemaAttributeUse *xmlSchemaAttributeUsePtr;
+struct _xmlSchemaAttributeUse {
+    xmlSchemaTypeType type;
+    xmlSchemaAnnotPtr annot;
+    xmlSchemaAttributeUsePtr next; /* The next attr. use. */
+    /*
+    * The attr. decl. OR a QName-ref. to an attr. decl. OR
+    * a QName-ref. to an attribute group definition.
+    */
+    xmlSchemaAttributePtr attrDecl;
+
+    int flags;
+    xmlNodePtr node;
+    int occurs;
+    /* required, optional */
+    const xmlChar *defValue;
+    xmlSchemaValPtr defVal;
+};
 
 void rxml_init_schema_attribute(void);
 VALUE rxml_wrap_schema_attribute(xmlSchemaAttributeUsePtr attr);
diff --git a/ext/libxml/ruby_xml_schema_element.h b/ext/libxml/ruby_xml_schema_element.h
index 9d39078..9ff3e75 100644
--- a/ext/libxml/ruby_xml_schema_element.h
+++ b/ext/libxml/ruby_xml_schema_element.h
@@ -2,9 +2,6 @@
 #define __RXML_SCHEMA_ELEMENT__
 
 #include "ruby_xml_schema.h"
-#include <libxml/schemasInternals.h>
-#include <libxml/xmlschemas.h>
-#include <libxml/xmlschemastypes.h>
 
 extern VALUE cXMLSchemaElement;
 
diff --git a/ext/libxml/ruby_xml_schema_facet.c b/ext/libxml/ruby_xml_schema_facet.c
index 9574797..a790b28 100644
--- a/ext/libxml/ruby_xml_schema_facet.c
+++ b/ext/libxml/ruby_xml_schema_facet.c
@@ -1,6 +1,10 @@
 #include "ruby_libxml.h"
 #include "ruby_xml_schema_facet.h"
 
+#include <libxml/schemasInternals.h>
+#include <libxml/xmlschemas.h>
+#include <libxml/xmlschemastypes.h>
+
 VALUE cXMLSchemaFacet;
 
 static void rxml_schema_facet_free(xmlSchemaFacetPtr xschema_type)
diff --git a/ext/libxml/ruby_xml_schema_facet.h b/ext/libxml/ruby_xml_schema_facet.h
index 569f251..f534f79 100644
--- a/ext/libxml/ruby_xml_schema_facet.h
+++ b/ext/libxml/ruby_xml_schema_facet.h
@@ -1,10 +1,6 @@
 #ifndef __RXML_SCHEMA_FACET__
 #define __RXML_SCHEMA_FACET__
 
-#include <libxml/schemasInternals.h>
-#include <libxml/xmlschemas.h>
-#include <libxml/xmlschemastypes.h>
-
 extern VALUE cXMLSchemaFacet;
 
 VALUE rxml_wrap_schema_facet(xmlSchemaFacetPtr facet);
diff --git a/ext/libxml/ruby_xml_schema_type.c b/ext/libxml/ruby_xml_schema_type.c
index 5a34b71..a6113a4 100644
--- a/ext/libxml/ruby_xml_schema_type.c
+++ b/ext/libxml/ruby_xml_schema_type.c
@@ -7,6 +7,43 @@
 #define UNBOUNDED 1 << 30
 #define FREE_AND_NULL(str) if ((str) != NULL) { xmlFree((xmlChar *) (str)); str = NULL; }
 
+/**
+ * xmlSchemaTreeItem:
+ *
+ * The abstract base type for tree-like structured schema components.
+ * (Extends xmlSchemaAnnotItem)
+ */
+typedef struct _xmlSchemaTreeItem xmlSchemaTreeItem;
+typedef xmlSchemaTreeItem *xmlSchemaTreeItemPtr;
+struct _xmlSchemaTreeItem {
+    xmlSchemaTypeType type;
+    xmlSchemaAnnotPtr annot;
+    xmlSchemaTreeItemPtr next;
+    xmlSchemaTreeItemPtr children;
+};
+
+ /**
+ * xmlSchemaParticle:
+ *
+ * A particle component.
+ * (Extends xmlSchemaTreeItem)
+ */
+typedef struct _xmlSchemaParticle xmlSchemaParticle;
+typedef xmlSchemaParticle *xmlSchemaParticlePtr;
+struct _xmlSchemaParticle {
+    xmlSchemaTypeType type;
+    xmlSchemaAnnotPtr annot;
+    xmlSchemaTreeItemPtr next;
+    /* next particle */
+    xmlSchemaTreeItemPtr children;
+    /* the "term" (e.g. a model group,
+a group definition, a XML_SCHEMA_EXTRA_QNAMEREF (if a reference),
+   etc.) */
+    int minOccurs;
+    int maxOccurs;
+    xmlNodePtr node;
+};
+
 VALUE cXMLSchemaType;
 
 static void rxml_schema_type_free(xmlSchemaTypePtr xschema_type)
diff --git a/ext/libxml/ruby_xml_writer.c b/ext/libxml/ruby_xml_writer.c
index 68a706e..f3930ab 100644
--- a/ext/libxml/ruby_xml_writer.c
+++ b/ext/libxml/ruby_xml_writer.c
@@ -1,6 +1,10 @@
 #include "ruby_libxml.h"
 #include "ruby_xml_writer.h"
 
+#ifdef LIBXML_WRITER_ENABLED
+#include <libxml/xmlwriter.h>
+#endif
+
 VALUE cXMLWriter;
 static VALUE sEncoding, sStandalone;
 
diff --git a/ext/libxml/ruby_xml_writer.h b/ext/libxml/ruby_xml_writer.h
index f9b2951..7319508 100644
--- a/ext/libxml/ruby_xml_writer.h
+++ b/ext/libxml/ruby_xml_writer.h
@@ -1,10 +1,6 @@
 #ifndef __RXML_WRITER__
 #define __RXML_WRITER__
 
-#ifdef LIBXML_WRITER_ENABLED
-#include <libxml/xmlwriter.h>
-#endif
-
 extern VALUE cXMLWriter;
 void rxml_init_writer(void);
 #endif
diff --git a/ext/libxml/ruby_xml_xinclude.c b/ext/libxml/ruby_xml_xinclude.c
index fc4bb78..e2676fe 100644
--- a/ext/libxml/ruby_xml_xinclude.c
+++ b/ext/libxml/ruby_xml_xinclude.c
@@ -1,6 +1,10 @@
 #include "ruby_libxml.h"
 #include "ruby_xml_xinclude.h"
 
+#ifdef LIBXML_XINCLUDE_ENABLED
+#include <libxml/xinclude.h>
+#endif
+
 VALUE cXMLXInclude;
 
 /*
diff --git a/ext/libxml/ruby_xml_xpath.c b/ext/libxml/ruby_xml_xpath.c
index 5f86c0b..3bfa199 100644
--- a/ext/libxml/ruby_xml_xpath.c
+++ b/ext/libxml/ruby_xml_xpath.c
@@ -75,6 +75,7 @@
 */
 
 #include "ruby_libxml.h"
+#include <libxml/xpathInternals.h>
 
 VALUE mXPath;
 
diff --git a/ext/libxml/ruby_xml_xpath.h b/ext/libxml/ruby_xml_xpath.h
index b31ae86..0051ae7 100644
--- a/ext/libxml/ruby_xml_xpath.h
+++ b/ext/libxml/ruby_xml_xpath.h
@@ -3,6 +3,8 @@
 #ifndef __RXML_XPATH__
 #define __RXML_XPATH__
 
+#include <libxml/xpath.h>
+
 extern VALUE mXPath;
 
 void rxml_init_xpath(void);
diff --git a/ext/libxml/ruby_xml_xpath_context.c b/ext/libxml/ruby_xml_xpath_context.c
index 9b60c93..204cc2b 100644
--- a/ext/libxml/ruby_xml_xpath_context.c
+++ b/ext/libxml/ruby_xml_xpath_context.c
@@ -10,6 +10,8 @@
 #include <st.h>
 #endif
 
+#include <libxml/xpathInternals.h>
+
 /*
  * Document-class: LibXML::XML::XPath::Context
  *
diff --git a/ext/libxml/ruby_xml_xpath_object.c b/ext/libxml/ruby_xml_xpath_object.c
index 46892f8..4aeb02d 100644
--- a/ext/libxml/ruby_xml_xpath_object.c
+++ b/ext/libxml/ruby_xml_xpath_object.c
@@ -1,4 +1,5 @@
 #include "ruby_libxml.h"
+#include <libxml/xpathInternals.h>
 
 /*
  * Document-class: LibXML::XML::XPath::Object
diff --git a/ext/libxml/ruby_xml_xpointer.c b/ext/libxml/ruby_xml_xpointer.c
index 6f29945..11316f2 100644
--- a/ext/libxml/ruby_xml_xpointer.c
+++ b/ext/libxml/ruby_xml_xpointer.c
@@ -3,6 +3,10 @@
 #include "ruby_libxml.h"
 #include "ruby_xml_xpointer.h"
 
+#ifdef LIBXML_XPTR_ENABLED
+#include <libxml/xpointer.h>
+#endif
+
 VALUE cXMLXPointer;
 
 /*
@@ -62,7 +66,7 @@ VALUE rxml_xpointer_point2(VALUE node, VALUE xptr_str)
  */
 static VALUE rxml_xpointer_range(VALUE class, VALUE rstart, VALUE rend)
 {
-#ifdef LIBXML_XPTR_ENABLED
+#if defined LIBXML_XPTR_ENABLED && defined LIBXML_XPTR_LOCS_ENABLED
   xmlNodePtr start, end;
   VALUE rxxp;
   xmlXPathObjectPtr xpath;
diff --git a/lib/libxml-ruby.rb b/lib/libxml-ruby.rb
index f9086c0..ea67b69 100644
--- a/lib/libxml-ruby.rb
+++ b/lib/libxml-ruby.rb
@@ -4,7 +4,7 @@
 begin
   RUBY_VERSION =~ /(\d+.\d+)/
   require "#{$1}/libxml_ruby"
-rescue LoadError
+rescue LoadError => e
   require "libxml_ruby"
 end
 
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 1d4923c..bfc8ac1 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -6,4 +6,8 @@ require 'bundler/setup'
 require 'minitest/autorun'
 require 'libxml-ruby'
 
+def windows?
+  !(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/).nil?
+end
+
 STDOUT.write "\nlibxml2: #{LibXML::XML::LIBXML_VERSION}\n#{RUBY_DESCRIPTION}\n\n"
diff --git a/test/test_xml.rb b/test/test_xml.rb
index eb14e60..473e071 100644
--- a/test/test_xml.rb
+++ b/test/test_xml.rb
@@ -167,11 +167,19 @@ class TestXml < Minitest::Test
   end
 
   def test_enabled_docbook
-    assert(LibXML::XML.enabled_docbook?)
+    if windows?
+      refute(LibXML::XML.enabled_docbook?)
+    else
+      assert(LibXML::XML.enabled_docbook?)
+    end
   end
 
   def test_enabled_ftp
-    assert(LibXML::XML.enabled_ftp?)
+    if windows?
+      refute(LibXML::XML.enabled_ftp?)
+    else
+      assert(LibXML::XML.enabled_ftp?)
+    end
   end
 
   def test_enabled_http
@@ -242,7 +250,11 @@ class TestXml < Minitest::Test
   end
 
   def test_libxml_parser_features
-    assert_instance_of(Array, LibXML::XML.features)
+    if windows?
+      assert_nil(LibXML::XML.features)
+    else
+      assert_instance_of(Array, LibXML::XML.features)
+    end
   end
 
   def test_default_options
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin