ID:               33880
 Updated by:       [EMAIL PROTECTED]
 Reported By:      thomas dot wetzler at siemens dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         DOM XML related
 Operating System: SUN OS
 PHP Version:      5.0.4
 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------

[2005-07-27 08:47:55] thomas dot wetzler at siemens dot com

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 this bug report at http://bugs.php.net/?id=33880&edit=1

Reply via email to