fastxml 0.1.91 → 0.1.92
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/fastxml.c +1 -1
- data/ext/fastxml.o +0 -0
- data/ext/fastxml_attrlist.o +0 -0
- data/ext/fastxml_doc.o +0 -0
- data/ext/fastxml_node.o +0 -0
- data/ext/fastxml_nodelist.c +22 -11
- data/ext/fastxml_nodelist.h +4 -0
- data/ext/fastxml_nodelist.o +0 -0
- data/lib/fastxml_lib.rb +1 -1
- data/specs/basic_parsing_spec.rb +7 -0
- data/specs/fastxml_node_spec.rb +12 -2
- data/specs/fastxml_nodelist_spec.rb +14 -1
- metadata +2 -4
- data/ext/Makefile +0 -153
- data/ext/fastxml.bundle +0 -0
data/ext/fastxml.c
CHANGED
@@ -243,7 +243,7 @@ VALUE fastxml_xpath_search(VALUE self, VALUE raw_xpath, VALUE blk)
|
|
243
243
|
if (root->ns != NULL) { // we have a base namespace, this is going to get "interesting"
|
244
244
|
root_ns = (xmlChar*)root->ns->prefix;
|
245
245
|
if (root_ns == NULL)
|
246
|
-
root_ns = (xmlChar*)"
|
246
|
+
root_ns = (xmlChar*)"__myFunkyLittleRootNsNotToBeUseByAnyoneElseIHope__";
|
247
247
|
// alternatives? how do other xpath processors handle root/default namespaces?
|
248
248
|
|
249
249
|
xmlXPathRegisterNs( xpath_ctx, root_ns, root->ns->href );
|
data/ext/fastxml.o
CHANGED
Binary file
|
data/ext/fastxml_attrlist.o
CHANGED
Binary file
|
data/ext/fastxml_doc.o
CHANGED
Binary file
|
data/ext/fastxml_node.o
CHANGED
Binary file
|
data/ext/fastxml_nodelist.c
CHANGED
@@ -40,12 +40,11 @@ VALUE fastxml_nodelist_length(VALUE self)
|
|
40
40
|
dv = rb_iv_get( self, "@lxml_doc" );
|
41
41
|
Data_Get_Struct( dv, fxml_data_t, data );
|
42
42
|
|
43
|
-
if (data->list_len ==
|
44
|
-
{
|
43
|
+
if (data->list_len == EMPTY_NODELIST) {
|
45
44
|
data->list_len = 0;
|
46
|
-
|
47
|
-
|
48
|
-
{
|
45
|
+
|
46
|
+
cur = data->list;
|
47
|
+
while (cur != NULL) {
|
49
48
|
data->list_len++;
|
50
49
|
cur = cur->next;
|
51
50
|
}
|
@@ -71,14 +70,26 @@ VALUE fastxml_nodelist_obj_to_ary(fxml_data_t *root)
|
|
71
70
|
VALUE fastxml_nodeset_obj_to_ary(fxml_data_t *root)
|
72
71
|
{
|
73
72
|
VALUE ret;
|
74
|
-
xmlNodePtr cur =
|
73
|
+
xmlNodePtr cur, sub = NULL;
|
75
74
|
int i;
|
76
|
-
|
75
|
+
|
77
76
|
ret = rb_ary_new();
|
78
|
-
|
79
|
-
|
80
|
-
|
77
|
+
if (root->xpath_obj->nodesetval->nodeTab != NULL) {
|
78
|
+
cur = *root->xpath_obj->nodesetval->nodeTab;
|
79
|
+
for (i = 0; i < root->list_len; i++) {
|
80
|
+
if (cur->type != XML_ELEMENT_NODE)
|
81
|
+
continue;
|
82
|
+
|
83
|
+
rb_ary_push( ret, fastxml_raw_node_to_obj( cur ) );
|
84
|
+
sub = cur->next;
|
85
|
+
while (sub != NULL) {
|
86
|
+
rb_ary_push( ret, fastxml_raw_node_to_obj( sub ) );
|
87
|
+
sub = sub->next;
|
88
|
+
}
|
89
|
+
cur++;
|
90
|
+
}
|
81
91
|
}
|
92
|
+
|
82
93
|
|
83
94
|
return ret;
|
84
95
|
}
|
@@ -88,7 +99,7 @@ VALUE fastxml_nodelist_gen_list(VALUE self, fxml_data_t *data)
|
|
88
99
|
VALUE lst = rb_iv_get( self, "@list" );
|
89
100
|
|
90
101
|
if (lst == Qnil) {
|
91
|
-
|
102
|
+
if (data->xpath_obj != NULL) {
|
92
103
|
lst = fastxml_nodeset_obj_to_ary( data );
|
93
104
|
rb_iv_set( self, "@list", lst );
|
94
105
|
} else {
|
data/ext/fastxml_nodelist.h
CHANGED
@@ -4,6 +4,10 @@
|
|
4
4
|
|
5
5
|
#ifndef fastxml_nodelist_h
|
6
6
|
#define fastxml_nodelist_h
|
7
|
+
|
8
|
+
#define EMPTY_NODELIST -1
|
9
|
+
#define EMPTY_NODESET -2
|
10
|
+
|
7
11
|
RUBY_EXTERN VALUE fastxml_nodelist_initialize(VALUE self);
|
8
12
|
RUBY_EXTERN VALUE fastxml_nodelist_inspect(VALUE self);
|
9
13
|
RUBY_EXTERN VALUE fastxml_nodelist_length(VALUE self);
|
data/ext/fastxml_nodelist.o
CHANGED
Binary file
|
data/lib/fastxml_lib.rb
CHANGED
data/specs/basic_parsing_spec.rb
CHANGED
@@ -45,4 +45,11 @@ describe FastXml::Doc, " when created" do
|
|
45
45
|
doc.root.children.should_not be_nil
|
46
46
|
end
|
47
47
|
|
48
|
+
it 'should be able to process io from open' do
|
49
|
+
doc = FastXml( open( "./test_data/hasno_feed.xml" ) )
|
50
|
+
doc.should_not be_nil
|
51
|
+
doc.to_s.should_not be_nil
|
52
|
+
doc.to_s.length.should >= 200
|
53
|
+
end
|
54
|
+
|
48
55
|
end
|
data/specs/fastxml_node_spec.rb
CHANGED
@@ -23,7 +23,8 @@ describe FastXml::Node, ' functionality' do
|
|
23
23
|
(@node/"feed").length.should >= 1
|
24
24
|
(@node/"feed").length.should == @node.search( '/feed' ).length
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
|
+
|
27
28
|
it 'should provide a children accessor' do
|
28
29
|
@node.should respond_to( :children )
|
29
30
|
@node.children.should_not be_nil
|
@@ -37,6 +38,15 @@ describe FastXml::Node, ' functionality' do
|
|
37
38
|
it 'should provide a to_s method' do
|
38
39
|
@node.should respond_to( :to_s )
|
39
40
|
@node.to_s.should_not be_nil
|
41
|
+
@node.to_s.length.should > 0
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should provide valid nodes from searches' do
|
45
|
+
entries = @node.search( '//entry' )
|
46
|
+
entries.should_not be_nil
|
47
|
+
entries.length.should > 0
|
48
|
+
entries.first.should_not be_nil
|
49
|
+
entries.first.to_s.should_not be_nil
|
40
50
|
end
|
41
51
|
|
42
52
|
it 'should provide an inspect method' do
|
@@ -107,4 +117,4 @@ describe FastXml::Node, ' functionality' do
|
|
107
117
|
@node.content.should_not be_nil
|
108
118
|
@node.content.should == "test"
|
109
119
|
end
|
110
|
-
end
|
120
|
+
end
|
@@ -42,5 +42,18 @@ describe FastXml::NodeList, ' functionality' do
|
|
42
42
|
@list.inspect.should_not be_nil
|
43
43
|
end
|
44
44
|
|
45
|
+
it 'should provide a first method' do
|
46
|
+
@list.should respond_to( :first )
|
47
|
+
@list.first.should_not be_nil
|
48
|
+
@list.first.should == @list[0]
|
49
|
+
@list.first.to_s.should == @list[0].to_s
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should provide a last method' do
|
53
|
+
@list.should respond_to( :last )
|
54
|
+
@list.last.should_not be_nil
|
55
|
+
@list.last.should == @list[-1]
|
56
|
+
@list.last.to_s.should == @list[-1].to_s
|
57
|
+
end
|
45
58
|
|
46
|
-
end
|
59
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastxml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.92
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Guzman
|
@@ -9,7 +9,7 @@ autorequire: fastxml
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-05-
|
12
|
+
date: 2008-05-12 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -51,7 +51,6 @@ extra_rdoc_files:
|
|
51
51
|
files:
|
52
52
|
- lib/fastxml_lib.rb
|
53
53
|
- ext/extconf.rb
|
54
|
-
- ext/fastxml.bundle
|
55
54
|
- ext/fastxml.c
|
56
55
|
- ext/fastxml.h
|
57
56
|
- ext/fastxml.o
|
@@ -67,7 +66,6 @@ files:
|
|
67
66
|
- ext/fastxml_nodelist.c
|
68
67
|
- ext/fastxml_nodelist.h
|
69
68
|
- ext/fastxml_nodelist.o
|
70
|
-
- ext/Makefile
|
71
69
|
- ext/mkmf.log
|
72
70
|
- test_data/cnn_main.html
|
73
71
|
- test_data/hasno_feed.html
|
data/ext/Makefile
DELETED
@@ -1,153 +0,0 @@
|
|
1
|
-
|
2
|
-
SHELL = /bin/sh
|
3
|
-
|
4
|
-
#### Start of system configuration section. ####
|
5
|
-
|
6
|
-
srcdir = .
|
7
|
-
topdir = /opt/local/lib/ruby/1.8/i686-darwin9.2.2
|
8
|
-
hdrdir = $(topdir)
|
9
|
-
VPATH = $(srcdir):$(topdir):$(hdrdir)
|
10
|
-
prefix = $(DESTDIR)/opt/local
|
11
|
-
exec_prefix = $(prefix)
|
12
|
-
sitedir = $(prefix)/lib/ruby/site_ruby
|
13
|
-
rubylibdir = $(libdir)/ruby/$(ruby_version)
|
14
|
-
docdir = $(datarootdir)/doc/$(PACKAGE)
|
15
|
-
dvidir = $(docdir)
|
16
|
-
datarootdir = $(prefix)/share
|
17
|
-
archdir = $(rubylibdir)/$(arch)
|
18
|
-
sbindir = $(exec_prefix)/sbin
|
19
|
-
psdir = $(docdir)
|
20
|
-
vendordir = $(prefix)/lib/ruby/vendor_ruby
|
21
|
-
localedir = $(datarootdir)/locale
|
22
|
-
htmldir = $(docdir)
|
23
|
-
datadir = $(datarootdir)
|
24
|
-
includedir = $(prefix)/include
|
25
|
-
infodir = $(datarootdir)/info
|
26
|
-
sysconfdir = $(prefix)/etc
|
27
|
-
mandir = $(DESTDIR)/opt/local/share/man
|
28
|
-
libdir = $(exec_prefix)/lib
|
29
|
-
sharedstatedir = $(prefix)/com
|
30
|
-
oldincludedir = $(DESTDIR)/usr/include
|
31
|
-
pdfdir = $(docdir)
|
32
|
-
sitearchdir = $(sitelibdir)/$(sitearch)
|
33
|
-
vendorarchdir = $(vendorlibdir)/$(vendorarch)
|
34
|
-
bindir = $(exec_prefix)/bin
|
35
|
-
localstatedir = $(prefix)/var
|
36
|
-
vendorlibdir = $(vendordir)/$(ruby_version)
|
37
|
-
sitelibdir = $(sitedir)/$(ruby_version)
|
38
|
-
libexecdir = $(exec_prefix)/libexec
|
39
|
-
|
40
|
-
CC = /usr/bin/gcc-4.0
|
41
|
-
LIBRUBY = $(LIBRUBY_SO)
|
42
|
-
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
43
|
-
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
|
44
|
-
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
|
45
|
-
|
46
|
-
RUBY_EXTCONF_H =
|
47
|
-
CFLAGS = -fno-common -O2 -fno-common -pipe -fno-common -Wall -I/opt/local/include/libxml2
|
48
|
-
INCFLAGS = -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin9.2.2 -I. -I/usr/include/libxml2
|
49
|
-
CPPFLAGS = -I/opt/local/include
|
50
|
-
CXXFLAGS = $(CFLAGS)
|
51
|
-
DLDFLAGS = -L. -L/opt/local/lib -L/opt/local/lib -lxml2 -lz -lpthread -liconv -lm
|
52
|
-
LDSHARED = cc -dynamic -bundle -undefined suppress -flat_namespace
|
53
|
-
AR = ar
|
54
|
-
EXEEXT =
|
55
|
-
|
56
|
-
RUBY_INSTALL_NAME = ruby
|
57
|
-
RUBY_SO_NAME = ruby
|
58
|
-
arch = i686-darwin9.2.2
|
59
|
-
sitearch = i686-darwin9.2.2
|
60
|
-
vendorarch = i686-darwin9.2.2
|
61
|
-
ruby_version = 1.8
|
62
|
-
ruby = /opt/local/bin/ruby
|
63
|
-
RUBY = $(ruby)
|
64
|
-
RM = rm -f
|
65
|
-
MAKEDIRS = mkdir -p
|
66
|
-
INSTALL = /usr/bin/install
|
67
|
-
INSTALL_PROG = $(INSTALL) -m 0755
|
68
|
-
INSTALL_DATA = $(INSTALL) -m 644
|
69
|
-
COPY = cp
|
70
|
-
|
71
|
-
#### End of system configuration section. ####
|
72
|
-
|
73
|
-
preload =
|
74
|
-
|
75
|
-
libpath = . $(libdir)
|
76
|
-
LIBPATH = -L"." -L"$(libdir)"
|
77
|
-
DEFFILE =
|
78
|
-
|
79
|
-
CLEANFILES = mkmf.log
|
80
|
-
DISTCLEANFILES =
|
81
|
-
|
82
|
-
extout =
|
83
|
-
extout_prefix =
|
84
|
-
target_prefix =
|
85
|
-
LOCAL_LIBS =
|
86
|
-
LIBS = $(LIBRUBYARG_SHARED) -lxslt -lxslt -lxml2 -lxml2 -lpthread -ldl -lobjc
|
87
|
-
SRCS = fastxml.c fastxml_attrlist.c fastxml_doc.c fastxml_node.c fastxml_nodelist.c
|
88
|
-
OBJS = fastxml.o fastxml_attrlist.o fastxml_doc.o fastxml_node.o fastxml_nodelist.o
|
89
|
-
TARGET = fastxml
|
90
|
-
DLLIB = $(TARGET).bundle
|
91
|
-
EXTSTATIC =
|
92
|
-
STATIC_LIB =
|
93
|
-
|
94
|
-
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
95
|
-
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
96
|
-
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
97
|
-
|
98
|
-
TARGET_SO = $(DLLIB)
|
99
|
-
CLEANLIBS = $(TARGET).bundle $(TARGET).il? $(TARGET).tds $(TARGET).map
|
100
|
-
CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
|
101
|
-
|
102
|
-
all: $(DLLIB)
|
103
|
-
static: $(STATIC_LIB)
|
104
|
-
|
105
|
-
clean:
|
106
|
-
@-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
|
107
|
-
|
108
|
-
distclean: clean
|
109
|
-
@-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
110
|
-
@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
111
|
-
|
112
|
-
realclean: distclean
|
113
|
-
install: install-so install-rb
|
114
|
-
|
115
|
-
install-so: $(RUBYARCHDIR)
|
116
|
-
install-so: $(RUBYARCHDIR)/$(DLLIB)
|
117
|
-
$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
|
118
|
-
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
119
|
-
install-rb: pre-install-rb install-rb-default
|
120
|
-
install-rb-default: pre-install-rb-default
|
121
|
-
pre-install-rb: Makefile
|
122
|
-
pre-install-rb-default: Makefile
|
123
|
-
$(RUBYARCHDIR):
|
124
|
-
$(MAKEDIRS) $@
|
125
|
-
|
126
|
-
site-install: site-install-so site-install-rb
|
127
|
-
site-install-so: install-so
|
128
|
-
site-install-rb: install-rb
|
129
|
-
|
130
|
-
.SUFFIXES: .c .m .cc .cxx .cpp .C .o
|
131
|
-
|
132
|
-
.cc.o:
|
133
|
-
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
134
|
-
|
135
|
-
.cxx.o:
|
136
|
-
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
137
|
-
|
138
|
-
.cpp.o:
|
139
|
-
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
140
|
-
|
141
|
-
.C.o:
|
142
|
-
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
143
|
-
|
144
|
-
.c.o:
|
145
|
-
$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
|
146
|
-
|
147
|
-
$(DLLIB): $(OBJS)
|
148
|
-
@-$(RM) $@
|
149
|
-
$(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
$(OBJS): ruby.h defines.h
|
data/ext/fastxml.bundle
DELETED
Binary file
|