[xml] Libxml not catching schema error


It seems libxml2 sometimes doesn't catch duplicate elements (under the
same parent element) when loading a schema. (Please see the simple
schema at the end).

  xmlSchemaParserCtxtPtr parserCtxtPtr =
xmlSchemaNewParserCtxt("./sample.xsd");  -----line 1
  xmlSchemaPtr schema = xmlSchemaParse(parserCtxtPtr);    ------------>
line 2

Line 1 creates a parser context, and line 2 creates schema pointer.

For the schema below, there are two "ifid" elements in "interface_type"
complexType, I expect line 2 reports an error saying duplicate elements
defined, but instead, line 2 returns fine.

Yong Chen 


<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns="http://www.my.com/test"; targetNamespace="http://www.my.com/test";
  <xs:element name="show" type="show_type"/>
  <xs:complexType name="show_type">
      <xs:element name="interface" minOccurs="1" type="interface_type"/>
  <xs:complexType name="interface_type">
        <xs:element name="ifid" minOccurs="1" type="xs:string"/>
        <xs:element name="ifid" minOccurs="1" type="xs:string"/>

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