This is likely a PEBKAC issue rather than a bug. I hope I'm submitting
to the right list.

I'm getting different validation results from libxml in Ruby than I am
from a command-line tool (xmllint). I'm using a schema definition from
ASTM to validate the output, for what it cost me the schema should be
correct. I'm using libxml 0.9.4.

The XML I'm validating is:
**************
<?xml version="1.0"?>
<ContinuityOfCareRecord xmlns="urn:astm-org:CCR" xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:astm-
org:CCR CCR1.0.xsd">
  <CCRDocumentObjectID>a4941200-bb14-012b-4b05-001a6b46d85c</
CCRDocumentObjectID>
  <Language>
    <Text>English</Text>
  </Language>
  <Version>V1.0</Version>
  <DateTime>
    <ExactDateTime>2009-01-02T11:02:13-05:00</ExactDateTime>
  </DateTime>
</ContinuityOfCareRecord>
*************

The code and output from libxml is:
**************
 schema_doc = XML::Document.file("#{RAILS_ROOT}/ADJE2369.18405.xml")
 schema = XML::Schema.document(schema_doc)

@@ccr.validate_schema(schema)
Error: Element 'CCRDocumentObjectID': This element is not expected.
Expected is ( {urn:astm-org:CCR}CCRDocumentObjectID ). at :0.
LibXML::XML::Error: Error: Element 'CCRDocumentObjectID': This element
is not expected. Expected is ( {urn:astm-org:CCR}
CCRDocumentObjectID ). at :0.
        from /home/jon/EXTENSION/Core/branches/TrustBearer/lib/ccr.rb:86:in
`validate_schema'
        from /home/jon/EXTENSION/Core/branches/TrustBearer/lib/ccr.rb:86:in
`validate'
        from (irb):1
************

The command and output from xmllint is:
*******
j...@tpx-70002:~$ xmllint --schema ~/Documents/books\ \&\ guides/CCR/
ADJE2369.18405.xml ./test_ccr.xml

./test_ccr.xml:2: element ContinuityOfCareRecord: Schemas validity
error : Element '{urn:astm-org:CCR}ContinuityOfCareRecord': Missing
child element(s). Expected is ( {urn:astm-org:CCR}Patient ).
./test_ccr.xml fails to validate
*************

I expect a failure, since I haven't added a required node yet
(Patient), but I'm trying to reconcile the discrepancy between xmllint
and libxml.

I believe the namespace declaration in the root node is correct, I
would expect since xmlns="urn:astm-org:CCR" is declared that it would
be used on the root node and all children.

Is this a usage error on my part? Am I misusing libxml or is the xml
incorrect?

If this is a bug, has it been patched? If not, what information can I
provide to help get it fixed?

Thanks for your help and thanks for creating and publishing libxml for
Ruby!

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

Reply via email to