[erlang-bugs] Possible bug in xmerl_xsd (validating XML using XSD schema file).

Andrey Sedinin sedinin@REDACTED
Tue Jan 6 09:20:00 CET 2009


Hi,

i guess it is a bug:

Validate XML using schema:

     {ok, State } = xmerl_xsd:process_schema("test.xsd"),
     {Entity ,_} = xmerl_scan:file("test.xml"),
     xmerl_xsd:validate(Entity, State).

Schema:

<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
	elementFormDefault="qualified" attributeFormDefault="unqualified">
	
	<xs:element name="status">
		<xs:complexType>
			<xs:simpleContent>
				<xs:extension base="status-type"/>
			</xs:simpleContent>
		</xs:complexType>
	</xs:element>
	<xs:simpleType name="status-type">
		<xs:restriction base="xs:string">
			<xs:enumeration value="Valid" />
			<xs:enumeration value="Invalid" />
			<xs:enumeration value="" />
		</xs:restriction>
	</xs:simpleType>
</xs:schema>

XML:

<?xml version="1.0" encoding="UTF-8"?>
<status/>


I think it should validate. Possible values:

<status>Valid</status>
<status>Invalid</status>
<status/>

  but last one give an error:

{error,[{[],xmerl_xsd,
          {empty_content_not_allowed,[{enumeration,"Valid"},
                                      {enumeration,"Invalid"},
                                      {enumeration,[]}]}}]}


May be i wrong?
Also posted here: http://www.erlang.org/pipermail/erlang-questions/2008-December/040744.html

I use R12B-5 on Mac OS X 10.5.6.


--
Sedinin

--
Сединин






More information about the erlang-bugs mailing list