libxml-ruby 0.8.3-x86-mswin32-60 → 0.9.0-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +18 -0
- data/RAKEFILE +15 -39
- data/README +48 -47
- data/ext/libxml/libxml.c +847 -22
- data/ext/libxml/ruby_libxml.h +71 -95
- data/ext/libxml/ruby_xml_attr.c +500 -500
- data/ext/libxml/ruby_xml_attributes.c +1 -1
- data/ext/libxml/ruby_xml_document.c +1144 -1135
- data/ext/libxml/ruby_xml_document.h +4 -11
- data/ext/libxml/ruby_xml_dtd.c +27 -0
- data/ext/libxml/ruby_xml_encoding.c +164 -0
- data/ext/libxml/ruby_xml_encoding.h +13 -0
- data/ext/libxml/ruby_xml_error.c +941 -0
- data/ext/libxml/ruby_xml_error.h +13 -0
- data/ext/libxml/ruby_xml_html_parser.c +71 -387
- data/ext/libxml/ruby_xml_html_parser.h +1 -17
- data/ext/libxml/ruby_xml_input.c +179 -0
- data/ext/libxml/ruby_xml_input.h +18 -0
- data/ext/libxml/ruby_xml_input_cbg.c +17 -3
- data/ext/libxml/ruby_xml_node.c +1566 -1582
- data/ext/libxml/ruby_xml_node.h +1 -4
- data/ext/libxml/ruby_xml_ns.c +14 -3
- data/ext/libxml/ruby_xml_parser.c +164 -1398
- data/ext/libxml/ruby_xml_parser.h +5 -17
- data/ext/libxml/ruby_xml_parser_context.c +131 -169
- data/ext/libxml/ruby_xml_parser_context.h +2 -9
- data/ext/libxml/ruby_xml_reader.c +910 -945
- data/ext/libxml/ruby_xml_relaxng.c +32 -3
- data/ext/libxml/ruby_xml_sax_parser.c +106 -364
- data/ext/libxml/ruby_xml_sax_parser.h +1 -37
- data/ext/libxml/ruby_xml_schema.c +174 -145
- data/ext/libxml/ruby_xml_xinclude.c +9 -5
- data/ext/libxml/ruby_xml_xpath.c +25 -6
- data/ext/libxml/ruby_xml_xpath.h +1 -2
- data/ext/libxml/ruby_xml_xpath_context.c +17 -19
- data/ext/libxml/ruby_xml_xpath_object.c +60 -56
- data/ext/libxml/ruby_xml_xpointer.c +11 -5
- data/ext/libxml/sax_parser_callbacks.inc +42 -37
- data/ext/libxml/version.h +3 -3
- data/ext/mingw/Rakefile +20 -27
- data/ext/mingw/build.rake +41 -0
- data/{lib → ext/mingw}/libiconv-2.dll +0 -0
- data/ext/mingw/libxml2-2.dll +0 -0
- data/ext/mingw/libxml_ruby.dll.a +0 -0
- data/ext/mingw/libxml_ruby.so +0 -0
- data/ext/vc/libxml_ruby.vcproj +23 -15
- data/lib/libxml.rb +8 -2
- data/lib/libxml/document.rb +16 -4
- data/lib/libxml/error.rb +84 -0
- data/lib/libxml/hpricot.rb +76 -0
- data/lib/libxml/html_parser.rb +61 -0
- data/lib/libxml/node.rb +36 -25
- data/lib/libxml/parser.rb +312 -33
- data/lib/libxml/parser_context.rb +17 -0
- data/lib/libxml/properties.rb +15 -2
- data/lib/libxml/reader.rb +15 -0
- data/lib/libxml/sax_callbacks.rb +179 -0
- data/lib/libxml/sax_parser.rb +42 -0
- data/lib/libxml/tree.rb +1 -2
- data/lib/libxml/xpath_object.rb +12 -0
- data/test/model/atom.xml +4 -0
- data/test/tc_attributes.rb +43 -19
- data/test/tc_document.rb +1 -1
- data/test/tc_document_write.rb +15 -8
- data/test/tc_dtd.rb +36 -20
- data/test/tc_encoding.rb +13 -0
- data/test/tc_error.rb +136 -0
- data/test/tc_node.rb +2 -3
- data/test/tc_node_copy.rb +1 -1
- data/test/tc_node_edit.rb +6 -0
- data/test/tc_ns.rb +18 -0
- data/test/tc_parser.rb +113 -228
- data/test/tc_parser_context.rb +1 -2
- data/test/tc_reader.rb +24 -14
- data/test/tc_relaxng.rb +18 -6
- data/test/tc_sax_parser.rb +48 -13
- data/test/tc_schema.rb +20 -8
- data/test/tc_well_formed.rb +2 -1
- data/test/tc_xml.rb +212 -0
- data/test/tc_xpath.rb +60 -46
- data/test/tc_xpointer.rb +7 -11
- data/test/test_suite.rb +4 -3
- metadata +32 -115
- data/doc/rdoc/classes/LibXML.html +0 -241
- data/doc/rdoc/classes/LibXML/XML.html +0 -185
- data/doc/rdoc/classes/LibXML/XML/Attr.html +0 -1010
- data/doc/rdoc/classes/LibXML/XML/Attributes.html +0 -526
- data/doc/rdoc/classes/LibXML/XML/Document.html +0 -1489
- data/doc/rdoc/classes/LibXML/XML/Dtd.html +0 -213
- data/doc/rdoc/classes/LibXML/XML/Error.html +0 -117
- data/doc/rdoc/classes/LibXML/XML/HTMLParser.html +0 -348
- data/doc/rdoc/classes/LibXML/XML/InputCallbacks.html +0 -160
- data/doc/rdoc/classes/LibXML/XML/NS.html +0 -381
- data/doc/rdoc/classes/LibXML/XML/Node.html +0 -3396
- data/doc/rdoc/classes/LibXML/XML/Node/FailedModify.html +0 -123
- data/doc/rdoc/classes/LibXML/XML/Node/Set.html +0 -440
- data/doc/rdoc/classes/LibXML/XML/Node/SetNamespace.html +0 -123
- data/doc/rdoc/classes/LibXML/XML/Node/UnknownType.html +0 -123
- data/doc/rdoc/classes/LibXML/XML/Parser.html +0 -2239
- data/doc/rdoc/classes/LibXML/XML/Parser/Context.html +0 -1255
- data/doc/rdoc/classes/LibXML/XML/Parser/ParseError.html +0 -123
- data/doc/rdoc/classes/LibXML/XML/Reader.html +0 -2264
- data/doc/rdoc/classes/LibXML/XML/RelaxNG.html +0 -237
- data/doc/rdoc/classes/LibXML/XML/SaxParser.html +0 -415
- data/doc/rdoc/classes/LibXML/XML/Schema.html +0 -308
- data/doc/rdoc/classes/LibXML/XML/State.html +0 -124
- data/doc/rdoc/classes/LibXML/XML/Tree.html +0 -111
- data/doc/rdoc/classes/LibXML/XML/XInclude.html +0 -123
- data/doc/rdoc/classes/LibXML/XML/XInclude/Error.html +0 -117
- data/doc/rdoc/classes/LibXML/XML/XMLParserOptions.html +0 -198
- data/doc/rdoc/classes/LibXML/XML/XPath.html +0 -184
- data/doc/rdoc/classes/LibXML/XML/XPath/Context.html +0 -404
- data/doc/rdoc/classes/LibXML/XML/XPath/InvalidPath.html +0 -172
- data/doc/rdoc/classes/LibXML/XML/XPath/Object.html +0 -627
- data/doc/rdoc/classes/LibXML/XML/XPointer.html +0 -170
- data/doc/rdoc/classes/LibXML/XML/XPointer/Context.html +0 -123
- data/doc/rdoc/classes/LibXML/XML/XPointer/Context/InvalidPath.html +0 -117
- data/doc/rdoc/classes/LibXML/XML/XPointer/InvalidExpression.html +0 -124
- data/doc/rdoc/classes/singleton.html +0 -114
- data/doc/rdoc/created.rid +0 -1
- data/doc/rdoc/files/CHANGES.html +0 -442
- data/doc/rdoc/files/LICENSE.html +0 -133
- data/doc/rdoc/files/README.html +0 -388
- data/doc/rdoc/files/VERSION.html +0 -107
- data/doc/rdoc/files/ext/libxml/cbg_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/libxml_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_attr_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_attributes_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_document_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_dtd_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_html_parser_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_input_cbg_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_node_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_node_set_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_ns_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_parser_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_parser_context_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_reader_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_relaxng_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_sax_parser_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_schema_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_state_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_xinclude_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_xpath_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_xpath_context_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_xpath_object_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_xpointer_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_xpointer_context_c.html +0 -101
- data/doc/rdoc/files/lib/libxml/attr_rb.html +0 -108
- data/doc/rdoc/files/lib/libxml/attributes_rb.html +0 -108
- data/doc/rdoc/files/lib/libxml/document_rb.html +0 -108
- data/doc/rdoc/files/lib/libxml/node_rb.html +0 -108
- data/doc/rdoc/files/lib/libxml/node_set_rb.html +0 -108
- data/doc/rdoc/files/lib/libxml/parser_options_rb.html +0 -107
- data/doc/rdoc/files/lib/libxml/parser_rb.html +0 -101
- data/doc/rdoc/files/lib/libxml/properties_rb.html +0 -108
- data/doc/rdoc/files/lib/libxml/tree_rb.html +0 -107
- data/doc/rdoc/files/lib/libxml_rb.html +0 -124
- data/doc/rdoc/files/lib/xml/libxml_rb.html +0 -124
- data/doc/rdoc/files/lib/xml_rb.html +0 -134
- data/doc/rdoc/fr_class_index.html +0 -62
- data/doc/rdoc/fr_file_index.html +0 -66
- data/doc/rdoc/fr_method_index.html +0 -392
- data/doc/rdoc/index.html +0 -24
- data/doc/rdoc/rdoc-style.css +0 -208
- data/ext/libxml/ruby_xml_node_set.c +0 -172
- data/ext/libxml/ruby_xml_node_set.h +0 -20
- data/ext/libxml/ruby_xml_xpointer_context.c +0 -22
- data/ext/libxml/ruby_xml_xpointer_context.h +0 -18
- data/lib/libxml/node_set.rb +0 -27
- data/lib/libxml2-2.dll +0 -0
- data/lib/libxml_ruby.dll.a +0 -0
- data/lib/libxml_ruby.so +0 -0
- data/test/tc_node_set.rb +0 -24
- data/test/tc_node_set2.rb +0 -37
@@ -1,4 +1,4 @@
|
|
1
|
-
/* $Id: ruby_xml_sax_parser.h
|
1
|
+
/* $Id: ruby_xml_sax_parser.h 544 2008-11-16 09:50:27Z cfis $ */
|
2
2
|
|
3
3
|
/* Please see the LICENSE file for copyright and distribution information */
|
4
4
|
|
@@ -6,51 +6,15 @@
|
|
6
6
|
#define __RUBY_XML_SAX_PARSER__
|
7
7
|
|
8
8
|
extern VALUE cXMLSaxParser;
|
9
|
-
extern VALUE mXMLSaxParserCallbacks;
|
10
|
-
|
11
|
-
/*
|
12
|
-
typedef struct ruby_xml_sax_parser_callbacks {
|
13
|
-
VALUE internalSubset;
|
14
|
-
VALUE isStandalone;
|
15
|
-
VALUE hasInternalSubset;
|
16
|
-
VALUE hasExternalSubset;
|
17
|
-
VALUE resolveEntity;
|
18
|
-
VALUE getEntity;
|
19
|
-
VALUE entityDecl;
|
20
|
-
VALUE notationDecl;
|
21
|
-
VALUE attributeDecl;
|
22
|
-
VALUE elementDecl;
|
23
|
-
VALUE unparsedEntityDecl;
|
24
|
-
VALUE setDocumentLocator;
|
25
|
-
VALUE startDocument;
|
26
|
-
VALUE endDocument;
|
27
|
-
VALUE startElement;
|
28
|
-
VALUE endElement;
|
29
|
-
VALUE reference;
|
30
|
-
VALUE characters;
|
31
|
-
VALUE ignorableWhitespace;
|
32
|
-
VALUE processingInstruction;
|
33
|
-
VALUE comment;
|
34
|
-
VALUE xmlParserWarning;
|
35
|
-
VALUE xmlParserError;
|
36
|
-
VALUE xmlParserFatalError;
|
37
|
-
VALUE getParameterEntity;
|
38
|
-
VALUE cdataBlock;
|
39
|
-
VALUE externalSubset;
|
40
|
-
} ruby_xml_sax_parser_callbacks;
|
41
|
-
*/
|
42
9
|
|
43
10
|
typedef struct ruby_xml_sax_parser {
|
44
11
|
xmlParserCtxtPtr xpc;
|
45
12
|
xmlSAXHandlerPtr xsh;
|
46
|
-
//ruby_xml_sax_parser_callbacks *cbp;
|
47
13
|
VALUE callbackHandler;
|
48
14
|
VALUE filename;
|
49
15
|
VALUE str;
|
50
16
|
} ruby_xml_sax_parser;
|
51
17
|
|
52
|
-
void ruby_xml_sax_parser_free(ruby_xml_sax_parser *rxsp);
|
53
18
|
void ruby_init_xml_sax_parser(void);
|
54
|
-
VALUE ruby_xml_sax_parser_new(VALUE class);
|
55
19
|
|
56
20
|
#endif
|
@@ -1,145 +1,174 @@
|
|
1
|
-
#include "ruby_libxml.h"
|
2
|
-
#include "ruby_xml_schema.h"
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
*
|
29
|
-
*
|
30
|
-
*
|
31
|
-
|
32
|
-
|
33
|
-
VALUE
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
1
|
+
#include "ruby_libxml.h"
|
2
|
+
#include "ruby_xml_schema.h"
|
3
|
+
|
4
|
+
/*
|
5
|
+
* Document-class: LibXML::XML::Schema
|
6
|
+
*
|
7
|
+
* The XML::Schema class is used to prepare XML Schemas for validation of xml
|
8
|
+
* documents.
|
9
|
+
*
|
10
|
+
* Schemas can be created from XML documents, strings or URIs using the
|
11
|
+
* corresponding methods (new for URIs).
|
12
|
+
*
|
13
|
+
* Once a schema is prepared, an XML document can be validated by the
|
14
|
+
* XML::Document#validate_schema method providing the XML::Schema object
|
15
|
+
* as parameter. The method return true if the document validates, false
|
16
|
+
* otherwise.
|
17
|
+
*
|
18
|
+
* Basic usage:
|
19
|
+
*
|
20
|
+
* # parse schema as xml document
|
21
|
+
* schema_document = XML::Document.file('schema.rng')
|
22
|
+
*
|
23
|
+
* # prepare schema for validation
|
24
|
+
* schema = XML::Schema.document(schema_document)
|
25
|
+
*
|
26
|
+
* # parse xml document to be validated
|
27
|
+
* instance = XML::Document.file('instance.xml')
|
28
|
+
*
|
29
|
+
* # validate
|
30
|
+
* instance.validate_schema(schema)
|
31
|
+
*/
|
32
|
+
|
33
|
+
VALUE cXMLSchema;
|
34
|
+
|
35
|
+
// Rdoc needs to know
|
36
|
+
#ifdef RDOC_NEVER_DEFINED
|
37
|
+
mLibXML = rb_define_module("LibXML");
|
38
|
+
mXML = rb_define_module_under(mLibXML, "XML");
|
39
|
+
#endif
|
40
|
+
|
41
|
+
static void
|
42
|
+
ruby_xml_schema_mark(ruby_xml_schema *rxschema) {
|
43
|
+
return;
|
44
|
+
}
|
45
|
+
|
46
|
+
void
|
47
|
+
ruby_xml_schema_free(ruby_xml_schema *rxschema) {
|
48
|
+
if (rxschema->schema != NULL) {
|
49
|
+
xmlSchemaFree(rxschema->schema);
|
50
|
+
rxschema->schema = NULL;
|
51
|
+
}
|
52
|
+
|
53
|
+
ruby_xfree(rxschema);
|
54
|
+
}
|
55
|
+
|
56
|
+
/*
|
57
|
+
* call-seq:
|
58
|
+
* XML::Schema.new(schema_uri) -> schema
|
59
|
+
*
|
60
|
+
* Create a new schema from the specified URI.
|
61
|
+
*/
|
62
|
+
VALUE
|
63
|
+
ruby_xml_schema_init_from_uri(VALUE class, VALUE uri) {
|
64
|
+
xmlSchemaParserCtxtPtr parser;
|
65
|
+
ruby_xml_schema *schema;
|
66
|
+
|
67
|
+
Check_Type(uri, T_STRING);
|
68
|
+
|
69
|
+
parser = xmlSchemaNewParserCtxt(StringValuePtr(uri));
|
70
|
+
schema = ALLOC(ruby_xml_schema);
|
71
|
+
schema->schema = xmlSchemaParse(parser);
|
72
|
+
xmlSchemaFreeParserCtxt(parser);
|
73
|
+
|
74
|
+
return Data_Wrap_Struct(cXMLSchema, ruby_xml_schema_mark, ruby_xml_schema_free, schema);
|
75
|
+
}
|
76
|
+
|
77
|
+
/*
|
78
|
+
* call-seq:
|
79
|
+
* XML::Schema.document(document) -> schema
|
80
|
+
*
|
81
|
+
* Create a new schema from the specified document.
|
82
|
+
*/
|
83
|
+
VALUE
|
84
|
+
ruby_xml_schema_init_from_document(VALUE class, VALUE document) {
|
85
|
+
xmlDocPtr xdoc;
|
86
|
+
ruby_xml_schema *schema;
|
87
|
+
xmlSchemaParserCtxtPtr parser;
|
88
|
+
|
89
|
+
Data_Get_Struct(document, xmlDoc, xdoc);
|
90
|
+
|
91
|
+
parser = xmlSchemaNewDocParserCtxt(xdoc);
|
92
|
+
schema = ALLOC(ruby_xml_schema);
|
93
|
+
schema->schema = xmlSchemaParse(parser);
|
94
|
+
xmlSchemaFreeParserCtxt(parser);
|
95
|
+
|
96
|
+
return Data_Wrap_Struct(cXMLSchema, ruby_xml_schema_mark, ruby_xml_schema_free, schema);
|
97
|
+
}
|
98
|
+
|
99
|
+
/*
|
100
|
+
* call-seq:
|
101
|
+
* XML::Schema.string("schema_data") -> "value"
|
102
|
+
*
|
103
|
+
* Create a new schema using the specified string.
|
104
|
+
*/
|
105
|
+
VALUE
|
106
|
+
ruby_xml_schema_init_from_string(VALUE self, VALUE schema_str) {
|
107
|
+
xmlSchemaParserCtxtPtr parser;
|
108
|
+
ruby_xml_schema *rxschema;
|
109
|
+
|
110
|
+
Check_Type(schema_str, T_STRING);
|
111
|
+
|
112
|
+
parser = xmlSchemaNewMemParserCtxt(StringValuePtr(schema_str), strlen(StringValuePtr(schema_str)));
|
113
|
+
rxschema = ALLOC(ruby_xml_schema);
|
114
|
+
rxschema->schema = xmlSchemaParse(parser);
|
115
|
+
xmlSchemaFreeParserCtxt(parser);
|
116
|
+
|
117
|
+
return Data_Wrap_Struct(cXMLSchema, ruby_xml_schema_mark, ruby_xml_schema_free, rxschema);
|
118
|
+
}
|
119
|
+
|
120
|
+
/* TODO what is this patch doing here?
|
121
|
+
|
122
|
+
xmlSchemaParserCtxtPtr parser;
|
123
|
+
xmlSchemaPtr sptr;
|
124
|
+
xmlSchemaValidCtxtPtr vptr;
|
125
|
+
+ int is_invalid;
|
126
|
+
|
127
|
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &source) == FAILURE) {
|
128
|
+
return;
|
129
|
+
@@ -598,26 +598,24 @@
|
130
|
+
convert_to_string_ex(&source);
|
131
|
+
parser = xmlSchemaNewParserCtxt(Z_STRVAL_P(source));
|
132
|
+
sptr = xmlSchemaParse(parser);
|
133
|
+
break;
|
134
|
+
case SCHEMA_BLOB:
|
135
|
+
convert_to_string_ex(&source);
|
136
|
+
parser = xmlSchemaNewMemParserCtxt(Z_STRVAL_P(source), Z_STRLEN_P(source));
|
137
|
+
sptr = xmlSchemaParse(parser);
|
138
|
+
break;
|
139
|
+
}
|
140
|
+
|
141
|
+
vptr = xmlSchemaNewValidCtxt(sptr);
|
142
|
+
+ is_invalid = xmlSchemaValidateDoc(vptr, (xmlDocPtr) sxe->document->ptr);
|
143
|
+
xmlSchemaFree(sptr);
|
144
|
+
xmlSchemaFreeValidCtxt(vptr);
|
145
|
+
xmlSchemaFreeParserCtxt(parser);
|
146
|
+
|
147
|
+
- if (is_valid) {
|
148
|
+
- RETURN_TRUE;
|
149
|
+
- } else {
|
150
|
+
+ if (is_invalid) {
|
151
|
+
RETURN_FALSE;
|
152
|
+
+ } else {
|
153
|
+
+ RETURN_TRUE;
|
154
|
+
}
|
155
|
+
}
|
156
|
+
}}}
|
157
|
+
@@ -695,7 +693,7 @@
|
158
|
+
{
|
159
|
+
if (!strcmp(method, "xsearch")) {
|
160
|
+
simplexml_ce_xpath_search(INTERNAL_FUNCTION_PARAM_PASSTHRU);
|
161
|
+
-#ifdef xmlSchemaParserCtxtPtr
|
162
|
+
+#ifdef LIBXML_SCHEMAS_ENABLED
|
163
|
+
} else if (!strcmp(method, "validate_schema_file")) {
|
164
|
+
simplexml_ce_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, SCHEMA_FILE);
|
165
|
+
} else if (!strcmp(method, "validate_schema_buffer")) {
|
166
|
+
*/
|
167
|
+
|
168
|
+
void ruby_init_xml_schema(void) {
|
169
|
+
cXMLSchema = rb_define_class_under(mXML, "Schema", rb_cObject);
|
170
|
+
rb_define_singleton_method(cXMLSchema, "new", ruby_xml_schema_init_from_uri, 1);
|
171
|
+
rb_define_singleton_method(cXMLSchema, "from_string", ruby_xml_schema_init_from_string, 1);
|
172
|
+
rb_define_singleton_method(cXMLSchema, "document", ruby_xml_schema_init_from_document, 1);
|
173
|
+
}
|
174
|
+
|
@@ -1,12 +1,17 @@
|
|
1
|
-
/* $Id: ruby_xml_xinclude.c
|
2
|
-
|
3
|
-
/* Please see the LICENSE file for copyright and distribution information */
|
1
|
+
/* $Id: ruby_xml_xinclude.c 566 2008-11-18 06:53:36Z cfis $ */
|
4
2
|
|
5
3
|
#include "ruby_libxml.h"
|
6
4
|
#include "ruby_xml_xinclude.h"
|
7
5
|
|
8
6
|
VALUE cXMLXInclude;
|
9
|
-
|
7
|
+
|
8
|
+
/*
|
9
|
+
* Document-class: LibXML::XML::XInclude
|
10
|
+
*
|
11
|
+
* The ruby bindings do not currently expose libxml's
|
12
|
+
* XInclude fuctionality.
|
13
|
+
*/
|
14
|
+
|
10
15
|
|
11
16
|
// Rdoc needs to know
|
12
17
|
#ifdef RDOC_NEVER_DEFINED
|
@@ -17,5 +22,4 @@ VALUE eXMLXIncludeError;
|
|
17
22
|
void
|
18
23
|
ruby_init_xml_xinclude(void) {
|
19
24
|
cXMLXInclude = rb_define_class_under(mXML, "XInclude", rb_cObject);
|
20
|
-
eXMLXIncludeError = rb_define_class_under(cXMLXInclude, "Error", rb_eRuntimeError);
|
21
25
|
}
|
data/ext/libxml/ruby_xml_xpath.c
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/* $Id: ruby_xml_xpath.c
|
1
|
+
/* $Id: ruby_xml_xpath.c 566 2008-11-18 06:53:36Z cfis $ */
|
2
2
|
|
3
3
|
/* Please see the LICENSE file for copyright and distribution information */
|
4
4
|
|
@@ -25,10 +25,31 @@
|
|
25
25
|
* 'xi' => 'http://www.w3.org/2001/XInclude')
|
26
26
|
*
|
27
27
|
*
|
28
|
-
* === Working With Namespaces
|
28
|
+
* === Working With Default Namespaces
|
29
29
|
*
|
30
30
|
* Finding namespaced elements and attributes can be tricky.
|
31
|
-
* Lets work through
|
31
|
+
* Lets work through an example of a document with a default
|
32
|
+
* namespace:
|
33
|
+
*
|
34
|
+
* <?xml version="1.0" encoding="utf-8"?>
|
35
|
+
* <feed xmlns="http://www.w3.org/2005/Atom">
|
36
|
+
* <title type="text">Phil Bogle's Contacts</title>
|
37
|
+
* </feed>
|
38
|
+
*
|
39
|
+
* To find nodes you must define the atom namespace for
|
40
|
+
* libxml. One way to do this is:
|
41
|
+
*
|
42
|
+
* node = doc.find('atom:title', 'atom:http://www.w3.org/2005/Atom')
|
43
|
+
*
|
44
|
+
* Alternatively, you can register the default namespace like this:
|
45
|
+
*
|
46
|
+
* doc.root.register_default_namespace('atom')
|
47
|
+
* node = doc.find('atom:title')
|
48
|
+
*
|
49
|
+
* === More Complex Namespace Examples
|
50
|
+
*
|
51
|
+
* Lets work through some more complex examples using the
|
52
|
+
* following xml document:
|
32
53
|
*
|
33
54
|
* <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
34
55
|
* <soap:Body>
|
@@ -58,10 +79,9 @@
|
|
58
79
|
* # xpath expression.
|
59
80
|
* doc.find('/soap:Envelope/soap:Body/ns0:getManufacturerNamesResponse/ns0:IDAndNameList/ns1:IdAndName',
|
60
81
|
['ns0:http://services.somewhere.com', 'ns1:http://domain.somewhere.com'])
|
61
|
-
*/
|
82
|
+
*/
|
62
83
|
|
63
84
|
VALUE mXPath;
|
64
|
-
VALUE eXMLXPathInvalidPath;
|
65
85
|
|
66
86
|
// Rdoc needs to know
|
67
87
|
#ifdef RDOC_NEVER_DEFINED
|
@@ -72,7 +92,6 @@ VALUE eXMLXPathInvalidPath;
|
|
72
92
|
void
|
73
93
|
ruby_init_xml_xpath(void) {
|
74
94
|
mXPath = rb_define_module_under(mXML, "XPath");
|
75
|
-
eXMLXPathInvalidPath = rb_define_class_under(mXPath, "InvalidPath", eXMLError);
|
76
95
|
|
77
96
|
rb_define_const(mXPath, "UNDEFINED", INT2NUM(XPATH_UNDEFINED));
|
78
97
|
rb_define_const(mXPath, "NODESET", INT2NUM(XPATH_NODESET));
|