Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: Charlie Savage
RE: Segmentation fault with validate_schema [ reply ]  
2009-01-20 10:04
Hey Cássio,

Can you provide your test files? And anyway that you could rebuild libxml-ruby on your box to include debugging information and then grab a crash dump?

As for the segmentation fault in rails hard to say. Maybe a xml document or parser is being reused when it shouldn't? Maybe there is a memory leak that we haven't found? A stack trace would be very helpful to narrow it down.

Charlie

By: Cássio Marques
RE: Segmentation fault with validate_schema [ reply ]  
2009-01-16 18:32
Also, when runnig the following code *outside* Rails but with the same xml and schema files, it works fine:

require 'rubygems'
require 'xml'

schema_doc = XML::Document.file('sample_set.xsd')
schema = XML::Schema.document(schema_doc)
xml_doc = XML::Document.file('sample_sets.xml')

puts xml_doc.validate_schema(schema) do |message, flag|
puts message
end


Just to let u know, running ruby 1.8.6 (2007-09-24 patchlevel 111) [i486-linux]

thanks!

By: Cássio Marques
Segmentation fault with validate_schema [ reply ]  
2009-01-16 18:24
Hello,

I'm trying to use libxml-ruby inside a Rails application to validate incoming XML files against a schema.

I'm trying something like these:

path = File.join(RAILS_ROOT, 'config', 'xml-schemas', "some_schema.xsd")
raise XMLSchemaNotFoundError unless File.exists?(path)
@schema = LibXML::XML::Document.file(path)
@document = LibXML::XML::Document.string(some_xml_string)
@errors = {:error => [], :warning => []}
@document.validate_schema(@schema) do |msg, type|
type = type ? :error : :warning
@errors[type] << msg
end

And I'm getting an erro like

[BUG] Segmentation fault
ruby 1.8.6 (2007-09-24) [i486-linux]

at the line where I call @document.validate_schema(...)

Does anyone knows what that can be?

I'm using Ubuntu 8.04 with libxml2 and libxml-ruby 0.9.7

Thanks!