|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33880 Bug in function "schemaValidate"
Submitted: 2005-07-27 08:47 UTC Modified: 2005-07-27 12:20 UTC
From: thomas dot wetzler at siemens dot com Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 5.0.4 OS: SUN OS
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: thomas dot wetzler at siemens dot com
New email:
PHP Version: OS:


 [2005-07-27 08:47 UTC] thomas dot wetzler at siemens dot com
To validate a dataset, I try to generate a XML-Schema with the help of an database-definition. The Schema-file is correctly build. XMLSpy works with it fine... but if I try to run the same files with php, php reports a failure.

Reproduce code:

$xml = new DOMDocument(); 
if ($xml->schemaValidate("gd.xsd")) { 
     echo "Validated OK"; 
} else { 
     echo "Validate FAILED"; 

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- edited with XML Spy v4.4 U ( -->
<element xmlns:xsi="" xsi:noNamespaceSchemaLocation="D:\gp.xsd">
		<content> 10149764</content>
		<content> DEB4 PATENTSCHRIFT</content>
		<content> Huettlin, Herbert, Dr.h.c., 79539 Loerrach, DE.</content>
		<content> Huettlin, Herbert, Dr.h.c., 79539 Loerrach, DE.</content>

<?xml version="1.0"?>
<xs:schema xmlns:xs="" elementFormDefault="qualified">
	<xs:attributeGroup name="controlsequences">
		<xs:attribute name="pre" type="xs:string"/>
		<xs:attribute name="post" type="xs:string"/>
	<xs:complexType name="type_subelement">
				<xs:element name="header" type="columns" fixed="AN"/>
				<xs:element name="content" type="type_an"/>
				<xs:element name="header" type="columns" fixed="PN"/>
				<xs:element name="content" type="type_pn"/>
				<xs:element name="header" type="columns" fixed="IN"/>
				<xs:element name="content" type="type_in"/>
				<xs:element name="header" type="columns" fixed="PA"/>
				<xs:element name="content" type="type_pa"/>
				<xs:element name="header" type="columns" fixed="DT"/>
				<xs:element name="content" type="type_dt"/>
	<xs:simpleType name="columns">
		<xs:restriction base="xs:string">
			<xs:enumeration value="AN"/>
			<xs:enumeration value="PN"/>
			<xs:enumeration value="IN"/>
			<xs:enumeration value="PA"/>
			<xs:enumeration value="DT"/>
	<xs:simpleType name="type_an">
		<xs:restriction base="xs:string">
			<xs:maxLength value="80"/>
	<xs:simpleType name="type_pn">
		<xs:restriction base="xs:string">
			<xs:maxLength value="1600"/>
	<xs:simpleType name="type_in">
		<xs:restriction base="xs:string">
			<xs:maxLength value="1600"/>
	<xs:simpleType name="type_pa">
		<xs:restriction base="xs:string">
			<xs:maxLength value="1600"/>
	<xs:simpleType name="type_dt">
		<xs:restriction base="xs:string">
			<xs:maxLength value="1600"/>
	<xs:element name="subelement" type="type_subelement"/>
	<xs:element name="element">
				<xs:element ref="subelement" maxOccurs="unbounded"/>

Expected result:
Validated OK

Actual result:
Warning: Element decl. 'subelement': The content model is not determinist. in /wir/searchservertest/src/load_db/xml_parser/test.php on line 6

Warning: Invalid Schema in /wir/searchservertest/src/load_db/xml_parser/test.php on line 6
Validate FAILED


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-27 12:20 UTC]
the actual XML Schema parsing is done by libxml2 and not PHP. So any XML Schema "bug" is a libxml2 issue.

I recommend first updating to the latest libxml2 release (2.6.20) as the XML Schema support made big improvements lately and if the bug persits, ask on the libxml2 mailinglist (or file a bug report there)

nothing we can do about.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Dec 04 03:01:23 2020 UTC