Class: LibXML::XML::Parser::Context
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Subclasses:
|
|
Inherits: | Object |
Defined in: | ext/libxml/ruby_xml_parser_context.c, ext/libxml/ruby_xml_parser_context.c |
Overview
The Context
class provides in-depth control over how a document is parsed.
Class Method Summary
-
XML::Parser::Context.document(document) ⇒ Context
Creates a new parser context based on the specified document.
-
XML::Parser::Context.file(file) ⇒ Context
Creates a new parser context based on the specified file or uri.
-
XML::Parser::Context.io(io) ⇒ Context
Creates a new parser context based on the specified io object.
-
XML::Parser::Context.string(string) ⇒ Context
Creates a new parser context based on the specified string.
Instance Attribute Summary
-
#base_uri ⇒ "http:://libxml.org"
rw
Obtain the base url for this parser context.
-
#base_uri=("http:://libxml.org")
rw
Sets the base url for this parser context.
-
#disable_cdata=(true|false)
rw
Control whether CDATA nodes will be created in this context.
-
#disable_cdata? ⇒ Boolean
rw
Determine whether CDATA nodes will be created in this context.
-
#disable_sax? ⇒ Boolean
readonly
Determine whether SAX-based processing is disabled in this context.
-
#docbook? ⇒ Boolean
readonly
Determine whether this is a docbook context.
-
#encoding ⇒ XML::Encoding::UTF_8
rw
Obtain the character encoding identifier used in this context.
-
#encoding=(XML::Encoding::UTF_8)
rw
Sets the character encoding for this context.
-
#html? ⇒ Boolean
readonly
Determine whether this is an html context.
-
#keep_blanks? ⇒ Boolean
readonly
Determine whether parsers in this context retain whitespace.
-
#>(XML)
rw
Returns the parser options for this context.
-
#options=(XML::Parser::Options::NOENT |)
rw
Provides control over the execution of a parser.
-
#recovery=(true|false)
rw
Control whether recovery mode is enabled in this context.
-
#recovery? ⇒ Boolean
rw
Determine whether recovery mode is enabled in this context.
-
#replace_entities=(true|false)
rw
Control whether external entity replacement is enabled in this context.
-
#replace_entities? ⇒ Boolean
rw
Determine whether external entity replacement is enabled in this context.
-
#standalone? ⇒ Boolean
readonly
Determine whether this is a standalone context.
-
#stats? ⇒ Boolean
readonly
Determine whether this context maintains statistics.
-
#subset_external? ⇒ Boolean
readonly
Determine whether this context is a subset of an external context.
-
#subset_internal? ⇒ Boolean
readonly
Determine whether this context is a subset of an internal context.
-
#validate? ⇒ Boolean
readonly
Determine whether validation is enabled in this context.
-
#well_formed? ⇒ Boolean
readonly
Determine whether this context contains well-formed
::LibXML::XML
.
Instance Method Summary
-
#close ⇒ nil
Closes the underlying input streams.
-
#data_directory ⇒ "dir"
Obtain the data directory associated with this context.
-
#depth ⇒ Numeric
Obtain the depth of this context.
-
#errno ⇒ Numeric
Obtain the last-error number in this context.
-
#max_num_streams ⇒ Numeric
Obtain the limit on the number of IO streams opened in this context.
-
#num_streams ⇒ "dir"
Obtain the actual number of IO streams in this context.
-
#name_depth ⇒ Numeric
Obtain the name depth for this context.
-
#name_depth_max ⇒ Numeric
Obtain the maximum name depth for this context.
-
#name_node ⇒ "name"
Obtain the name node for this context.
-
#name_tab ⇒ Array, ...
Obtain the name table for this context.
-
#node ⇒ node
Obtain the root node of this context.
-
#node_depth ⇒ Numeric
Obtain the node depth for this context.
-
#node_depth_max ⇒ Numeric
Obtain the maximum node depth for this context.
-
#num_chars ⇒ Numeric
Obtain the number of characters in this context.
-
#space_depth ⇒ Numeric
Obtain the space depth for this context.
-
#space_depth ⇒ Numeric
Obtain the maximum space depth for this context.
-
#subset_external_system_id ⇒ "system_id"
Obtain this context’s external subset system identifier.
-
#subset_external_uri ⇒ "uri"
Obtain this context’s external subset URI.
-
#subset_internal_name ⇒ "name"
Obtain this context’s subset name (valid only if either of subset_external? or subset_internal? is true).
-
#valid? ⇒ Boolean
Determine whether this context is valid.
-
#version ⇒ "version"
Obtain this context’s version identifier.
Class Method Details
XML::Parser::Context.document(document) ⇒ Context
# File 'ext/libxml/ruby_xml_parser_context.c', line 45
static VALUE rxml_parser_context_document(int argc, VALUE* argv, VALUE klass) { VALUE document, options; rb_scan_args(argc, argv, "11", &document, &options); if (rb_obj_is_kind_of(document, cXMLDocument) == Qfalse) rb_raise(rb_eTypeError, "Must pass an LibXML::XML::Document object"); xmlDocPtr xdoc; xmlChar *buffer; int length; Data_Get_Struct(document, xmlDoc, xdoc); xmlDocDumpFormatMemoryEnc(xdoc, &buffer, &length, (const char*)xdoc->encoding, 0); xmlParserCtxtPtr ctxt = xmlCreateDocParserCtxt(buffer); if (!ctxt) rxml_raise(xmlGetLastError()); /* This is annoying, but xmlInitParserCtxt (called indirectly above) and xmlCtxtUseOptionsInternal (called below) initialize slightly different context options, in particular XML_PARSE_NODICT which xmlInitParserCtxt sets to 0 and xmlCtxtUseOptionsInternal sets to 1. So we have to call both. */ xmlCtxtUseOptions(ctxt, options == Qnil ? 0 : NUM2INT(options)); return rxml_parser_context_wrap(ctxt); }
XML::Parser::Context.file(file) ⇒ Context
Creates a new parser context based on the specified file or uri.
Parameters:
file - A filename or uri
- A or'ed together list of LibXML::XML::Parser::Options values
# File 'ext/libxml/ruby_xml_parser_context.c', line 83
static VALUE rxml_parser_context_file(int argc, VALUE* argv, VALUE klass) { VALUE file, options; rb_scan_args(argc, argv, "11", &file, &options); xmlParserCtxtPtr ctxt = xmlCreateURLParserCtxt(StringValuePtr(file), 0); if (!ctxt) rxml_raise(xmlGetLastError()); /* This is annoying, but xmlInitParserCtxt (called indirectly above) and xmlCtxtUseOptionsInternal (called below) initialize slightly different context options, in particular XML_PARSE_NODICT which xmlInitParserCtxt sets to 0 and xmlCtxtUseOptionsInternal sets to 1. So we have to call both. */ xmlCtxtUseOptions(ctxt, options == Qnil ? 0 : NUM2INT(options)); return rxml_parser_context_wrap(ctxt); }
XML::Parser::Context.io(io) ⇒ Context
Creates a new parser context based on the specified io object.
Parameters:
io - A ruby IO object
- A or'ed together list of LibXML::XML::Parser::Options values
# File 'ext/libxml/ruby_xml_parser_context.c', line 146
static VALUE rxml_parser_context_io(int argc, VALUE* argv, VALUE klass) { VALUE io, options; rb_scan_args(argc, argv, "11", &io, &options); if (NIL_P(io)) rb_raise(rb_eTypeError, "Must pass in an IO object"); xmlParserInputBufferPtr input = xmlParserInputBufferCreateIO((xmlInputReadCallback) rxml_read_callback, NULL, (void*)io, XML_CHAR_ENCODING_NONE); xmlParserCtxtPtr ctxt = xmlNewParserCtxt(); if (!ctxt) { xmlFreeParserInputBuffer(input); rxml_raise(xmlGetLastError()); } /* This is annoying, but xmlInitParserCtxt (called indirectly above) and xmlCtxtUseOptionsInternal (called below) initialize slightly different context options, in particular XML_PARSE_NODICT which xmlInitParserCtxt sets to 0 and xmlCtxtUseOptionsInternal sets to 1. So we have to call both. */ xmlCtxtUseOptions(ctxt, options == Qnil ? 0 : NUM2INT(options)); xmlParserInputPtr stream = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE); if (!stream) { xmlFreeParserInputBuffer(input); xmlFreeParserCtxt(ctxt); rxml_raise(xmlGetLastError()); } inputPush(ctxt, stream); VALUE result = rxml_parser_context_wrap(ctxt); /* Attach io object to parser so it won't get freed.*/ rb_ivar_set(result, IO_ATTR, io); return result; }
XML::Parser::Context.string(string) ⇒ Context
Creates a new parser context based on the specified string.
Parameters:
string - A string that contains the data to parse
- A or'ed together list of LibXML::XML::Parser::Options values
# File 'ext/libxml/ruby_xml_parser_context.c', line 112
static VALUE rxml_parser_context_string(int argc, VALUE* argv, VALUE klass) { VALUE string, options; rb_scan_args(argc, argv, "11", &string, &options); Check_Type(string, T_STRING); if (RSTRING_LEN(string) == 0) rb_raise(rb_eArgError, "Must specify a string with one or more characters"); xmlParserCtxtPtr ctxt = xmlCreateMemoryParserCtxt(StringValuePtr(string), (int)RSTRING_LEN(string)); if (!ctxt) rxml_raise(xmlGetLastError()); /* This is annoying, but xmlInitParserCtxt (called indirectly above) and xmlCtxtUseOptionsInternal (called below) initialize slightly different context options, in particular XML_PARSE_NODICT which xmlInitParserCtxt sets to 0 and xmlCtxtUseOptionsInternal sets to 1. So we have to call both. */ xmlCtxtUseOptions(ctxt, options == Qnil ? 0 : NUM2INT(options)); return rxml_parser_context_wrap(ctxt); }
Instance Attribute Details
#base_uri ⇒ "http::
//libxml
.org
" (rw)
Obtain the base url for this parser context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 194
static VALUE rxml_parser_context_base_uri_get(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); if (ctxt->input && ctxt->input->filename) return rxml_new_cstr((const xmlChar*)ctxt->input->filename, ctxt->encoding); else return Qnil; }
#base_uri=("http:://libxml.org") (rw)
Sets the base url for this parser context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 211
static VALUE rxml_parser_context_base_uri_set(VALUE self, VALUE url) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); Check_Type(url, T_STRING); if (ctxt->input && !ctxt->input->filename) { const char* xurl = StringValuePtr(url); ctxt->input->filename = (const char*)xmlStrdup((const xmlChar*)xurl); } return self; }
#disable_cdata=(true|false) (rw)
Control whether CDATA nodes will be created in this context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 302
static VALUE rxml_parser_context_disable_cdata_set(VALUE self, VALUE value) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); if (ctxt->sax == NULL) rb_raise(rb_eRuntimeError, "Sax handler is not yet set"); /* LibXML controls this internally with the default SAX handler. */ if (value) ctxt->sax->cdataBlock = NULL; else ctxt->sax->cdataBlock = xmlSAX2CDataBlock; return value; }
#disable_cdata? ⇒ Boolean
(rw)
Determine whether CDATA nodes will be created in this context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 284
static VALUE rxml_parser_context_disable_cdata_q(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); /* LibXML controls this internally with the default SAX handler. */ if (ctxt->sax && ctxt->sax->cdataBlock) return (Qfalse); else return (Qtrue); }
#disable_sax? ⇒ Boolean
(readonly)
Determine whether SAX-based processing is disabled in this context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 326
static VALUE rxml_parser_context_disable_sax_q(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); if (ctxt->disableSAX) return (Qtrue); else return (Qfalse); }
#docbook? ⇒ Boolean
(readonly)
Determine whether this is a docbook context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 343
static VALUE rxml_parser_context_docbook_q(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); if (ctxt->html == 2) // TODO check this return (Qtrue); else return (Qfalse); }
#encoding ⇒ XML::Encoding::UTF_8 (rw)
Obtain the character encoding identifier used in this context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 361
static VALUE rxml_parser_context_encoding_get(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); return INT2NUM(xmlParseCharEncoding((const char*)ctxt->encoding)); }
#encoding=(XML::Encoding::UTF_8) (rw)
Sets the character encoding for this context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 374
static VALUE rxml_parser_context_encoding_set(VALUE self, VALUE encoding) { xmlParserCtxtPtr ctxt; int result; const char* xencoding = xmlGetCharEncodingName((xmlCharEncoding)NUM2INT(encoding)); xmlCharEncodingHandlerPtr hdlr = xmlFindCharEncodingHandler(xencoding); if (!hdlr) rb_raise(rb_eArgError, "Unknown encoding: %i", NUM2INT(encoding)); Data_Get_Struct(self, xmlParserCtxt, ctxt); result = xmlSwitchToEncoding(ctxt, hdlr); if (result != 0) rxml_raise(xmlGetLastError()); if (ctxt->encoding != NULL) xmlFree((xmlChar *) ctxt->encoding); ctxt->encoding = xmlStrdup((const xmlChar *) xencoding); return self; }
#html? ⇒ Boolean
(readonly)
Determine whether this is an html context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 417
static VALUE rxml_parser_context_html_q(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); if (ctxt->html == 1) return (Qtrue); else return (Qfalse); }
#keep_blanks? ⇒ Boolean
(readonly)
Determine whether parsers in this context retain whitespace.
# File 'ext/libxml/ruby_xml_parser_context.c', line 466
static VALUE rxml_parser_context_keep_blanks_q(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); if (ctxt->keepBlanks) return (Qtrue); else return (Qfalse); }
#>(XML) (rw)
Returns the parser options for this context. Multiple options can be combined by using Bitwise OR (|).
# File 'ext/libxml/ruby_xml_parser_context.c', line 619
static VALUE rxml_parser_context_options_get(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); return INT2NUM(ctxt->options); }
#options=(XML::Parser::Options::NOENT |) (rw)
XML::Parser::Options::NOCDATA
Provides control over the execution of a parser. Valid values are the constants defined on Options
. Multiple options can be combined by using Bitwise OR (|).
# File 'ext/libxml/ruby_xml_parser_context.c', line 636
static VALUE rxml_parser_context_options_set(VALUE self, VALUE options) { xmlParserCtxtPtr ctxt; Check_Type(options, T_FIXNUM); Data_Get_Struct(self, xmlParserCtxt, ctxt); xmlCtxtUseOptions(ctxt, NUM2INT(options)); return self; }
#recovery=(true|false) (rw)
Control whether recovery mode is enabled in this context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 672
static VALUE rxml_parser_context_recovery_set(VALUE self, VALUE value) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); if (value == Qfalse) { ctxt->recovery = 0; return (Qfalse); } else { ctxt->recovery = 1; return (Qtrue); } }
#recovery? ⇒ Boolean
(rw)
Determine whether recovery mode is enabled in this context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 654
static VALUE rxml_parser_context_recovery_q(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); if (ctxt->recovery) return (Qtrue); else return (Qfalse); }
#replace_entities=(true|false) (rw)
Control whether external entity replacement is enabled in this context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 714
static VALUE rxml_parser_context_replace_entities_set(VALUE self, VALUE value) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); if (value == Qfalse) { ctxt->replaceEntities = 0; return (Qfalse); } else { ctxt->replaceEntities = 1; return (Qtrue); } }
#replace_entities? ⇒ Boolean
(rw)
Determine whether external entity replacement is enabled in this context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 696
static VALUE rxml_parser_context_replace_entities_q(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); if (ctxt->replaceEntities) return (Qtrue); else return (Qfalse); }
#standalone? ⇒ Boolean
(readonly)
Determine whether this is a standalone context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 858
static VALUE rxml_parser_context_standalone_q(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); if (ctxt->standalone) return (Qtrue); else return (Qfalse); }
#stats? ⇒ Boolean
(readonly)
Determine whether this context maintains statistics.
# File 'ext/libxml/ruby_xml_parser_context.c', line 875
static VALUE rxml_parser_context_stats_q(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); if (ctxt->record_info) return (Qtrue); else return (Qfalse); }
#subset_external? ⇒ Boolean
(readonly)
Determine whether this context is a subset of an external context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 766
static VALUE rxml_parser_context_subset_external_q(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); if (ctxt->inSubset == 2) return (Qtrue); else return (Qfalse); }
#subset_internal? ⇒ Boolean
(readonly)
Determine whether this context is a subset of an internal context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 784
static VALUE rxml_parser_context_subset_internal_q(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); if (ctxt->inSubset == 1) return (Qtrue); else return (Qfalse); }
#validate? ⇒ Boolean
(readonly)
Determine whether validation is enabled in this context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 909
static VALUE rxml_parser_context_validate_q(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); if (ctxt->validate) return (Qtrue); else return (Qfalse); }
#well_formed? ⇒ Boolean
(readonly)
Determine whether this context contains well-formed ::LibXML::XML
.
# File 'ext/libxml/ruby_xml_parser_context.c', line 943
static VALUE rxml_parser_context_well_formed_q(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); if (ctxt->wellFormed) return (Qtrue); else return (Qfalse); }
Instance Method Details
#close ⇒ nil
Closes the underlying input streams. This is useful when parsing a large amount of files and you want to close the files without relying on Ruby’s garbage collector to run.
# File 'ext/libxml/ruby_xml_parser_context.c', line 234
static VALUE rxml_parser_context_close(VALUE self) { xmlParserCtxtPtr ctxt; xmlParserInputPtr xinput; Data_Get_Struct(self, xmlParserCtxt, ctxt); while ((xinput = inputPop(ctxt)) != NULL) { xmlFreeInputStream(xinput); } return Qnil; }
#data_directory ⇒ "dir
"
Obtain the data directory associated with this context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 253
static VALUE rxml_parser_context_data_directory_get(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); if (ctxt->directory == NULL) return (Qnil); else return (rxml_new_cstr((const xmlChar*)ctxt->directory, ctxt->encoding)); }
#depth ⇒ Numeric
Obtain the depth of this context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 270
static VALUE rxml_parser_context_depth_get(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); return (INT2NUM(ctxt->depth)); }
#errno ⇒ Numeric
Obtain the last-error number in this context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 403
static VALUE rxml_parser_context_errno_get(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); return (INT2NUM(ctxt->errNo)); }
#max_num_streams ⇒ Numeric
Obtain the limit on the number of IO streams opened in this context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 435
static VALUE rxml_parser_context_io_max_num_streams_get(VALUE self) { // TODO alias to max_streams and dep this? xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); return (INT2NUM(ctxt->inputMax)); }
#num_streams ⇒ "dir
"
Obtain the actual number of IO streams in this context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 451
static VALUE rxml_parser_context_io_num_streams_get(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); return (INT2NUM(ctxt->inputNr)); }
#name_depth ⇒ Numeric
Obtain the name depth for this context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 483
static VALUE rxml_parser_context_name_depth_get(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); return (INT2NUM(ctxt->nameNr)); }
#name_depth_max ⇒ Numeric
Obtain the maximum name depth for this context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 497
static VALUE rxml_parser_context_name_depth_max_get(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); return (INT2NUM(ctxt->nameMax)); }
#name_node ⇒ "name
"
Obtain the name node for this context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 511
static VALUE rxml_parser_context_name_node_get(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); if (ctxt->name == NULL) return (Qnil); else return (rxml_new_cstr( ctxt->name, ctxt->encoding)); }
#name_tab ⇒ Array
, ...
Obtain the name table for this context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 528
static VALUE rxml_parser_context_name_tab_get(VALUE self) { int i; xmlParserCtxtPtr ctxt; VALUE tab_ary; Data_Get_Struct(self, xmlParserCtxt, ctxt); if (ctxt->nameTab == NULL) return (Qnil); tab_ary = rb_ary_new(); for (i = (ctxt->nameNr - 1); i >= 0; i--) { if (ctxt->nameTab[i] == NULL) continue; else rb_ary_push(tab_ary, rxml_new_cstr( ctxt->nameTab[i], ctxt->encoding)); } return (tab_ary); }
#node ⇒ node
Obtain the root node of this context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 572
static VALUE rxml_parser_context_node_get(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); if (ctxt->node == NULL) return (Qnil); else return (rxml_node_wrap(ctxt->node)); }
#node_depth ⇒ Numeric
Obtain the node depth for this context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 558
static VALUE rxml_parser_context_node_depth_get(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); return (INT2NUM(ctxt->nodeNr)); }
#node_depth_max ⇒ Numeric
Obtain the maximum node depth for this context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 589
static VALUE rxml_parser_context_node_depth_max_get(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); return (INT2NUM(ctxt->nodeMax)); }
#num_chars ⇒ Numeric
Obtain the number of characters in this context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 603
static VALUE rxml_parser_context_num_chars_get(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); return (LONG2NUM(ctxt->nbChars)); }
#space_depth ⇒ Numeric
Obtain the space depth for this context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 737
static VALUE rxml_parser_context_space_depth_get(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); return (INT2NUM(ctxt->spaceNr)); }
#space_depth ⇒ Numeric
Obtain the maximum space depth for this context.
# File 'ext/libxml/ruby_xml_parser_context.c', line 751
static VALUE rxml_parser_context_space_depth_max_get(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); return (INT2NUM(ctxt->spaceMax)); }
#subset_external_system_id ⇒ "system_id
"
Obtain this context’s external subset system identifier. (valid only if either of subset_external? or subset_internal? is true).
# File 'ext/libxml/ruby_xml_parser_context.c', line 841
static VALUE rxml_parser_context_subset_external_system_id_get(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); if (ctxt->extSubSystem == NULL) return (Qnil); else return (rxml_new_cstr( ctxt->extSubSystem, ctxt->encoding)); }
#subset_external_uri ⇒ "uri
"
Obtain this context’s external subset URI. (valid only if either of subset_external? or subset_internal? is true).
# File 'ext/libxml/ruby_xml_parser_context.c', line 822
static VALUE rxml_parser_context_subset_external_uri_get(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); if (ctxt->extSubURI == NULL) return (Qnil); else return (rxml_new_cstr( ctxt->extSubURI, ctxt->encoding)); }
#subset_internal_name ⇒ "name
"
Obtain this context’s subset name (valid only if either of subset_external? or subset_internal? is true).
# File 'ext/libxml/ruby_xml_parser_context.c', line 803
static VALUE rxml_parser_context_subset_name_get(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); if (ctxt->intSubName == NULL) return (Qnil); else return (rxml_new_cstr(ctxt->intSubName, ctxt->encoding)); }
#valid? ⇒ Boolean
Determine whether this context is valid.
# File 'ext/libxml/ruby_xml_parser_context.c', line 892
static VALUE rxml_parser_context_valid_q(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); if (ctxt->valid) return (Qtrue); else return (Qfalse); }
#version ⇒ "version"
Obtain this context’s version identifier.
# File 'ext/libxml/ruby_xml_parser_context.c', line 926
static VALUE rxml_parser_context_version_get(VALUE self) { xmlParserCtxtPtr ctxt; Data_Get_Struct(self, xmlParserCtxt, ctxt); if (ctxt->version == NULL) return (Qnil); else return (rxml_new_cstr( ctxt->version, ctxt->encoding)); }