From:             thomas dot wetzler at siemens dot com
Operating system: SUN OS
PHP version:      5.0.4
PHP Bug Type:     DOM XML related
Bug description:  Bug in function "schemaValidate"

Description:
------------
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:
---------------
test.php:
#!/wir/webadmin/share/php504/bin/php
<?

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

?>
--------------------------------------------
gd.xml:
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- edited with XML Spy v4.4 U (http://www.xmlspy.com) -->
<element xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="D:\gp.xsd">
        <subelement>
                <header>PN</header>
                <content> 10149764</content>
        </subelement>
        <subelement>
                <header>DT</header>
                <content> DEB4 PATENTSCHRIFT</content>
        </subelement>
        <subelement>
                <header>PA</header>
                <content> Huettlin, Herbert, Dr.h.c., 79539 Loerrach, 
DE.</content>
        </subelement>
        <subelement>
                <header>IN</header>
                <content> Huettlin, Herbert, Dr.h.c., 79539 Loerrach, 
DE.</content>
        </subelement>
</element>

--------------------------------------------------------
gd.xsd:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
elementFormDefault="qualified">
        <xs:attributeGroup name="controlsequences">
                <xs:attribute name="pre" type="xs:string"/>
                <xs:attribute name="post" type="xs:string"/>
        </xs:attributeGroup>
        <xs:complexType name="type_subelement">
                <xs:choice>
                        <xs:sequence>
                                <xs:element name="header" type="columns" 
fixed="AN"/>
                                <xs:element name="content" type="type_an"/>
                        </xs:sequence>
                        <xs:sequence>
                                <xs:element name="header" type="columns" 
fixed="PN"/>
                                <xs:element name="content" type="type_pn"/>
                        </xs:sequence>
                        <xs:sequence>
                                <xs:element name="header" type="columns" 
fixed="IN"/>
                                <xs:element name="content" type="type_in"/>
                        </xs:sequence>
                        <xs:sequence>
                                <xs:element name="header" type="columns" 
fixed="PA"/>
                                <xs:element name="content" type="type_pa"/>
                        </xs:sequence>
                        <xs:sequence>
                                <xs:element name="header" type="columns" 
fixed="DT"/>
                                <xs:element name="content" type="type_dt"/>
                        </xs:sequence>
                </xs:choice>
        </xs:complexType>
        <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:restriction>
        </xs:simpleType>
        <xs:simpleType name="type_an">
                <xs:restriction base="xs:string">
                        <xs:maxLength value="80"/>
                </xs:restriction>
        </xs:simpleType>
        <xs:simpleType name="type_pn">
                <xs:restriction base="xs:string">
                        <xs:maxLength value="1600"/>
                </xs:restriction>
        </xs:simpleType>
        <xs:simpleType name="type_in">
                <xs:restriction base="xs:string">
                        <xs:maxLength value="1600"/>
                </xs:restriction>
        </xs:simpleType>
        <xs:simpleType name="type_pa">
                <xs:restriction base="xs:string">
                        <xs:maxLength value="1600"/>
                </xs:restriction>
        </xs:simpleType>
        <xs:simpleType name="type_dt">
                <xs:restriction base="xs:string">
                        <xs:maxLength value="1600"/>
                </xs:restriction>
        </xs:simpleType>
        <xs:element name="subelement" type="type_subelement"/>
        <xs:element name="element">
                <xs:complexType>
                        <xs:sequence>
                                <xs:element ref="subelement" 
maxOccurs="unbounded"/>
                        </xs:sequence>
                </xs:complexType>
        </xs:element>
</xs:schema>




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

-- 
Edit bug report at http://bugs.php.net/?id=33880&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33880&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=33880&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=33880&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=33880&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=33880&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=33880&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=33880&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=33880&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=33880&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=33880&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=33880&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=33880&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=33880&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33880&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=33880&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=33880&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=33880&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33880&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=33880&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33880&r=mysqlcfg

Reply via email to