Skip to content

Instantly share code, notes, and snippets.

@jcsahnwaldt
Last active May 30, 2023 13:01
Show Gist options
  • Save jcsahnwaldt/f4b859e2085d813ac0e5a718d61e257f to your computer and use it in GitHub Desktop.
Save jcsahnwaldt/f4b859e2085d813ac0e5a718d61e257f to your computer and use it in GitHub Desktop.
# Results in comments are from Ruby 3.2.2, libxml-ruby 4.1.1 on macOS
require 'libxml-ruby'
# new() is undefined for Writer
# https://github.com/xml4r/libxml-ruby/blob/master/ext/libxml/ruby_xml_writer.c#L1134
# LibXML::XML::Writer.new() # crash: undefined method `new' for LibXML::XML::Writer:Class (NoMethodError)
LibXML::XML::Writer.io(nil) # warning: undefining the allocator of T_DATA class LibXML::XML::Writer
# new() is neither undefined nor redefined for Reader
# https://github.com/xml4r/libxml-ruby/blob/master/ext/libxml/ruby_xml_reader.c#L1140-L1241
LibXML::XML::Reader.new() # no warning
LibXML::XML::Reader.string("_") # warning: undefining the allocator of T_DATA class LibXML::XML::Reader
# LibXML::XML::Reader.new() # crash: allocator undefined for LibXML::XML::Reader (TypeError)
LibXML::XML::Error.new() # no warning
LibXML::XML::XInclude.new() # no warning
context = LibXML::XML::Parser::Context.string("_") # no warning
LibXML::XML::Parser.string("_") # no warning
LibXML::XML::Parser.new(context) # no warning
LibXML::XML::SaxParser.string("_") # no warning
LibXML::XML::SaxParser.new(context) # no warning
htmlContext = LibXML::XML::HTMLParser::Context.string("_") # no warning
LibXML::XML::HTMLParser.string("_") # no warning
LibXML::XML::HTMLParser.new(htmlContext) # no warning
LibXML::XML::InputCallbacks.new() # no warning
doc = LibXML::XML::Document.new() # no warning
LibXML::XML::Document.string("<x/>") # no warning
node = LibXML::XML::Node.new(nil) # no warning
LibXML::XML::Attr.new(node, "", "") # no warning
LibXML::XML::Namespaces.new(node) # no warning
LibXML::XML::Namespace.new(node, "", "") # no warning
# new() is redefined for Schema
# https://github.com/xml4r/libxml-ruby/blob/master/ext/libxml/ruby_xml_schema.c#L397
LibXML::XML::Schema.new("http://www.w3.org/2001/XMLSchema.xsd") # warning: undefining the allocator of T_DATA class LibXML::XML::Schema
LibXML::XML::Schema.from_string("<schema xmlns='http://www.w3.org/2001/XMLSchema'/>") # warning: undefining the allocator of T_DATA class LibXML::XML::Schema
LibXML::XML::Schema.new("http://www.w3.org/2001/XMLSchema.xsd") # warning: undefining the allocator of T_DATA class LibXML::XML::Schema
LibXML::XML::Schema::Attribute.new() # no warning
LibXML::XML::Schema::Element.new() # no warning
LibXML::XML::Schema::Facet.new() # no warning
LibXML::XML::Schema::Type.new() # no warning
LibXML::XML::Attributes.new() # no warning
LibXML::XML::AttrDecl.new() # no warning
LibXML::XML::Dtd.new("") # no warning
LibXML::XML::RelaxNG.from_string("<element name='_' xmlns='http://relaxng.org/ns/structure/1.0'><text/></element>") # warning: undefining the allocator of T_DATA class LibXML::XML::RelaxNG
LibXML::XML::XPath::Context.new(doc) # no warning
LibXML::XML::XPath::Expression.new('/') # no warning
LibXML::XML::XPath::Object.new() # no warning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment