libxml-ruby 5.0.4 → 5.0.6
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 +17 -6
- data/README.rdoc +1 -1
- data/Rakefile +98 -98
- data/ext/libxml/extconf.h +1 -0
- data/ext/libxml/extconf.rb +5 -0
- data/ext/libxml/libxml.c +79 -79
- data/ext/libxml/ruby_xml.c +556 -556
- data/ext/libxml/ruby_xml_attr.c +333 -333
- data/ext/libxml/ruby_xml_attr.h +12 -12
- data/ext/libxml/ruby_xml_attr_decl.h +11 -11
- data/ext/libxml/ruby_xml_attributes.h +17 -17
- data/ext/libxml/ruby_xml_cbg.c +85 -85
- data/ext/libxml/ruby_xml_document.c +1129 -1129
- data/ext/libxml/ruby_xml_dtd.c +257 -257
- data/ext/libxml/ruby_xml_dtd.h +9 -9
- data/ext/libxml/ruby_xml_encoding.c +250 -250
- data/ext/libxml/ruby_xml_error.c +1003 -1003
- data/ext/libxml/ruby_xml_error.h +14 -14
- data/ext/libxml/ruby_xml_html_parser.c +91 -91
- data/ext/libxml/ruby_xml_html_parser.h +10 -10
- data/ext/libxml/ruby_xml_html_parser_context.c +351 -351
- data/ext/libxml/ruby_xml_html_parser_context.h +10 -10
- data/ext/libxml/ruby_xml_html_parser_options.c +48 -48
- data/ext/libxml/ruby_xml_html_parser_options.h +10 -10
- data/ext/libxml/ruby_xml_input_cbg.c +188 -188
- data/ext/libxml/ruby_xml_input_cbg.h +20 -20
- data/ext/libxml/ruby_xml_io.c +47 -47
- data/ext/libxml/ruby_xml_io.h +10 -10
- data/ext/libxml/ruby_xml_namespace.c +151 -151
- 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.h +13 -13
- data/ext/libxml/ruby_xml_parser.c +91 -91
- data/ext/libxml/ruby_xml_parser.h +10 -10
- data/ext/libxml/ruby_xml_parser_context.c +1009 -1009
- data/ext/libxml/ruby_xml_parser_context.h +10 -10
- data/ext/libxml/ruby_xml_parser_options.c +74 -74
- data/ext/libxml/ruby_xml_parser_options.h +10 -10
- data/ext/libxml/ruby_xml_reader.h +14 -14
- data/ext/libxml/ruby_xml_relaxng.h +8 -8
- data/ext/libxml/ruby_xml_sax2_handler.c +326 -326
- data/ext/libxml/ruby_xml_sax2_handler.h +10 -10
- data/ext/libxml/ruby_xml_sax_parser.c +108 -108
- data/ext/libxml/ruby_xml_sax_parser.h +10 -10
- data/ext/libxml/ruby_xml_schema.h +25 -25
- data/ext/libxml/ruby_xml_schema_attribute.h +37 -37
- data/ext/libxml/ruby_xml_schema_element.h +11 -11
- data/ext/libxml/ruby_xml_schema_facet.c +50 -50
- data/ext/libxml/ruby_xml_schema_facet.h +9 -9
- 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 +1124 -1124
- data/ext/libxml/ruby_xml_writer.h +6 -6
- data/ext/libxml/ruby_xml_xinclude.c +20 -20
- data/ext/libxml/ruby_xml_xinclude.h +11 -11
- data/ext/libxml/ruby_xml_xpath.c +195 -195
- data/ext/libxml/ruby_xml_xpath.h +15 -15
- data/ext/libxml/ruby_xml_xpath_context.c +362 -362
- data/ext/libxml/ruby_xml_xpath_context.h +9 -9
- data/ext/libxml/ruby_xml_xpath_expression.h +10 -10
- data/ext/libxml/ruby_xml_xpath_object.h +17 -17
- data/lib/libxml/attr.rb +122 -122
- data/lib/libxml/attr_decl.rb +80 -80
- data/lib/libxml/attributes.rb +13 -13
- data/lib/libxml/document.rb +194 -194
- data/lib/libxml/error.rb +95 -95
- data/lib/libxml/hpricot.rb +77 -77
- data/lib/libxml/html_parser.rb +96 -96
- data/lib/libxml/namespace.rb +61 -61
- data/lib/libxml/namespaces.rb +37 -37
- data/lib/libxml/node.rb +323 -323
- data/lib/libxml/parser.rb +102 -102
- data/lib/libxml/sax_callbacks.rb +179 -179
- data/lib/libxml/sax_parser.rb +40 -40
- data/lib/libxml/tree.rb +28 -28
- data/lib/libxml-ruby.rb +2 -2
- data/lib/libxml.rb +4 -4
- data/lib/xml/libxml.rb +10 -10
- data/lib/xml.rb +13 -13
- data/libxml-ruby.gemspec +50 -49
- data/test/test_document.rb +140 -140
- data/test/test_document_write.rb +142 -142
- data/test/test_dtd.rb +126 -126
- data/test/test_encoding.rb +126 -126
- data/test/test_error.rb +197 -194
- data/test/test_helper.rb +21 -20
- data/test/test_namespace.rb +58 -58
- data/test/test_node.rb +235 -235
- data/test/test_node_write.rb +93 -93
- data/test/test_parser.rb +333 -333
- data/test/test_reader.rb +364 -364
- data/test/test_writer.rb +500 -468
- data/test/test_xml.rb +168 -168
- metadata +5 -5
- data/test/test.rb +0 -5
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
/* Please see the LICENSE file for copyright and distribution information */
|
|
2
|
-
|
|
3
|
-
#include "ruby_libxml.h"
|
|
4
|
-
#include "ruby_xml_sax_parser.h"
|
|
5
|
-
|
|
6
|
-
/*
|
|
7
|
-
* Document-class: LibXML::XML::SaxParser
|
|
8
|
-
*
|
|
9
|
-
* XML::SaxParser provides a callback based API for parsing documents,
|
|
10
|
-
* in contrast to XML::Parser's tree based API and XML::Reader's stream
|
|
11
|
-
* based API.
|
|
12
|
-
*
|
|
13
|
-
* The XML::SaxParser API is fairly complex, not well standardized,
|
|
14
|
-
* and does not directly support validation making entity, namespace and
|
|
15
|
-
* base processing relatively hard.
|
|
16
|
-
*
|
|
17
|
-
* To use the XML::SaxParser, register a callback class via the
|
|
18
|
-
* XML::SaxParser#callbacks=. It is easiest to include the
|
|
19
|
-
* XML::SaxParser::Callbacks module in your class and override
|
|
20
|
-
* the methods as needed.
|
|
21
|
-
*
|
|
22
|
-
* Basic example:
|
|
23
|
-
*
|
|
24
|
-
* class MyCallbacks
|
|
25
|
-
* include XML::SaxParser::Callbacks
|
|
26
|
-
* def on_start_element(element, attributes)
|
|
27
|
-
* puts #Element started: #{element}"
|
|
28
|
-
* end
|
|
29
|
-
* end
|
|
30
|
-
*
|
|
31
|
-
* parser = XML::SaxParser.string(my_string)
|
|
32
|
-
* parser.callbacks = MyCallbacks.new
|
|
33
|
-
* parser.parse
|
|
34
|
-
*
|
|
35
|
-
* You can also parse strings (see XML::SaxParser.string) and
|
|
36
|
-
* io objects (see XML::SaxParser.io).
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
|
-
VALUE cXMLSaxParser;
|
|
40
|
-
static ID CALLBACKS_ATTR;
|
|
41
|
-
static ID CONTEXT_ATTR;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
/* ====== Parser =========== */
|
|
45
|
-
|
|
46
|
-
/*
|
|
47
|
-
* call-seq:
|
|
48
|
-
* parser.initialize(context) -> XML::Parser
|
|
49
|
-
*
|
|
50
|
-
* Creates a new XML::Parser from the specified
|
|
51
|
-
* XML::Parser::Context.
|
|
52
|
-
*/
|
|
53
|
-
static VALUE rxml_sax_parser_initialize(int argc, VALUE *argv, VALUE self)
|
|
54
|
-
{
|
|
55
|
-
VALUE context = Qnil;
|
|
56
|
-
|
|
57
|
-
rb_scan_args(argc, argv, "01", &context);
|
|
58
|
-
|
|
59
|
-
if (context == Qnil)
|
|
60
|
-
{
|
|
61
|
-
rb_raise(rb_eArgError, "An instance of a XML::Parser::Context must be passed to XML::SaxParser.new");
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
rb_ivar_set(self, CONTEXT_ATTR, context);
|
|
65
|
-
return self;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/*
|
|
69
|
-
* call-seq:
|
|
70
|
-
* parser.parse -> (true|false)
|
|
71
|
-
*
|
|
72
|
-
* Parse the input XML, generating callbacks to the object
|
|
73
|
-
* registered via the +callbacks+ attributesibute.
|
|
74
|
-
*/
|
|
75
|
-
static VALUE rxml_sax_parser_parse(VALUE self)
|
|
76
|
-
{
|
|
77
|
-
VALUE context = rb_ivar_get(self, CONTEXT_ATTR);
|
|
78
|
-
xmlParserCtxtPtr ctxt;
|
|
79
|
-
Data_Get_Struct(context, xmlParserCtxt, ctxt);
|
|
80
|
-
|
|
81
|
-
ctxt->sax2 = 1;
|
|
82
|
-
ctxt->userData = (void*)rb_ivar_get(self, CALLBACKS_ATTR);
|
|
83
|
-
memcpy(ctxt->sax, &rxml_sax_handler, sizeof(rxml_sax_handler));
|
|
84
|
-
|
|
85
|
-
int status = xmlParseDocument(ctxt);
|
|
86
|
-
|
|
87
|
-
/* Now check the parsing result*/
|
|
88
|
-
if (status == -1 || !ctxt->wellFormed)
|
|
89
|
-
{
|
|
90
|
-
rxml_raise(&ctxt->lastError);
|
|
91
|
-
}
|
|
92
|
-
return Qtrue;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
void rxml_init_sax_parser(void)
|
|
96
|
-
{
|
|
97
|
-
/* SaxParser */
|
|
98
|
-
cXMLSaxParser = rb_define_class_under(mXML, "SaxParser", rb_cObject);
|
|
99
|
-
|
|
100
|
-
/* Atributes */
|
|
101
|
-
CALLBACKS_ATTR = rb_intern("@callbacks");
|
|
102
|
-
CONTEXT_ATTR = rb_intern("@context");
|
|
103
|
-
rb_define_attr(cXMLSaxParser, "callbacks", 1, 1);
|
|
104
|
-
|
|
105
|
-
/* Instance Methods */
|
|
106
|
-
rb_define_method(cXMLSaxParser, "initialize", rxml_sax_parser_initialize, -1);
|
|
107
|
-
rb_define_method(cXMLSaxParser, "parse", rxml_sax_parser_parse, 0);
|
|
108
|
-
}
|
|
1
|
+
/* Please see the LICENSE file for copyright and distribution information */
|
|
2
|
+
|
|
3
|
+
#include "ruby_libxml.h"
|
|
4
|
+
#include "ruby_xml_sax_parser.h"
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Document-class: LibXML::XML::SaxParser
|
|
8
|
+
*
|
|
9
|
+
* XML::SaxParser provides a callback based API for parsing documents,
|
|
10
|
+
* in contrast to XML::Parser's tree based API and XML::Reader's stream
|
|
11
|
+
* based API.
|
|
12
|
+
*
|
|
13
|
+
* The XML::SaxParser API is fairly complex, not well standardized,
|
|
14
|
+
* and does not directly support validation making entity, namespace and
|
|
15
|
+
* base processing relatively hard.
|
|
16
|
+
*
|
|
17
|
+
* To use the XML::SaxParser, register a callback class via the
|
|
18
|
+
* XML::SaxParser#callbacks=. It is easiest to include the
|
|
19
|
+
* XML::SaxParser::Callbacks module in your class and override
|
|
20
|
+
* the methods as needed.
|
|
21
|
+
*
|
|
22
|
+
* Basic example:
|
|
23
|
+
*
|
|
24
|
+
* class MyCallbacks
|
|
25
|
+
* include XML::SaxParser::Callbacks
|
|
26
|
+
* def on_start_element(element, attributes)
|
|
27
|
+
* puts #Element started: #{element}"
|
|
28
|
+
* end
|
|
29
|
+
* end
|
|
30
|
+
*
|
|
31
|
+
* parser = XML::SaxParser.string(my_string)
|
|
32
|
+
* parser.callbacks = MyCallbacks.new
|
|
33
|
+
* parser.parse
|
|
34
|
+
*
|
|
35
|
+
* You can also parse strings (see XML::SaxParser.string) and
|
|
36
|
+
* io objects (see XML::SaxParser.io).
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
VALUE cXMLSaxParser;
|
|
40
|
+
static ID CALLBACKS_ATTR;
|
|
41
|
+
static ID CONTEXT_ATTR;
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
/* ====== Parser =========== */
|
|
45
|
+
|
|
46
|
+
/*
|
|
47
|
+
* call-seq:
|
|
48
|
+
* parser.initialize(context) -> XML::Parser
|
|
49
|
+
*
|
|
50
|
+
* Creates a new XML::Parser from the specified
|
|
51
|
+
* XML::Parser::Context.
|
|
52
|
+
*/
|
|
53
|
+
static VALUE rxml_sax_parser_initialize(int argc, VALUE *argv, VALUE self)
|
|
54
|
+
{
|
|
55
|
+
VALUE context = Qnil;
|
|
56
|
+
|
|
57
|
+
rb_scan_args(argc, argv, "01", &context);
|
|
58
|
+
|
|
59
|
+
if (context == Qnil)
|
|
60
|
+
{
|
|
61
|
+
rb_raise(rb_eArgError, "An instance of a XML::Parser::Context must be passed to XML::SaxParser.new");
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
rb_ivar_set(self, CONTEXT_ATTR, context);
|
|
65
|
+
return self;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/*
|
|
69
|
+
* call-seq:
|
|
70
|
+
* parser.parse -> (true|false)
|
|
71
|
+
*
|
|
72
|
+
* Parse the input XML, generating callbacks to the object
|
|
73
|
+
* registered via the +callbacks+ attributesibute.
|
|
74
|
+
*/
|
|
75
|
+
static VALUE rxml_sax_parser_parse(VALUE self)
|
|
76
|
+
{
|
|
77
|
+
VALUE context = rb_ivar_get(self, CONTEXT_ATTR);
|
|
78
|
+
xmlParserCtxtPtr ctxt;
|
|
79
|
+
Data_Get_Struct(context, xmlParserCtxt, ctxt);
|
|
80
|
+
|
|
81
|
+
ctxt->sax2 = 1;
|
|
82
|
+
ctxt->userData = (void*)rb_ivar_get(self, CALLBACKS_ATTR);
|
|
83
|
+
memcpy(ctxt->sax, &rxml_sax_handler, sizeof(rxml_sax_handler));
|
|
84
|
+
|
|
85
|
+
int status = xmlParseDocument(ctxt);
|
|
86
|
+
|
|
87
|
+
/* Now check the parsing result*/
|
|
88
|
+
if (status == -1 || !ctxt->wellFormed)
|
|
89
|
+
{
|
|
90
|
+
rxml_raise(&ctxt->lastError);
|
|
91
|
+
}
|
|
92
|
+
return Qtrue;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
void rxml_init_sax_parser(void)
|
|
96
|
+
{
|
|
97
|
+
/* SaxParser */
|
|
98
|
+
cXMLSaxParser = rb_define_class_under(mXML, "SaxParser", rb_cObject);
|
|
99
|
+
|
|
100
|
+
/* Atributes */
|
|
101
|
+
CALLBACKS_ATTR = rb_intern("@callbacks");
|
|
102
|
+
CONTEXT_ATTR = rb_intern("@context");
|
|
103
|
+
rb_define_attr(cXMLSaxParser, "callbacks", 1, 1);
|
|
104
|
+
|
|
105
|
+
/* Instance Methods */
|
|
106
|
+
rb_define_method(cXMLSaxParser, "initialize", rxml_sax_parser_initialize, -1);
|
|
107
|
+
rb_define_method(cXMLSaxParser, "parse", rxml_sax_parser_parse, 0);
|
|
108
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/* Please see the LICENSE file for copyright and distribution information */
|
|
2
|
-
|
|
3
|
-
#ifndef __RXML_SAX_PARSER__
|
|
4
|
-
#define __RXML_SAX_PARSER__
|
|
5
|
-
|
|
6
|
-
extern VALUE cXMLSaxParser;
|
|
7
|
-
|
|
8
|
-
void rxml_init_sax_parser(void);
|
|
9
|
-
|
|
10
|
-
#endif
|
|
1
|
+
/* Please see the LICENSE file for copyright and distribution information */
|
|
2
|
+
|
|
3
|
+
#ifndef __RXML_SAX_PARSER__
|
|
4
|
+
#define __RXML_SAX_PARSER__
|
|
5
|
+
|
|
6
|
+
extern VALUE cXMLSaxParser;
|
|
7
|
+
|
|
8
|
+
void rxml_init_sax_parser(void);
|
|
9
|
+
|
|
10
|
+
#endif
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
#ifndef __RXML_SCHEMA__
|
|
2
|
-
#define __RXML_SCHEMA__
|
|
3
|
-
|
|
4
|
-
#include <libxml/schemasInternals.h>
|
|
5
|
-
#include <libxml/xmlschemastypes.h>
|
|
6
|
-
|
|
7
|
-
typedef struct _xmlSchemaItemList xmlSchemaItemList;
|
|
8
|
-
typedef xmlSchemaItemList *xmlSchemaItemListPtr;
|
|
9
|
-
struct _xmlSchemaItemList {
|
|
10
|
-
void **items;
|
|
11
|
-
/* used for dynamic addition of schemata */
|
|
12
|
-
int nbItems;
|
|
13
|
-
/* used for dynamic addition of schemata */
|
|
14
|
-
int sizeItems; /* used for dynamic addition of schemata */
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
#define QNIL_OR_STRING(slot) \
|
|
18
|
-
(slot == NULL) ? Qnil : rb_str_new2((const char *)slot)
|
|
19
|
-
|
|
20
|
-
extern VALUE cXMLSchema;
|
|
21
|
-
|
|
22
|
-
void rxml_init_schema(void);
|
|
23
|
-
|
|
24
|
-
#endif
|
|
25
|
-
|
|
1
|
+
#ifndef __RXML_SCHEMA__
|
|
2
|
+
#define __RXML_SCHEMA__
|
|
3
|
+
|
|
4
|
+
#include <libxml/schemasInternals.h>
|
|
5
|
+
#include <libxml/xmlschemastypes.h>
|
|
6
|
+
|
|
7
|
+
typedef struct _xmlSchemaItemList xmlSchemaItemList;
|
|
8
|
+
typedef xmlSchemaItemList *xmlSchemaItemListPtr;
|
|
9
|
+
struct _xmlSchemaItemList {
|
|
10
|
+
void **items;
|
|
11
|
+
/* used for dynamic addition of schemata */
|
|
12
|
+
int nbItems;
|
|
13
|
+
/* used for dynamic addition of schemata */
|
|
14
|
+
int sizeItems; /* used for dynamic addition of schemata */
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
#define QNIL_OR_STRING(slot) \
|
|
18
|
+
(slot == NULL) ? Qnil : rb_str_new2((const char *)slot)
|
|
19
|
+
|
|
20
|
+
extern VALUE cXMLSchema;
|
|
21
|
+
|
|
22
|
+
void rxml_init_schema(void);
|
|
23
|
+
|
|
24
|
+
#endif
|
|
25
|
+
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
#ifndef __RXML_SCHEMA_ATTRIBUTE__
|
|
2
|
-
#define __RXML_SCHEMA_ATTRIBUTE__
|
|
3
|
-
|
|
4
|
-
#include "ruby_xml_schema.h"
|
|
5
|
-
|
|
6
|
-
extern VALUE cXMLSchemaAttribute;
|
|
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
|
-
};
|
|
33
|
-
|
|
34
|
-
void rxml_init_schema_attribute(void);
|
|
35
|
-
VALUE rxml_wrap_schema_attribute(xmlSchemaAttributeUsePtr attr);
|
|
36
|
-
|
|
37
|
-
#endif
|
|
1
|
+
#ifndef __RXML_SCHEMA_ATTRIBUTE__
|
|
2
|
+
#define __RXML_SCHEMA_ATTRIBUTE__
|
|
3
|
+
|
|
4
|
+
#include "ruby_xml_schema.h"
|
|
5
|
+
|
|
6
|
+
extern VALUE cXMLSchemaAttribute;
|
|
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
|
+
};
|
|
33
|
+
|
|
34
|
+
void rxml_init_schema_attribute(void);
|
|
35
|
+
VALUE rxml_wrap_schema_attribute(xmlSchemaAttributeUsePtr attr);
|
|
36
|
+
|
|
37
|
+
#endif
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
#ifndef __RXML_SCHEMA_ELEMENT__
|
|
2
|
-
#define __RXML_SCHEMA_ELEMENT__
|
|
3
|
-
|
|
4
|
-
#include "ruby_xml_schema.h"
|
|
5
|
-
|
|
6
|
-
extern VALUE cXMLSchemaElement;
|
|
7
|
-
|
|
8
|
-
VALUE rxml_wrap_schema_element(xmlSchemaElementPtr xelement);
|
|
9
|
-
void rxml_init_schema_element(void);
|
|
10
|
-
|
|
11
|
-
#endif
|
|
1
|
+
#ifndef __RXML_SCHEMA_ELEMENT__
|
|
2
|
+
#define __RXML_SCHEMA_ELEMENT__
|
|
3
|
+
|
|
4
|
+
#include "ruby_xml_schema.h"
|
|
5
|
+
|
|
6
|
+
extern VALUE cXMLSchemaElement;
|
|
7
|
+
|
|
8
|
+
VALUE rxml_wrap_schema_element(xmlSchemaElementPtr xelement);
|
|
9
|
+
void rxml_init_schema_element(void);
|
|
10
|
+
|
|
11
|
+
#endif
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
#include "ruby_libxml.h"
|
|
2
|
-
#include "ruby_xml_schema_facet.h"
|
|
3
|
-
|
|
4
|
-
#include <libxml/schemasInternals.h>
|
|
5
|
-
#include <libxml/xmlschemas.h>
|
|
6
|
-
#include <libxml/xmlschemastypes.h>
|
|
7
|
-
|
|
8
|
-
VALUE cXMLSchemaFacet;
|
|
9
|
-
|
|
10
|
-
static void rxml_schema_facet_free(xmlSchemaFacetPtr xschema_type)
|
|
11
|
-
{
|
|
12
|
-
xschema_type = NULL;
|
|
13
|
-
xmlFree(xschema_type);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
VALUE rxml_wrap_schema_facet(xmlSchemaFacetPtr facet)
|
|
17
|
-
{
|
|
18
|
-
VALUE result;
|
|
19
|
-
|
|
20
|
-
if (!facet)
|
|
21
|
-
rb_raise(rb_eArgError, "XML::Schema::Facet required!");
|
|
22
|
-
|
|
23
|
-
result = Data_Wrap_Struct(cXMLSchemaFacet, NULL, rxml_schema_facet_free, facet);
|
|
24
|
-
|
|
25
|
-
rb_iv_set(result, "@kind", INT2NUM(facet->type));
|
|
26
|
-
rb_iv_set(result, "@value", QNIL_OR_STRING(facet->value));
|
|
27
|
-
|
|
28
|
-
return result;
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/* START FACET*/
|
|
33
|
-
|
|
34
|
-
static VALUE rxml_schema_facet_node(VALUE self)
|
|
35
|
-
{
|
|
36
|
-
xmlSchemaFacetPtr facet;
|
|
37
|
-
|
|
38
|
-
Data_Get_Struct(self, xmlSchemaFacet, facet);
|
|
39
|
-
|
|
40
|
-
return rxml_node_wrap(facet->node);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
void rxml_init_schema_facet(void)
|
|
44
|
-
{
|
|
45
|
-
cXMLSchemaFacet = rb_define_class_under(cXMLSchema, "Facet", rb_cObject);
|
|
46
|
-
rb_define_attr(cXMLSchemaFacet, "kind", 1, 0);
|
|
47
|
-
rb_define_attr(cXMLSchemaFacet, "value", 1, 0);
|
|
48
|
-
|
|
49
|
-
rb_define_method(cXMLSchemaFacet, "node", rxml_schema_facet_node, 0);
|
|
50
|
-
}
|
|
1
|
+
#include "ruby_libxml.h"
|
|
2
|
+
#include "ruby_xml_schema_facet.h"
|
|
3
|
+
|
|
4
|
+
#include <libxml/schemasInternals.h>
|
|
5
|
+
#include <libxml/xmlschemas.h>
|
|
6
|
+
#include <libxml/xmlschemastypes.h>
|
|
7
|
+
|
|
8
|
+
VALUE cXMLSchemaFacet;
|
|
9
|
+
|
|
10
|
+
static void rxml_schema_facet_free(xmlSchemaFacetPtr xschema_type)
|
|
11
|
+
{
|
|
12
|
+
xschema_type = NULL;
|
|
13
|
+
xmlFree(xschema_type);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
VALUE rxml_wrap_schema_facet(xmlSchemaFacetPtr facet)
|
|
17
|
+
{
|
|
18
|
+
VALUE result;
|
|
19
|
+
|
|
20
|
+
if (!facet)
|
|
21
|
+
rb_raise(rb_eArgError, "XML::Schema::Facet required!");
|
|
22
|
+
|
|
23
|
+
result = Data_Wrap_Struct(cXMLSchemaFacet, NULL, rxml_schema_facet_free, facet);
|
|
24
|
+
|
|
25
|
+
rb_iv_set(result, "@kind", INT2NUM(facet->type));
|
|
26
|
+
rb_iv_set(result, "@value", QNIL_OR_STRING(facet->value));
|
|
27
|
+
|
|
28
|
+
return result;
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* START FACET*/
|
|
33
|
+
|
|
34
|
+
static VALUE rxml_schema_facet_node(VALUE self)
|
|
35
|
+
{
|
|
36
|
+
xmlSchemaFacetPtr facet;
|
|
37
|
+
|
|
38
|
+
Data_Get_Struct(self, xmlSchemaFacet, facet);
|
|
39
|
+
|
|
40
|
+
return rxml_node_wrap(facet->node);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
void rxml_init_schema_facet(void)
|
|
44
|
+
{
|
|
45
|
+
cXMLSchemaFacet = rb_define_class_under(cXMLSchema, "Facet", rb_cObject);
|
|
46
|
+
rb_define_attr(cXMLSchemaFacet, "kind", 1, 0);
|
|
47
|
+
rb_define_attr(cXMLSchemaFacet, "value", 1, 0);
|
|
48
|
+
|
|
49
|
+
rb_define_method(cXMLSchemaFacet, "node", rxml_schema_facet_node, 0);
|
|
50
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#ifndef __RXML_SCHEMA_FACET__
|
|
2
|
-
#define __RXML_SCHEMA_FACET__
|
|
3
|
-
|
|
4
|
-
extern VALUE cXMLSchemaFacet;
|
|
5
|
-
|
|
6
|
-
VALUE rxml_wrap_schema_facet(xmlSchemaFacetPtr facet);
|
|
7
|
-
void rxml_init_schema_facet(void);
|
|
8
|
-
|
|
9
|
-
#endif
|
|
1
|
+
#ifndef __RXML_SCHEMA_FACET__
|
|
2
|
+
#define __RXML_SCHEMA_FACET__
|
|
3
|
+
|
|
4
|
+
extern VALUE cXMLSchemaFacet;
|
|
5
|
+
|
|
6
|
+
VALUE rxml_wrap_schema_facet(xmlSchemaFacetPtr facet);
|
|
7
|
+
void rxml_init_schema_facet(void);
|
|
8
|
+
|
|
9
|
+
#endif
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#ifndef __RXML_SCHEMA_TYPE__
|
|
2
|
-
#define __RXML_SCHEMA_TYPE__
|
|
3
|
-
|
|
4
|
-
extern VALUE cXMLSchemaType;
|
|
5
|
-
|
|
6
|
-
VALUE rxml_wrap_schema_type(xmlSchemaTypePtr xtype);
|
|
7
|
-
void rxml_init_schema_type(void);
|
|
8
|
-
|
|
9
|
-
#endif
|
|
1
|
+
#ifndef __RXML_SCHEMA_TYPE__
|
|
2
|
+
#define __RXML_SCHEMA_TYPE__
|
|
3
|
+
|
|
4
|
+
extern VALUE cXMLSchemaType;
|
|
5
|
+
|
|
6
|
+
VALUE rxml_wrap_schema_type(xmlSchemaTypePtr xtype);
|
|
7
|
+
void rxml_init_schema_type(void);
|
|
8
|
+
|
|
9
|
+
#endif
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/* Don't nuke this block! It is used for automatically updating the
|
|
2
|
-
* versions below. VERSION = string formatting, VERNUM = numbered
|
|
3
|
-
* version for inline testing: increment both or none at all.*/
|
|
4
|
-
#define RUBY_LIBXML_VERSION "5.0.
|
|
5
|
-
#define RUBY_LIBXML_VERNUM
|
|
6
|
-
#define RUBY_LIBXML_VER_MAJ 5
|
|
7
|
-
#define RUBY_LIBXML_VER_MIN 0
|
|
8
|
-
#define RUBY_LIBXML_VER_MIC
|
|
9
|
-
#define RUBY_LIBXML_VER_PATCH 0
|
|
1
|
+
/* Don't nuke this block! It is used for automatically updating the
|
|
2
|
+
* versions below. VERSION = string formatting, VERNUM = numbered
|
|
3
|
+
* version for inline testing: increment both or none at all.*/
|
|
4
|
+
#define RUBY_LIBXML_VERSION "5.0.6"
|
|
5
|
+
#define RUBY_LIBXML_VERNUM 505
|
|
6
|
+
#define RUBY_LIBXML_VER_MAJ 5
|
|
7
|
+
#define RUBY_LIBXML_VER_MIN 0
|
|
8
|
+
#define RUBY_LIBXML_VER_MIC 6
|
|
9
|
+
#define RUBY_LIBXML_VER_PATCH 0
|