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:
<definition target_entity="Definition">
  <primary_key name="id">1</primary_key>
  <reasoning>new def reasoning</reasoning>
  <body>new def body</body>
  <products>
    <product target_entity="Product">
    <primary_key name="id">2</primary_key>
    <definition_id>1</definition_id>
    </product>
  </products>
</definition>

##Here's my first attempt at definition.dtd:
<!ELEMENT definition (primary_key|body|reasoning|products)* >
  <!ATTLIST definition target_entity CDATA #REQUIRED>
<!ELEMENT primary_key (#PCDATA)>
  <!ATTLIST primary_key name CDATA #REQUIRED>
<!ELEMENT body (#PCDATA)>
<!ELEMENT reasoning (#PCDATA)>
<!ELEMENT products (product*)>
  <!ENTITY % product SYSTEM "lib/dtds/product.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

Reply via email to