After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 319167 - Schema Indicator 'all' not ignoring child element order?
Schema Indicator 'all' not ignoring child element order?
Status: RESOLVED INVALID
Product: libxml2
Classification: Platform
Component: general
2.6.11
Other All
: Normal blocker
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2005-10-18 15:49 UTC by TJ
Modified: 2005-10-18 18:00 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description TJ 2005-10-18 15:49:03 UTC
Please describe the problem:
Working with libxml2 2.6.11 included in PHP 5.0.5 for Windows.

Trying to validate XML against a custom Schema, a complexType with Indicator
'all' fails to validate. The data and its schema validate correctly using XML
Spy, and appear to match the standards.

Indicator All: "The all element specifies that the child elements can appear in
any order and that each child element can occur zero or one time."

It seems as if libxml is still enforcing the order of the child elements,
because when they are shuffled about the document can be made to validate.

TJ.


Steps to reproduce:
1. Create a simple XML Schema
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="Placemark">
<xs:complexType>
<xs:sequence>
<xs:element ref="Point"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Point">
<xs:complexType>
<xs:all minOccurs="0">
<xs:element ref="altitudeMode" minOccurs="0"/>
<xs:element ref="coordinates"/>
<xs:element ref="extrude" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="altitudeMode">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="absolute"/>
<xs:enumeration value="clampedToGround"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="coordinates" type="xs:string"/>
<xs:element name="extrude" type="xs:byte"/>
<xs:element name="kml">
<xs:complexType>
<xs:sequence>
<xs:element ref="Placemark" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>


2. Create a simple Data Set
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="schema.xsd">
<Placemark>
<Point>
<coordinates>-0.855907 52.871387 0</coordinates>
</Point>
</Placemark>
<Placemark>
<Point>
<extrude>2</extrude>
<coordinates>-0.855907 52.871387 0</coordinates>
<altitudeMode>absolute</altitudeMode>
</Point>
</Placemark>
<Placemark>
<Point>
<altitudeMode>absolute</altitudeMode>
<extrude>2</extrude>
<coordinates>-0.855907 52.871387 0</coordinates>
</Point>
</Placemark>
<Placemark>
<Point>
<coordinates>-0.855907 52.871387 0</coordinates>
<altitudeMode>clampedToGround</altitudeMode>
</Point>
</Placemark>
</kml>


3. Try to validate. Create a DOMDocument associated with the schema, load it
with data, and call DOMDocument->validateSchema('schema.xsd').

<?php
$check = ""; // ** Insert the test XML data here

// Document information
const DOC_VERSION = '1.0';
const DOC_ENCODING = 'UTF-8';
const QUALIFIED_NAME = 'kml';
const NAMESPACE_URI = 'http://earth.google.com/kml/2.0';
const DTD_QNAME = 'kml';
const DTD_SYSTEM_ID = 'kml.dtd';

// note that this code is taken from a class that validates Schema and DTD
$imp = new DomImplementation; // prepare the DTD
$dtd = $imp->createDocumentType(DTD_QNAME, '', DTD_SYSTEM_ID);
$dom = $imp->createDocument('','',$dtd); // create a new DOM Document
$dom->encoding = DOC_ENCODING;
$dom->version = DOC_VERSION;
$dom->standalone = true;

$dom->loadXML($check); // load the data set

$dom->schemaValidate('schema.xsd'); // try to validate the schema
?>

Warning: Element Point content check failure in ...
Warning: Element Point content check failure in ...
Warning: Element Point content check failure in ...
Warning: Element Point content check failure in ...
Warning: Element Point content check failure in ...

Actual results:
Fails to parse as expected, giving error "Element XXXX content check failure in..."

Expected results:
The document would validate.

Does this happen every time?
Yes

Other information:
Comment 1 Rob Richards 2005-10-18 18:00:05 UTC
Works fine with recent libmxml2. PHP needs its windows lib updated.