On Wed, 12 Apr 2006 19:02:24 +0100, zdennis <[EMAIL PROTECTED]> wrote:
> Do you like the idea of doing callbacks on specific node types? This
> should be possible with the SAXParser I would assume..but
> maybe I am wrong?
>
Libxml2's SAX parser doesn't (AFAIK?) support this directly, and my
feeling is that we should stick to the thin wrapping plan to maintain
speed for those that don't need that functionality. It would be pretty
easy to implement node-typed callbacks on top of the basic API I guess,
which might be something worth considering either within this project or
in an external one...
In the end I went with the method-taking-block API you suggested (i.e. I
figured out how to do it from C :)), right now the API is looking like
this (some callbacks remain to be implemented, notably xxxxDecl events):
* parser.on_internal_subset { |name, external_id, system_id| ... } =>
nil
* parser.on_is_standalone { || ... } => nil
* parser.on_has_internal_subset { || ... } => nil
* parser.on_has_external_subset { || ... } => nil
* parser.on_start_document { || ... } => nil
* parser.on_start_element { |name, attr_hash| ... } => nil
* parser.on_end_element { |name| ... } => nil
* parser.on_reference { |name| ... } => nil
* parser.on_characters { |chars| ... } => nil
* parser.on_processing_instruction { |target, data| ... } => nil
* parser.on_comment { |msg| ... } => nil
* parser.on_parser_warning { |msg| ... } => nil
* parser.on_parser_error { |msg| ... } => nil
* parser.on_parser_fatal_error { |msg| ... } => nil
* parser.on_cdata_block { |cdata| ... } => nil
* parser.on_external_subset { |name, external_id, system_id| ... } =>
nil
I'll hopefully be committing this later today.
Cheers,
--
Ross Bamford - [EMAIL PROTECTED]
_______________________________________________
libxml-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/libxml-devel