Module LibXML::XML

  1. ext/libxml/libxml.c
  2. lib/libxml/attr.rb
  3. lib/libxml/attributes.rb
  4. lib/libxml/document.rb
  5. lib/libxml/error.rb
  6. lib/libxml/html_parser.rb
  7. lib/libxml/namespace.rb
  8. lib/libxml/namespaces.rb
  9. lib/libxml/node.rb
  10. lib/libxml/ns.rb
  11. lib/libxml/parser.rb
  12. lib/libxml/parser_context.rb
  13. lib/libxml/parser_options.rb
  14. lib/libxml/properties.rb
  15. lib/libxml/reader.rb
  16. lib/libxml/sax_callbacks.rb
  17. lib/libxml/sax_parser.rb
  18. lib/libxml/tree.rb
  19. lib/libxml/xpath_object.rb
  20. show all
  call-seq:
     XML.memory_used -> num_bytes

  Perform a parser memory dump (requires memory debugging
  support in libxml).
  # ---

  call-seq:
     attr.value = "value"

  Sets the value of this attribute.
  # ---

  call-seq:
     attributes.first -> XML::Attr

  Returns the first attribute.

   doc.root.attributes.first
  # ---

  call-seq:
     document.reader -> reader

  Create a XML::Reader from the document. This is a shortcut to
  XML::Reader.walker().
  # ---
  Note that buffer is freed by xmlParserInputBufferPush  # ---
  Now call global handler   # ---

  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.
  # ---

  call-seq:
     input.io = IO

  Set the IO instance this parser works with.
  # ---

  call-seq:
     input.io = IO

  Set the IO instance this parser works with.
  # ---

  call-seq:
     remove_scheme

  No documentation available.
  # ---

  call-seq:
     ns.next -> XML::Namespace

  Obtain the next namespace.

  Usage:

    doc = XML::Document.string('<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"/>')
    ns = doc.root.namespaces.find_by_href('http://schemas.xmlsoap.org/soap/envelope/')
    assert_nil(ns.next)
  # ---

  call-seq:
     namespaces.node -> XML::Node

  Returns the current node.
  # ---

  call-seq:
     node.copy -> XML::Node

  Creates a copy of this node.  To create a
  shallow copy set the deep parameter to false.
  To create a deep copy set the deep parameter
  to true.

  # ---
 else if (rb_ivar_get(input, DOCUMENT_ATTR) != Qnil)
  ctxt = rxml_parser_parse_document(input);  # ---
  Rdoc needs to know.   # ---

  Document-class: LibXML::XML::RelaxNG

  The XML::RelaxNG class is used to prepare RelaxNG schemas for validation
  of xml documents.

  Schemas can be created from XML documents, strings or URIs using the
  corresponding methods (new for URIs).

  Once a schema is prepared, an XML document can be validated by the
  XML::Document#validate_relaxng method providing the XML::RelaxNG object
  as parameter. The method will raise an exception if the document is
  not valid.

  Basic Usage:

   # parse schema as xml document
   relaxng_document = XML::Document.file('schema.rng')

   # prepare schema for validation
   relaxng_schema = XML::RelaxNG.document(relaxng_document)

   # parse xml document to be validated
   instance = XML::Document.file('instance.xml')

   # validate
   instance.validate_relaxng(relaxng_schema)
  # ---

  call-seq:
     parser.parse -> (true|false)

  Parse the input XML, generating callbacks to the object
  registered via the +callbacks+ attributesibute.
  # ---

  Document-class: LibXML::XML::Schema

  The XML::Schema class is used to prepare XML Schemas for validation of xml
  documents.

  Schemas can be created from XML documents, strings or URIs using the
  corresponding methods (new for URIs).

  Once a schema is prepared, an XML document can be validated by the
  XML::Document#validate_schema method providing the XML::Schema object
  as parameter. The method return true if the document validates, false
  otherwise.

  Basic usage:

   # parse schema as xml document
   schema_document = XML::Document.file('schema.rng')

   # prepare schema for validation
   schema = XML::Schema.document(schema_document)

   # parse xml document to be validated
   instance = XML::Document.file('instance.xml')

   # validate
   instance.validate_schema(schema)
  # ---
  $Id$   # ---

  Document-class: LibXML::XML::XInclude

  The ruby bindings do not currently expose libxml's
  XInclude fuctionality.
  # ---

  Document-class: LibXML::XML::XPath

  The XML::XPath module is used to query XML documents. It is
  usually accessed via the XML::Document#find or
  XML::Node#find methods.  For example:

   document.find('/foo', namespaces) -> XML::XPath::Object

  The optional namespaces parameter can be a string, array or
  hash table.

    document.find('/foo', 'xlink:http://www.w3.org/1999/xlink')
    document.find('/foo', ['xlink:http://www.w3.org/1999/xlink',
                           'xi:http://www.w3.org/2001/XInclude')
    document.find('/foo', 'xlink' => 'http://www.w3.org/1999/xlink',
                              'xi' => 'http://www.w3.org/2001/XInclude')

  === Working With Default Namespaces

  Finding namespaced elements and attributes can be tricky.
  Lets work through an example of a document with a default
  namespace:

   <?xml version="1.0" encoding="utf-8"?>
   <feed xmlns="http://www.w3.org/2005/Atom">
     <title type="text">Phil Bogle's Contacts</title>
   </feed>

  To find nodes you must define the atom namespace for
  libxml.  One way to do this is:

    node = doc.find('atom:title', 'atom:http://www.w3.org/2005/Atom')

  Alternatively, you can register the default namespace like this:

    doc.root.namespaces.default_prefix = 'atom'
    node = doc.find('atom:title')

  === More Complex Namespace Examples

  Lets work through some more complex examples using the
  following xml document:

   <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
     <soap:Body>
       <getManufacturerNamesResponse xmlns="http://services.somewhere.com">
         <IDAndNameList xmlns="http://services.somewhere.com">
           <ns1:IdAndName xmlns:ns1="http://domain.somewhere.com"/>
         </IDAndNameList>
       </getManufacturerNamesResponse>
   </soap:Envelope>

   # Since the soap namespace is defined on the root
   # node we can directly use it.
   doc.find('/soap:Envelope')

   # Since the ns1 namespace is not defined on the root node
   # we have to first register it with the xpath engine.
   doc.find('//ns1:IdAndName',
            'ns1:http://domain.somewhere.com')

   # Since the getManufacturerNamesResponse element uses a default
   # namespace we first have to give it a prefix and register
   # it with the xpath engine.
   doc.find('//ns:getManufacturerNamesResponse',
             'ns:http://services.somewhere.com')

   # Here is an example showing a complex namespace aware
   # xpath expression.
   doc.find('/soap:Envelope/soap:Body/ns0:getManufacturerNamesResponse/ns0:IDAndNameList/ns1:IdAndName',

[‘ns0:services.somewhere.com’, ‘ns1:domain.somewhere.com’])

  # ---

  call-seq:
     XML::XPointer.range(start_node, end_node) -> xpath

  Create an xpath representing the range between the supplied
  start and end node.

Methods

public class

Constants

LIBXML_VERSION = rb_str_new2(LIBXML_DOTTED_VERSION)   Constants
VERSION = rb_str_new2(RUBY_LIBXML_VERSION)
VERNUM = INT2NUM(RUBY_LIBXML_VERNUM)
XML_NAMESPACE = rb_str_new2( (const char*) XML_XML_NAMESPACE)

Public class methods

XML.catalog_dump → true

Dump all the global catalog content stdout.

[show source]
/*
 * call-seq:
 *              XML.catalog_dump -> true
 *
 * Dump all the global catalog content stdout.
 */
static VALUE rxml_catalog_dump(VALUE self)
{
  xmlCatalogDump(stdout);
  return (Qtrue);
}
XML.catalog_remove(catalog) → true

Remove the specified resource catalog.

[show source]
/*
 * call-seq:
 *              XML.catalog_remove(catalog) -> true
 *
 * Remove the specified resource catalog.
 */
static VALUE rxml_catalog_remove(VALUE self, VALUE cat)
{
  Check_Type(cat, T_STRING);
  xmlCatalogRemove((xmlChar *) StringValuePtr(cat));
  return (Qtrue);
}
XML.check_lib_versions → true

Check LIBXML version matches version the bindings were compiled to. Throws an exception if not.

[show source]
/*
 * call-seq:
 *              XML.check_lib_versions -> true
 *
 * Check LIBXML version matches version the bindings
 * were compiled to. Throws an exception if not.
 */
static VALUE rxml_check_lib_versions(VALUE class)
{
  xmlCheckVersion(LIBXML_VERSION);
  return (Qtrue);
}
XML.debug_entities → (true|false)

Determine whether included-entity debugging is enabled. (Requires Libxml to be compiled with debugging support)

[show source]
/*
 * call-seq:
 *    XML.debug_entities -> (true|false)
 *
 * Determine whether included-entity debugging is enabled.
 * (Requires Libxml to be compiled with debugging support)
 */
static VALUE rxml_debug_entities_get(VALUE class)
{
#ifdef LIBXML_DEBUG_ENABLED
  if (xmlParserDebugEntities)
  return(Qtrue);
  else
  return(Qfalse);
#else
  rb_warn("libxml was compiled with debugging turned off");
  return (Qfalse);
#endif
}
XML.debug_entities = true|false

Enable or disable included-entity debugging. (Requires Libxml to be compiled with debugging support)

[show source]
/*
 * call-seq:
 *    XML.debug_entities = true|false
 *
 * Enable or disable included-entity debugging.
 * (Requires Libxml to be compiled with debugging support)
 */
static VALUE rxml_debug_entities_set(VALUE class, VALUE bool)
{
#ifdef LIBXML_DEBUG_ENABLED
  if (TYPE(bool) == T_FALSE)
  {
    xmlParserDebugEntities = 0;
    return(Qfalse);
  }
  else
  {
    xmlParserDebugEntities = 1;
    return(Qtrue);
  }
#else
  rb_warn("libxml was compiled with debugging turned off");
#endif
}
XML.default_compression → (true|false)

Determine whether parsers use Zlib compression by default (requires libxml to be compiled with Zlib support).

[show source]
/*
 * call-seq:
 *    XML.default_compression -> (true|false)
 *
 * Determine whether parsers use Zlib compression by default
 * (requires libxml to be compiled with Zlib support).
 */
static VALUE rxml_default_compression_get(VALUE class)
{
#ifdef HAVE_ZLIB_H
  return(INT2FIX(xmlGetCompressMode()));
#else
  rb_warn("libxml was compiled without zlib support");
  return (Qfalse);
#endif
}
XML.default_compression = true|false

Controls whether parsers use Zlib compression by default (requires libxml to be compiled with Zlib support).

[show source]
/*
 * call-seq:
 *    XML.default_compression = true|false
 *
 * Controls whether parsers use Zlib compression by default
 * (requires libxml to be compiled with Zlib support).
 */
static VALUE rxml_default_compression_set(VALUE class, VALUE num)
{
#ifdef HAVE_ZLIB_H
  Check_Type(num, T_FIXNUM);
  xmlSetCompressMode(FIX2INT(num));
  return(num);
#else
  rb_warn("libxml was compiled without zlib support");
  return (Qfalse);
#endif
}
XML.default_keep_blanks → (true|false)

Determine whether parsers retain whitespace by default.

[show source]
/*
 * call-seq:
 *    XML.default_keep_blanks -> (true|false)
 *
 * Determine whether parsers retain whitespace by default.
 */
static VALUE rxml_default_keep_blanks_get(VALUE class)
{
  if (xmlKeepBlanksDefaultValue)
    return (Qtrue);
  else
    return (Qfalse);
}
XML.default_keep_blanks = true|false

Controls whether parsers retain whitespace by default.

[show source]
/*
 * call-seq:
 *    XML.default_keep_blanks = true|false
 *
 * Controls whether parsers retain whitespace by default.
 */
static VALUE rxml_default_keep_blanks_set(VALUE class, VALUE bool)
{
  if (TYPE(bool) == T_FALSE)
  {
    xmlKeepBlanksDefaultValue = 0;
    return (Qfalse);
  }
  else if (TYPE(bool) == T_TRUE)
  {
    xmlKeepBlanksDefaultValue = 1;
    return (Qtrue);
  }
  else
  {
    rb_raise(rb_eArgError, "Invalid argument, must be a boolean");
  }
}
XML.default_line_numbers → (true|false)

Determine whether parsers retain line-numbers by default.

[show source]
/*
 * call-seq:
 *    XML.default_line_numbers -> (true|false)
 *
 * Determine whether parsers retain line-numbers by default.
 */
static VALUE rxml_default_line_numbers_get(VALUE class)
{
  if (xmlLineNumbersDefaultValue)
    return (Qtrue);
  else
    return (Qfalse);
}
XML.default_line_numbers = true|false

Controls whether parsers retain line-numbers by default.

[show source]
/*
 * call-seq:
 *    XML.default_line_numbers = true|false
 *
 * Controls whether parsers retain line-numbers by default.
 */
static VALUE rxml_default_line_numbers_set(VALUE class, VALUE bool)
{
  if (TYPE(bool) == T_FALSE)
  {
    xmlLineNumbersDefault(0);
    return (Qfalse);
  }
  else
  {
    xmlLineNumbersDefault(1);
    return (Qtrue);
  }
}
XML.default_load_external_dtd → (true|false)

Determine whether parsers load external DTDs by default.

[show source]
/*
 * call-seq:
 *    XML.default_load_external_dtd -> (true|false)
 *
 * Determine whether parsers load external DTDs by default.
 */
static VALUE rxml_default_load_external_dtd_get(VALUE class)
{
  if (xmlLoadExtDtdDefaultValue)
    return (Qtrue);
  else
    return (Qfalse);
}
XML.default_load_external_dtd = true|false

Controls whether parsers load external DTDs by default.

[show source]
/*
 * call-seq:
 *    XML.default_load_external_dtd = true|false
 *
 * Controls whether parsers load external DTDs by default.
 */
static VALUE rxml_default_load_external_dtd_set(VALUE class, VALUE bool)
{
  if (TYPE(bool) == T_FALSE)
  {
    xmlLoadExtDtdDefaultValue = 0;
    return (Qfalse);
  }
  else
  {
    xmlLoadExtDtdDefaultValue = 1;
    return (Qtrue);
  }
}
XML.default_pedantic_parser → (true|false)

Determine whether parsers are pedantic by default.

[show source]
/*
 * call-seq:
 *    XML.default_pedantic_parser -> (true|false)
 *
 * Determine whether parsers are pedantic by default.
 */
static VALUE rxml_default_pedantic_parser_get(VALUE class)
{
  if (xmlPedanticParserDefaultValue)
    return (Qtrue);
  else
    return (Qfalse);
}
XML.default_pedantic_parser = true|false

Controls whether parsers are pedantic by default.

[show source]
/*
 * call-seq:
 *    XML.default_pedantic_parser = true|false
 *
 * Controls whether parsers are pedantic by default.
 */
static VALUE rxml_default_pedantic_parser_set(VALUE class, VALUE bool)
{
  if (TYPE(bool) == T_FALSE)
  {
    xmlPedanticParserDefault(0);
    return (Qfalse);
  }
  else
  {
    xmlPedanticParserDefault(1);
    return (Qtrue);
  }
}
XML.default_substitute_entities → (true|false)

Determine whether parsers perform inline entity substitution (for external entities) by default.

[show source]
/*
 * call-seq:
 *    XML.default_substitute_entities -> (true|false)
 *
 * Determine whether parsers perform inline entity substitution
 * (for external entities) by default.
 */
static VALUE rxml_default_substitute_entities_get(VALUE class)
{
  if (xmlSubstituteEntitiesDefaultValue)
    return (Qtrue);
  else
    return (Qfalse);
}
XML.default_substitute_entities = true|false

Controls whether parsers perform inline entity substitution (for external entities) by default.

[show source]
/*
 * call-seq:
 *    XML.default_substitute_entities = true|false
 *
 * Controls whether parsers perform inline entity substitution
 * (for external entities) by default.
 */
static VALUE rxml_default_substitute_entities_set(VALUE class, VALUE bool)
{
  if (TYPE(bool) == T_FALSE)
  {
    xmlSubstituteEntitiesDefault(0);
    return (Qfalse);
  }
  else
  {
    xmlSubstituteEntitiesDefault(1);
    return (Qtrue);
  }
}
XML.default_tree_indent_string → "string"

Obtain the default string used by parsers to indent the XML tree for output.

[show source]
/*
 * call-seq:
 *    XML.default_tree_indent_string -> "string"
 *
 * Obtain the default string used by parsers to indent the XML tree
 * for output.
 */
static VALUE rxml_default_tree_indent_string_get(VALUE class)
{
  if (xmlTreeIndentString == NULL)
    return (Qnil);
  else
    return (rb_str_new2(xmlTreeIndentString));
}
XML.default_tree_indent_string = "string"

Set the default string used by parsers to indent the XML tree for output.

[show source]
/*
 * call-seq:
 *    XML.default_tree_indent_string = "string"
 *
 * Set the default string used by parsers to indent the XML tree
 * for output.
 */
static VALUE rxml_default_tree_indent_string_set(VALUE class, VALUE string)
{
  Check_Type(string, T_STRING);
  xmlTreeIndentString = xmlStrdup((xmlChar *)StringValuePtr(string));
  return (string);
}
XML.default_validity_checking → (true|false)

Determine whether parsers perform XML validation by default.

[show source]
/*
 * call-seq:
 *    XML.default_validity_checking -> (true|false)
 *
 * Determine whether parsers perform XML validation by default.
 */
static VALUE rxml_default_validity_checking_get(VALUE class)
{
  if (xmlDoValidityCheckingDefaultValue)
    return (Qtrue);
  else
    return (Qfalse);
}
XML.default_validity_checking = true|false

Controls whether parsers perform XML validation by default.

[show source]
/*
 * call-seq:
 *    XML.default_validity_checking = true|false
 *
 * Controls whether parsers perform XML validation by default.
 */
static VALUE rxml_default_validity_checking_set(VALUE class, VALUE bool)
{
  if (TYPE(bool) == T_FALSE)
  {
    xmlDoValidityCheckingDefaultValue = 0;
    return (Qfalse);
  }
  else
  {
    xmlDoValidityCheckingDefaultValue = 1;
    return (Qtrue);
  }
}
XML.default_warnings → (true|false)

Determine whether parsers output warnings by default.

[show source]
/*
 * call-seq:
 *    XML.default_warnings -> (true|false)
 *
 * Determine whether parsers output warnings by default.
 */
static VALUE rxml_default_warnings_get(VALUE class)
{
  if (xmlGetWarningsDefaultValue)
    return (Qtrue);
  else
    return (Qfalse);
}
XML.default_warnings = true|false

Controls whether parsers output warnings by default.

[show source]
/*
 * call-seq:
 *    XML.default_warnings = true|false
 *
 * Controls whether parsers output warnings by default.
 */
static VALUE rxml_default_warnings_set(VALUE class, VALUE bool)
{
  if (TYPE(bool) == T_FALSE)
  {
    xmlGetWarningsDefaultValue = 0;
    return (Qfalse);
  }
  else
  {
    xmlGetWarningsDefaultValue = 1;
    return (Qtrue);
  }
}
XML.enabled_automata? → (true|false)

Determine whether libxml regexp automata support is enabled.

[show source]
/*
 * call-seq:
 *              XML.enabled_automata? -> (true|false)
 *
 * Determine whether libxml regexp automata support is enabled.
 */
static VALUE rxml_enabled_automata_q(VALUE class)
{
#ifdef LIBXML_AUTOMATA_ENABLED
  return(Qtrue);
#else
  return (Qfalse);
#endif
}
XML.enabled_c14n? → (true|false)

Determine whether libxml ‘canonical XML’ support is enabled. See “Canonical XML” (www.w3.org/TR/xml-c14n)

[show source]
/*
 * call-seq:
 *              XML.enabled_c14n? -> (true|false)
 *
 * Determine whether libxml 'canonical XML' support is enabled.
 * See "Canonical XML" (http://www.w3.org/TR/xml-c14n)
 */
static VALUE rxml_enabled_c14n_q(VALUE class)
{
#ifdef LIBXML_C14N_ENABLED
  return(Qtrue);
#else
  return (Qfalse);
#endif
}
XML.enabled_catalog? → (true|false)

Determine whether libxml resource catalog support is enabled.

[show source]
/*
 * call-seq:
 *              XML.enabled_catalog? -> (true|false)
 *
 * Determine whether libxml resource catalog support is enabled.
 */
static VALUE rxml_enabled_catalog_q(VALUE class)
{
#ifdef LIBXML_CATALOG_ENABLED
  return(Qtrue);
#else
  return (Qfalse);
#endif
}
XML.enabled_debug? → (true|false)

Determine whether libxml debugging support is enabled.

[show source]
/*
 * call-seq:
 *              XML.enabled_debug? -> (true|false)
 *
 * Determine whether libxml debugging support is enabled.
 */
static VALUE rxml_enabled_debug_q(VALUE class)
{
#ifdef LIBXML_DEBUG_ENABLED
  return(Qtrue);
#else
  return (Qfalse);
#endif
}
XML.enabled_docbook? → (true|false)

Determine whether libxml docbook support is enabled.

[show source]
/*
 * call-seq:
 *              XML.enabled_docbook? -> (true|false)
 *
 * Determine whether libxml docbook support is enabled.
 */
static VALUE rxml_enabled_docbook_q(VALUE class)
{
#ifdef LIBXML_DOCB_ENABLED
  return(Qtrue);
#else
  return (Qfalse);
#endif
}
XML.enabled_ftp? → (true|false)

Determine whether libxml ftp client support is enabled.

[show source]
/*
 * call-seq:
 *              XML.enabled_ftp? -> (true|false)
 *
 * Determine whether libxml ftp client support is enabled.
 */
static VALUE rxml_enabled_ftp_q(VALUE class)
{
#ifdef LIBXML_FTP_ENABLED
  return(Qtrue);
#else
  return (Qfalse);
#endif
}
XML.enabled_html? → (true|false)

Determine whether libxml html support is enabled.

[show source]
/*
 * call-seq:
 *              XML.enabled_html? -> (true|false)
 *
 * Determine whether libxml html support is enabled.
 */
static VALUE rxml_enabled_html_q(VALUE class)
{
#ifdef LIBXML_HTML_ENABLED
  return(Qtrue);
#else
  return (Qfalse);
#endif
}
XML.enabled_http? → (true|false)

Determine whether libxml http client support is enabled.

[show source]
/*
 * call-seq:
 *              XML.enabled_http? -> (true|false)
 *
 * Determine whether libxml http client support is enabled.
 */
static VALUE rxml_enabled_http_q(VALUE class)
{
#ifdef LIBXML_HTTP_ENABLED
  return(Qtrue);
#else
  return (Qfalse);
#endif
}
XML.enabled_iconv? → (true|false)

Determine whether libxml iconv support is enabled.

[show source]
/*
 * call-seq:
 *              XML.enabled_iconv? -> (true|false)
 *
 * Determine whether libxml iconv support is enabled.
 */
static VALUE rxml_enabled_iconv_q(VALUE class)
{
#ifdef LIBXML_ICONV_ENABLED
  return(Qtrue);
#else
  return (Qfalse);
#endif
}
XML.enabled_memory_debug? → (true|false)

Determine whether libxml memory location debugging support is enabled.

[show source]
/*
 * call-seq:
 *              XML.enabled_memory_debug? -> (true|false)
 *
 * Determine whether libxml memory location debugging support
 * is enabled.
 */
static VALUE rxml_enabled_memory_debug_location_q(VALUE class)
{
#ifdef DEBUG_MEMORY_LOCATION
  return(Qtrue);
#else
  return (Qfalse);
#endif
}
XML.enabled_regexp? → (true|false)

Determine whether libxml regular expression support is enabled.

[show source]
/*
 * call-seq:
 *              XML.enabled_regexp? -> (true|false)
 *
 * Determine whether libxml regular expression support is enabled.
 */
static VALUE rxml_enabled_regexp_q(VALUE class)
{
#ifdef LIBXML_REGEXP_ENABLED
  return(Qtrue);
#else
  return (Qfalse);
#endif
}
XML.enabled_schemas? → (true|false)

Determine whether libxml schema support is enabled.

[show source]
/*
 * call-seq:
 *              XML.enabled_schemas? -> (true|false)
 *
 * Determine whether libxml schema support is enabled.
 */
static VALUE rxml_enabled_schemas_q(VALUE class)
{
#ifdef LIBXML_SCHEMAS_ENABLED
  return(Qtrue);
#else
  return (Qfalse);
#endif
}
XML.enabled_thread? → (true|false)

Determine whether libxml thread-safe semantics support is enabled (I think?).

[show source]
/*
 * call-seq:
 *              XML.enabled_thread? -> (true|false)
 *
 * Determine whether libxml thread-safe semantics support
 * is enabled (I think?).
 */
static VALUE rxml_enabled_thread_q(VALUE class)
{
#ifdef LIBXML_THREAD_ENABLED
  return(Qtrue);
#else
  return (Qfalse);
#endif
}
XML.enabled_unicode? → (true|false)

Determine whether libxml unicode support is enabled.

[show source]
/*
 * call-seq:
 *              XML.enabled_unicode? -> (true|false)
 *
 * Determine whether libxml unicode support is enabled.
 */
static VALUE rxml_enabled_unicode_q(VALUE class)
{
#ifdef LIBXML_UNICODE_ENABLED
  return(Qtrue);
#else
  return (Qfalse);
#endif
}
XML.enabled_xinclude? → (true|false)

Determine whether libxml xinclude support is enabled.

[show source]
/*
 * call-seq:
 *              XML.enabled_xinclude? -> (true|false)
 *
 * Determine whether libxml xinclude support is enabled.
 */
static VALUE rxml_enabled_xinclude_q(VALUE class)
{
#ifdef LIBXML_XINCLUDE_ENABLED
  return(Qtrue);
#else
  return (Qfalse);
#endif
}
XML.enabled_xpath? → (true|false)

Determine whether libxml xpath support is enabled.

[show source]
/*
 * call-seq:
 *              XML.enabled_xpath? -> (true|false)
 *
 * Determine whether libxml xpath support is enabled.
 */
static VALUE rxml_enabled_xpath_q(VALUE class)
{
#ifdef LIBXML_XPATH_ENABLED
  return(Qtrue);
#else
  return (Qfalse);
#endif
}
XML.enabled_xpointer? → (true|false)

Determine whether libxml xpointer support is enabled.

[show source]
/*
 * call-seq:
 *              XML.enabled_xpointer? -> (true|false)
 *
 * Determine whether libxml xpointer support is enabled.
 */
static VALUE rxml_enabled_xpointer_q(VALUE class)
{
#ifdef LIBXML_XPTR_ENABLED
  return(Qtrue);
#else
  return (Qfalse);
#endif
}
XML.enabled_zlib? → (true|false)

Determine whether libxml zlib support is enabled.

[show source]
/*
 * call-seq:
 *              XML.enabled_zlib? -> (true|false)
 *
 * Determine whether libxml zlib support is enabled.
 */
static VALUE rxml_enabled_zlib_q(VALUE class)
{
#ifdef HAVE_ZLIB_H
  return(Qtrue);
#else
  return (Qfalse);
#endif
}
XML.features → ["feature", ..., "feature"]

Obtains an array of strings representing features supported (and enabled) by the installed libxml.

[show source]
/*
 * call-seq:
 *    XML.features -> ["feature", ..., "feature"]
 *
 * Obtains an array of strings representing features supported
 * (and enabled) by the installed libxml.
 */
static VALUE rxml_features(VALUE class)
{
  VALUE arr, str;
  int i, len = MAX_LIBXML_FEATURES_LEN;
  char **list = NULL;

  list = ALLOC_N(char *,MAX_LIBXML_FEATURES_LEN);
  MEMZERO(list, char *, MAX_LIBXML_FEATURES_LEN);

  arr = rb_ary_new();
  if (xmlGetFeaturesList(&len, (const char **) list) == -1)
    return Qnil;

  for (i = 0; i < len; i++)
  {
    str = rb_str_new2((const char *) list[i]);
    rb_gc_unregister_address(&str);
    rb_ary_push(arr, str);
  }

  if (len == MAX_LIBXML_FEATURES_LEN)
    rb_warn(
        "Please contact libxml-devel@rubyforge.org and ask to have the \"MAX_LIBXML_FEATURES_LEN increased\" because you could possibly be seeing an incomplete list");

  ruby_xfree(list);
  return (arr);
}
XML.indent_tree_output → (true|false)

Determines whether XML output will be indented (using the string supplied to default_indent_tree_string)

[show source]
/*
 * call-seq:
 *    XML.indent_tree_output -> (true|false)
 *
 * Determines whether XML output will be indented
 * (using the string supplied to +default_indent_tree_string+)
 */
static VALUE rxml_indent_tree_output_get(VALUE class)
{
  if (xmlIndentTreeOutput)
    return (Qtrue);
  else
    return (Qfalse);
}
XML.indent_tree_output = true|false

Controls whether XML output will be indented (using the string supplied to default_indent_tree_string)

[show source]
/*
 * call-seq:
 *    XML.indent_tree_output = true|false
 *
 * Controls whether XML output will be indented
 * (using the string supplied to +default_indent_tree_string+)
 */
static VALUE rxml_indent_tree_output_set(VALUE class, VALUE bool)
{
  if (TYPE(bool) == T_TRUE)
  {
    xmlIndentTreeOutput = 1;
    return (Qtrue);
  }
  else if (TYPE(bool) == T_FALSE)
  {
    xmlIndentTreeOutput = 0;
    return (Qfalse);
  }
  else
  {
    rb_raise(rb_eArgError, "Invalid argument, must be boolean");
  }
}
XML.memory_dump → (true|false)

Perform a parser memory dump (requires memory debugging support in libxml).

[show source]
/*
 * call-seq:
 *    XML.memory_dump -> (true|false)
 *
 * Perform a parser memory dump (requires memory debugging
 * support in libxml).
 */
static VALUE rxml_memory_dump(VALUE self)
{
#ifdef DEBUG_MEMORY_LOCATION
  xmlMemoryDump();
  return(Qtrue);
#else
  rb_warn("libxml was compiled without memory debugging support");
  return (Qfalse);
#endif
}
XML.memory_used → num_bytes

Perform a parser memory dump (requires memory debugging support in libxml).

[show source]
/*
 * call-seq:
 *    XML.memory_used -> num_bytes
 *
 * Perform a parser memory dump (requires memory debugging
 * support in libxml).
 */
static VALUE rxml_memory_used(VALUE self)
{
#ifdef DEBUG_MEMORY_LOCATION
  return(INT2NUM(xmlMemUsed()));
#else
  rb_warn("libxml was compiled without memory debugging support");
  return (Qfalse);
#endif
}