[libxml-devel] Odd Segmentation Faults

2009-02-08 Thread Michael Xavier
Hi.

I've been using libxml-ruby 0.98 recently to validate XML messages
that two of my apps send to eachother against some dtds in a rails
project which I have stored in lib/dtds.

Everything has been working great but I'm having some problems with
nested attributes in my dtds. Models can potentially be nested in
eachother so I'm trying to use a parameter declaration to load in
nested attributes. I have played around with the path I specify and I
found I have to reference it from the rails root.

##Here's my XML:

  1
  new def reasoning
  new def body
  

2
1

  


##Here's my first attempt at definition.dtd:

  

  



  
  %product;

>From that I get:
./app/models/queue_item.rb:44: [BUG] Segmentation fault
Line 44 is: dtd = XML::Dtd.new(File.read(Rails.root + "/lib/dtds/"
+ dtd_filename))
where dtd_filename is definition.dtd

I have tried validating this part of the dtd, pasting products.dtd in
and validating here an on any online validation service it shows up
fine, but it segfaults every time with libxml-ruby, bringing my
testing to a screeching halt.

So my question is, does anyone know if [BUG] is indicating a bug in
libxml-ruby or something that I'm doing wrong? Any way around it?

___
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel


Re: [libxml-devel] Odd Segmentation Faults

2009-02-09 Thread Michael Xavier
Oh, sorry my bad. lib/dtds/product.dtd is:

  

  



For the test case I created a directory libxmltest with the path lib/
dtds/ containing product.dtd and definition.dtd
My script looks like:

##test_libxml.rb
require 'rubygems'
require 'xml'

xml = '

  1
  new def reasoning
  new def body
  

2
1

  
'
begin
  doc = XML::Parser.string(xml).parse
rescue LibXML::XML::Error => e
  raise LibXML::XML::Error.new, "#{e.message}\nXML dump: #{xml}"
end
dtd = XML::Dtd.new(File.read("lib/dtds/definition.dtd"))

puts doc.validate(dtd) ? "Success!" : "Failure!"

##Output:
ruby test_libxml.rb
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]

Aborted


On Feb 8, 4:01 pm, Charlie Savage  wrote:
> Hi Michael,
>
> >   
> >   %product;
>
> >>From that I get:
> > ./app/models/queue_item.rb:44: [BUG] Segmentation fault
> > Line 44 is:     dtd = XML::Dtd.new(File.read(Rails.root + "/lib/dtds/"
> > + dtd_filename))
> > where dtd_filename is definition.dtd
>
> Works fine here, but you didn't post lib/dtds/product.dtd, so the test I
> have is different than yours.
>
> > So my question is, does anyone know if [BUG] is indicating a bug in
> > libxml-ruby or something that I'm doing wrong?
>
> It sounds like a libxml bug - can you post a test case that shows it
> happening?  If so, it should be easy to fix.
>
> Charlie
>
>  smime.p7s
> 4KViewDownload
>
> ___
> libxml-devel mailing list
> libxml-de...@rubyforge.orghttp://rubyforge.org/mailman/listinfo/libxml-devel
___
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel


Re: [libxml-devel] Odd Segmentation Faults

2009-02-18 Thread Michael Xavier


On Feb 8, 4:01 pm, Charlie Savage  wrote:
> Hi Michael,
>
> >   
> >   %product;
>
> >>From that I get:
> > ./app/models/queue_item.rb:44: [BUG] Segmentation fault
> > Line 44 is:     dtd = XML::Dtd.new(File.read(Rails.root + "/lib/dtds/"
> > + dtd_filename))
> > where dtd_filename is definition.dtd
>
> Works fine here, but you didn't post lib/dtds/product.dtd, so the test I
> have is different than yours.
>
> > So my question is, does anyone know if [BUG] is indicating a bug in
> > libxml-ruby or something that I'm doing wrong?
>
> It sounds like a libxml bug - can you post a test case that shows it
> happening?  If so, it should be easy to fix.
>
> Charlie
>
>  smime.p7s
> 4KViewDownload
>
> ___
> libxml-devel mailing list
> libxml-de...@rubyforge.orghttp://rubyforge.org/mailman/listinfo/libxml-devel
___
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel