Re: [xml] Libxml not catching schema error




Hi Boris,

Thanks a lot for the response.

But libxml2 doesn't catch the problem even if I change the type of the
first "ifid" to "xs:integer". (with or without "xs:choice" as the parent
of "ifid" elements).

Thanks,
Yong Chen 

-----Original Message-----
From: xml-bounces gnome org [mailto:xml-bounces gnome org] On 
Behalf Of Boris Kolpackov
Sent: Thursday, February 08, 2007 11:27 AM
To: xml gnome org
Subject: Re: [xml] Libxml not catching schema error

Hi Yong,

"Yong Chen \(yongche\)" <chen cisco com> writes:

  <xs:complexType name="interface_type">
    <xs:sequence>
      <xs:choice>
        <xs:element name="ifid" minOccurs="1" type="xs:string"/>
        <xs:element name="ifid" minOccurs="1" type="xs:string"/>
      </xs:choice>
    </xs:sequence>
  </xs:complexType>

This is also valid though does not make much sense (e.g, a 
choice between two equivalent elements). One scenario where 
repeating the same element would me sense is something along 
these lines:

<xs:complexType name="interface_type">
  <xs:sequence>
    <xs:element name="ifid" type="xs:string"/>
    <xs:element name="foo" type="xs:string"/>
    <xs:element name="ifid" type="xs:string"/>
  </xs:sequence>
</xs:complexType>

I.e., you want an element ifid followed by element foo which 
in turn is followed by another element ifid.


hth,
-boris


--
Boris Kolpackov
Code Synthesis Tools CC
http://www.codesynthesis.com
Open-Source, Cross-Platform C++ XML Data Binding

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/ 
xml gnome org http://mail.gnome.org/mailman/listinfo/xml




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