Project

libxml-io

0.0
No commit activity in last 3 years
No release in over 3 years
Allow to register an I/O callback for handling parser input (xmlRegisterInputCallbacks). Primary designed to use with Nokogiri which doesn't support this feature.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.16
~> 5.11
~> 10.0
 Project Readme

LibXML::IO

The libxml-io gem provides Ruby language bindings for Libxml2 xmlRegisterInputCallbacks. Can be used with any gem using Libxml2 XML toolkit, however this gem was primary designed to use with Nokogiri which doesn't support this feature. Inspired by part of Libxml-Ruby.

Installation

Add this line to your application's Gemfile:

gem 'libxml-io'

And then execute:

$ bundle

Or install it yourself as:

$ gem install libxml-io

Usage

    require 'libxml/io'

    class InputCbc
        def initialize
            @xsd = ['test_common.xsd']
        end

        def match filename
            @xsd.include? filename
        end

        def query filename
            case filename
            when 'test_common.xsd'
                GET_FILE
            end
        end
    end

    LibXML::IO::InputCallbacks.register
    LibXML::IO::InputCallbacks.add_handler InputCbc.new

    INTERACT_WITH_LIBXML

    LibXML::IO::InputCallbacks.clear_handlers
    LibXML::IO::InputCallbacks.pop

License

MIT. See LICENSE.md.