| Class | LibXML::XML::Parser |
| In: |
ext/libxml/libxml.c
lib/libxml/parser.rb |
| Parent: | Object |
| LIBXML_VERSION | = | rb_str_new2(LIBXML_DOTTED_VERSION) | Constants | |
| VERSION | = | rb_str_new2(RUBY_LIBXML_VERSION) | ||
| VERNUM | = | INT2NUM(RUBY_LIBXML_VERNUM) |
| error_handler | [R] |
Dump the parser resource catalogs to stdout.
/*
* call-seq:
* XML::Parser.catalog_dump -> true
*
* Dump the parser resource catalogs to stdout.
*/
VALUE
ruby_xml_parser_catalog_dump(VALUE self) {
Remove the specified resource catalog.
/*
* call-seq:
* XML::Parser.catalog_remove(catalog) -> true
*
* Remove the specified resource catalog.
*/
VALUE
ruby_xml_parser_catalog_remove(VALUE self, VALUE cat) {
Check LIBXML version matches version the bindings were compiled to. Throws an exception if not.
/*
* call-seq:
* XML::Parser.check_lib_versions -> true
*
* Check LIBXML version matches version the bindings
* were compiled to. Throws an exception if not.
*/
VALUE
ruby_xml_parser_check_lib_versions(VALUE class) {
Determine whether included-entity debugging is enabled. (Requires Libxml to be compiled with debugging support)
/*
* call-seq:
* XML::Parser.debug_entities -> (true|false)
*
* Determine whether included-entity debugging is enabled.
* (Requires Libxml to be compiled with debugging support)
*/
VALUE
ruby_xml_parser_debug_entities_get(VALUE class) {
Enable or disable included-entity debugging. (Requires Libxml to be compiled with debugging support)
/*
* call-seq:
* XML::Parser.debug_entities = true|false
*
* Enable or disable included-entity debugging.
* (Requires Libxml to be compiled with debugging support)
*/
VALUE
ruby_xml_parser_debug_entities_set(VALUE class, VALUE bool) {
Determine whether parsers use Zlib compression by default (requires libxml to be compiled with Zlib support).
/*
* call-seq:
* XML::Parser.default_compression -> (true|false)
*
* Determine whether parsers use Zlib compression by default
* (requires libxml to be compiled with Zlib support).
*/
VALUE
ruby_xml_parser_default_compression_get(VALUE class) {
Controls whether parsers use Zlib compression by default (requires libxml to be compiled with Zlib support).
/*
* call-seq:
* XML::Parser.default_compression = true|false
*
* Controls whether parsers use Zlib compression by default
* (requires libxml to be compiled with Zlib support).
*/
VALUE
ruby_xml_parser_default_compression_set(VALUE class, VALUE num) {
Determine whether parsers retain whitespace by default.
/*
* call-seq:
* XML::Parser.default_keep_blanks -> (true|false)
*
* Determine whether parsers retain whitespace by default.
*/
VALUE
ruby_xml_parser_default_keep_blanks_get(VALUE class) {
Controls whether parsers retain whitespace by default.
/*
* call-seq:
* XML::Parser.default_keep_blanks = true|false
*
* Controls whether parsers retain whitespace by default.
*/
VALUE
ruby_xml_parser_default_keep_blanks_set(VALUE class, VALUE bool) {
Determine whether parsers retain line-numbers by default.
/*
* call-seq:
* XML::Parser.default_line_numbers -> (true|false)
*
* Determine whether parsers retain line-numbers by default.
*/
VALUE
ruby_xml_parser_default_line_numbers_get(VALUE class) {
Controls whether parsers retain line-numbers by default.
/*
* call-seq:
* XML::Parser.default_line_numbers = true|false
*
* Controls whether parsers retain line-numbers by default.
*/
VALUE
ruby_xml_parser_default_line_numbers_set(VALUE class, VALUE bool) {
Determine whether parsers load external DTDs by default.
/*
* call-seq:
* XML::Parser.default_load_external_dtd -> (true|false)
*
* Determine whether parsers load external DTDs by default.
*/
VALUE
ruby_xml_parser_default_load_external_dtd_get(VALUE class) {
Controls whether parsers load external DTDs by default.
/*
* call-seq:
* XML::Parser.default_load_external_dtd = true|false
*
* Controls whether parsers load external DTDs by default.
*/
VALUE
ruby_xml_parser_default_load_external_dtd_set(VALUE class, VALUE bool) {
Determine whether parsers are pedantic by default.
/*
* call-seq:
* XML::Parser.default_pedantic_parser -> (true|false)
*
* Determine whether parsers are pedantic by default.
*/
VALUE
ruby_xml_parser_default_pedantic_parser_get(VALUE class) {
Controls whether parsers are pedantic by default.
/*
* call-seq:
* XML::Parser.default_pedantic_parser = true|false
*
* Controls whether parsers are pedantic by default.
*/
VALUE
ruby_xml_parser_default_pedantic_parser_set(VALUE class, VALUE bool) {
Determine whether parsers perform inline entity substitution (for external entities) by default.
/*
* call-seq:
* XML::Parser.default_substitute_entities -> (true|false)
*
* Determine whether parsers perform inline entity substitution
* (for external entities) by default.
*/
VALUE
ruby_xml_parser_default_substitute_entities_get(VALUE class) {
Controls whether parsers perform inline entity substitution (for external entities) by default.
/*
* call-seq:
* XML::Parser.default_substitute_entities = true|false
*
* Controls whether parsers perform inline entity substitution
* (for external entities) by default.
*/
VALUE
ruby_xml_parser_default_substitute_entities_set(VALUE class, VALUE bool) {
Set the default string used by parsers to indent the XML tree for output.
/*
* call-seq:
* XML::Parser.default_tree_indent_string = "string"
*
* Set the default string used by parsers to indent the XML tree
* for output.
*/
VALUE
ruby_xml_parser_default_tree_indent_string_set(VALUE class, VALUE string) {
Determine whether parsers output warnings by default.
/*
* call-seq:
* XML::Parser.default_warnings -> (true|false)
*
* Determine whether parsers output warnings by default.
*/
VALUE
ruby_xml_parser_default_warnings_get(VALUE class) {
Controls whether parsers output warnings by default.
/*
* call-seq:
* XML::Parser.default_warnings = true|false
*
* Controls whether parsers output warnings by default.
*/
VALUE
ruby_xml_parser_default_warnings_set(VALUE class, VALUE bool) {
Determine whether libxml regexp automata support is enabled.
/*
* call-seq:
* XML::Parser.enabled_automata? -> (true|false)
*
* Determine whether libxml regexp automata support is enabled.
*/
VALUE
ruby_xml_parser_enabled_automata_q(VALUE class) {
Determine whether libxml ‘canonical XML’ support is enabled. See "Canonical XML" (www.w3.org/TR/xml-c14n)
/*
* call-seq:
* XML::Parser.enabled_c14n? -> (true|false)
*
* Determine whether libxml 'canonical XML' support is enabled.
* See "Canonical XML" (http://www.w3.org/TR/xml-c14n)
*/
VALUE
ruby_xml_parser_enabled_c14n_q(VALUE class) {
Determine whether libxml resource catalog support is enabled.
/*
* call-seq:
* XML::Parser.enabled_catalog? -> (true|false)
*
* Determine whether libxml resource catalog support is enabled.
*/
VALUE
ruby_xml_parser_enabled_catalog_q(VALUE class) {
Determine whether libxml debugging support is enabled.
/*
* call-seq:
* XML::Parser.enabled_debug? -> (true|false)
*
* Determine whether libxml debugging support is enabled.
*/
VALUE
ruby_xml_parser_enabled_debug_q(VALUE class) {
Determine whether libxml docbook support is enabled.
/*
* call-seq:
* XML::Parser.enabled_docbook? -> (true|false)
*
* Determine whether libxml docbook support is enabled.
*/
VALUE
ruby_xml_parser_enabled_docbook_q(VALUE class) {
Determine whether libxml ftp client support is enabled.
/*
* call-seq:
* XML::Parser.enabled_ftp? -> (true|false)
*
* Determine whether libxml ftp client support is enabled.
*/
VALUE
ruby_xml_parser_enabled_ftp_q(VALUE class) {
Determine whether libxml html support is enabled.
/*
* call-seq:
* XML::Parser.enabled_html? -> (true|false)
*
* Determine whether libxml html support is enabled.
*/
VALUE
ruby_xml_parser_enabled_html_q(VALUE class) {
Determine whether libxml http client support is enabled.
/*
* call-seq:
* XML::Parser.enabled_http? -> (true|false)
*
* Determine whether libxml http client support is enabled.
*/
VALUE
ruby_xml_parser_enabled_http_q(VALUE class) {
Determine whether libxml iconv support is enabled.
/*
* call-seq:
* XML::Parser.enabled_iconv? -> (true|false)
*
* Determine whether libxml iconv support is enabled.
*/
VALUE
ruby_xml_parser_enabled_iconv_q(VALUE class) {
Determine whether libxml memory location debugging support is enabled.
/*
* call-seq:
* XML::Parser.enabled_memory_debug? -> (true|false)
*
* Determine whether libxml memory location debugging support
* is enabled.
*/
VALUE
ruby_xml_parser_enabled_memory_debug_location_q(VALUE class) {
Determine whether libxml regular expression support is enabled.
/*
* call-seq:
* XML::Parser.enabled_regexp? -> (true|false)
*
* Determine whether libxml regular expression support is enabled.
*/
VALUE
ruby_xml_parser_enabled_regexp_q(VALUE class) {
Determine whether libxml schema support is enabled.
/*
* call-seq:
* XML::Parser.enabled_schemas? -> (true|false)
*
* Determine whether libxml schema support is enabled.
*/
VALUE
ruby_xml_parser_enabled_schemas_q(VALUE class) {
Determine whether libxml thread-safe semantics support is enabled (I think?).
/*
* call-seq:
* XML::Parser.enabled_thread? -> (true|false)
*
* Determine whether libxml thread-safe semantics support
* is enabled (I think?).
*/
VALUE
ruby_xml_parser_enabled_thread_q(VALUE class) {
Determine whether libxml unicode support is enabled.
/*
* call-seq:
* XML::Parser.enabled_unicode? -> (true|false)
*
* Determine whether libxml unicode support is enabled.
*/
VALUE
ruby_xml_parser_enabled_unicode_q(VALUE class) {
Determine whether libxml xinclude support is enabled.
/*
* call-seq:
* XML::Parser.enabled_xinclude? -> (true|false)
*
* Determine whether libxml xinclude support is enabled.
*/
VALUE
ruby_xml_parser_enabled_xinclude_q(VALUE class) {
Determine whether libxml xpath support is enabled.
/*
* call-seq:
* XML::Parser.enabled_xpath? -> (true|false)
*
* Determine whether libxml xpath support is enabled.
*/
VALUE
ruby_xml_parser_enabled_xpath_q(VALUE class) {
Determine whether libxml xpointer support is enabled.
/*
* call-seq:
* XML::Parser.enabled_xpointer? -> (true|false)
*
* Determine whether libxml xpointer support is enabled.
*/
VALUE
ruby_xml_parser_enabled_xpointer_q(VALUE class) {
Determine whether libxml zlib support is enabled.
/*
* call-seq:
* XML::Parser.enabled_zlib? -> (true|false)
*
* Determine whether libxml zlib support is enabled.
*/
VALUE
ruby_xml_parser_enabled_zlib_q(VALUE class) {
Obtains an array of strings representing features supported (and enabled) by the installed libxml.
/*
* call-seq:
* XML::Parser.features -> ["feature", ..., "feature"]
*
* Obtains an array of strings representing features supported
* (and enabled) by the installed libxml.
*/
VALUE
ruby_xml_parser_features(VALUE class) {
Determines whether XML output will be indented (using the string supplied to default_indent_tree_string)
/*
* call-seq:
* XML::Parser.indent_tree_output -> (true|false)
*
* Determines whether XML output will be indented
* (using the string supplied to +default_indent_tree_string+)
*/
VALUE
ruby_xml_parser_indent_tree_output_get(VALUE class) {
Controls whether XML output will be indented (using the string supplied to default_indent_tree_string)
/*
* call-seq:
* XML::Parser.indent_tree_output = true|false
*
* Controls whether XML output will be indented
* (using the string supplied to +default_indent_tree_string+)
*/
VALUE
ruby_xml_parser_indent_tree_output_set(VALUE class, VALUE bool) {
Perform a parser memory dump (requires memory debugging support in libxml).
/*
* call-seq:
* XML::Parser.memory_dump -> (true|false)
*
* Perform a parser memory dump (requires memory debugging
* support in libxml).
*/
VALUE
ruby_xml_parser_memory_dump(VALUE self) {
Perform a parser memory dump (requires memory debugging support in libxml).
/*
* call-seq:
* XML::Parser.memory_used -> num_bytes
*
* Perform a parser memory dump (requires memory debugging
* support in libxml).
*/
VALUE
ruby_xml_parser_memory_used(VALUE self) {
Register the attached block as the handler for parser errors.
Parser.register_error_handler {|msg| <do stuff>} Parser.register_error_handler(lambda {|msg| <do stuff>}) Parser.register_error_handler(nil)
A message describing parse errors is passed to the block. Libxml passes error messages to the handler in parts, one per call. A typical error results in six calls to this proc, with arguments:
"Entity: line 1: ", "parser ", "error : ", "Opening and ending tag mismatch: foo line 1 and foz\n", "<foo><bar/></foz>\n", " ^\n"
Note that the error handler is shared by all threads.
# File lib/libxml/parser.rb, line 25
25: def register_error_handler(value = nil, &block)
26: # Value may be nil or a proc.
27: tmp = self.error_handler
28: @error_handler = block_given? ? block : value
29: tmp
30: end
# File lib/libxml/parser.rb, line 32
32: def xml_error_func_handler(msg)
33: if not self.error_handler
34: $stderr.puts(msg)
35: else
36: self.error_handler.call(msg)
37: end
38: end
Obtain the XML::Parser::Context associated with this parser.
/*
* call-seq:
* parser.context -> context
*
* Obtain the XML::Parser::Context associated with this
* parser.
*/
VALUE
ruby_xml_parser_context_get(VALUE self) {
Obtain the IO instance this parser works with.
/*
* call-seq:
* parser.io -> IO
*
* Obtain the IO instance this parser works with.
*/
VALUE
ruby_xml_parser_io_get(VALUE self, VALUE io) {
Set the IO instance this parser works with.
/*
* call-seq:
* parser.io = IO
*
* Set the IO instance this parser works with.
*/
VALUE
ruby_xml_parser_io_set(VALUE self, VALUE io) {
Parse the input XML and create an XML::Document with it‘s content. If an error occurs, XML::Parser::ParseError is thrown.
/*
* call-seq:
* parser.parse -> document
*
* Parse the input XML and create an XML::Document with
* it's content. If an error occurs, XML::Parser::ParseError
* is thrown.
*/
VALUE
ruby_xml_parser_parse(VALUE self) {