Permalink
Browse files

a little more tonight

  • Loading branch information...
1 parent 72c4ae1 commit 8a9412a8bb1f2ce184b1a9ef6f89d32c7523a1c2 Peter Ohler committed Sep 11, 2011
Showing with 15 additions and 7 deletions.
  1. +6 −7 ext/ox/sax.c
  2. +1 −0 test/basic.xml
  3. +8 −0 test/sax.rb
View
@@ -78,7 +78,7 @@ ox_sax_parse(VALUE handler, VALUE io) {
char c;
sax_drive_init(&dr, handler, io);
-
+#if 0
printf("*** sax_parse with these flags\n");
printf(" has_instruct = %s\n", dr.has_instruct ? "true" : "false");
printf(" has_doctype = %s\n", dr.has_doctype ? "true" : "false");
@@ -88,7 +88,7 @@ ox_sax_parse(VALUE handler, VALUE io) {
printf(" has_start_element = %s\n", dr.has_start_element ? "true" : "false");
printf(" has_end_element = %s\n", dr.has_end_element ? "true" : "false");
printf(" has_error = %s\n", dr.has_error ? "true" : "false");
-
+#endif
while (0 != (c = sax_drive_get(&dr))) {
printf("%c", c);
}
@@ -132,7 +132,7 @@ sax_drive_read(SaxDrive dr) {
// if no room for more then alloc more space
err = dr->read_func(dr); // TBD temporary
- printf("*** '%s'\n", dr->buf);
+ printf("*** sax_drive_read: '%s'\n", dr->buf);
return err;
}
@@ -161,10 +161,9 @@ read_from_io(SaxDrive dr) {
int ex = 0;
rb_protect(io_cb, (VALUE)dr, &ex);
- printf("*** io_cb exception = %d\n", ex);
- // TBD check for EOF error and return -1 if EOF else raise something else
-
- return 0;
+ // printf("*** io_cb exception = %d\n", ex);
+ // An error code of 6 is always returned not matter what kind of Exception is raised.
+ return ex;
}
static int
View
@@ -0,0 +1 @@
+<top/>
View
@@ -50,5 +50,13 @@ def test_sax_io_pipe
puts ms
end
+ def test_sax_io_file
+ ms = MySax.new()
+ input = IO.open(IO.sysopen('basic.xml'))
+ Ox.sax_parse(ms, input)
+ input.close
+ puts ms
+ end
+
end

0 comments on commit 8a9412a

Please sign in to comment.