[xml] Issues Validating with Schemas



Hey Guys,

I am a newbie to this list and to libxml 2.5.7 and am currently having
trouble validating an XML doc with a W3C XML Schema

I am calling the xmlSchemaValidateDoc() function and I always get
validation failed with
error: (XML_SCHEMAS_ERR_ELEMCONT) and error message :Element "this" content
check failed
It always chokes on the root node for some reason. Prahaps there are  some
global libxml settings I should have configured?

ie: xmlLineNumbersDefault(1);  <- noticed in testschemas.c example

Is there anyone out there who has had a similar problem or can point me to
some C coding examples of how to use the schemas?

Thanks in advance!

Matt Corr

Sample XML:

<?xml version="1.0" encoding="ISO-8859-1"?>
<this>
  <is>
    <a>
      <test>data</test>
    </a>
    <b>0293784234</b>
  </is>
</this>

Sample generated XML Schema:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; elementFormDefault="qualified">
     <xs:element name="a">
          <xs:complexType>
               <xs:sequence>
                    <xs:element name="test" ref="test"/>
               </xs:sequence>
          </xs:complexType>
     </xs:element>
     <xs:element name="b" type="xs:int"/>
     <xs:element name="is">
          <xs:complexType>
               <xs:sequence>
                    <xs:element name="a" ref="a"/>
                    <xs:element name="b" ref="b"/>
               </xs:sequence>
          </xs:complexType>
     </xs:element>
     <xs:element name="test" type="xs:string"/>
     <xs:element name="this">
          <xs:complexType>
               <xs:sequence>
                    <xs:element name="is" ref="is"/>
               </xs:sequence>
          </xs:complexType>
     </xs:element>
</xs:schema>





NOTICE
(You must not remove this notice from this email)

This email and any attachments are confidential and may contain the Bank's 
confidential information.  This email may also contain legally privileged 
information or confidential information of other parties.  This email is for 
authorised recipients only.  You should not transmit or distribute this email 
unless you are authorised to do so.

If you are not an authorised recipient, you should contact the Bank of 
Queensland immediately by return e-mail.  You should not read, send, store 
or print this email or any attachments to it.  You should immediately delete the 
email and any attachments to it from your database and destroy all copies of it. 
You should not rely on the contents of this email or any attachments to it. 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]