Bug->Doc #79391 [Csd->ReO]: Dom validate schema does not support XML Schema 1.1

From: Date: Sat, 06 Jun 2020 11:28:22 +0000
Subject: Bug->Doc #79391 [Csd->ReO]: Dom validate schema does not support XML Schema 1.1
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-17636@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79391&edit=1 ID: 79391 Updated by: cmb@php.net Reported by: joao dot rebelo at pchouse dot pt -Summary: Dom validate schema does not accepts tag <xs:assert test="..." /> +Summary: Dom validate schema does not support XML Schema 1.1 -Status: Closed +Status: Re-Opened -Type: Bug +Type: Documentation Problem Package: DOM XML related Operating System: Windows PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Thanks for the follow-up! I think this "detail" should be documented. Previous Comments: ------------------------------------------------------------------------ [2020-06-05 16:45:01] joao dot rebelo at pchouse dot pt The issue is from libxml2, response: https://gitlab.gnome.org/GNOME/libxml2/-/issues/162#note_829986 <xs:assert> is an XML Schema 1.1 feature. libxml2 only supports XML Schema 1.0. ------------------------------------------------------------------------ [2020-04-02 11:28:10] cmb@php.net Thanks for providing the XSD and the example! I can confirm the reported behavior; I'm not sure about the cause. There *might* be a bug in libxml2. ------------------------------------------------------------------------ [2020-03-18 12:09:38] joao dot rebelo at pchouse dot pt About; Isn't that supposed to be <xs:assertion>? I think not the xsd file is from the Portuguese Tax Authotity and works fine in Java app. The link of the xsd file is: http://info.portaldasfinancas.gov.pt/apps/saft-pt04/saftpt1.04_01.xsd And a xml example file is here: https://info.portaldasfinancas.gov.pt/apps/saft-pt01/local/saft_idemo599999999.xml ------------------------------------------------------------------------ [2020-03-18 11:46:57] cmb@php.net Isn't that supposed to be <xs:assertion>? ------------------------------------------------------------------------ [2020-03-18 11:07:52] joao dot rebelo at pchouse dot pt Description: ------------ Dom validate schema does not accepts tag <xs:assert test="..." />, part of xsd <xs:sequence> <xs:element ref="TaxonomyReference"/> <xs:element name="Account" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="AccountID" type="SAFPTGLAccountID"/> <xs:element ref="AccountDescription"/> <xs:element ref="OpeningDebitBalance"/> <xs:element ref="OpeningCreditBalance"/> <xs:element ref="ClosingDebitBalance"/> <xs:element ref="ClosingCreditBalance"/> <xs:element ref="GroupingCategory"/> <xs:element name="GroupingCode" type="SAFPTGLAccountID" minOccurs="0"/> <xs:element name="TaxonomyCode" type="SAFTaxonomyCode" minOccurs="0"/> </xs:sequence> <xs:assert test=" if ((ns:GroupingCategory != 'GM' and not(ns:TaxonomyCode)) or (ns:GroupingCategory eq 'GM' and ns:TaxonomyCode)) then true() else false()" /> <xs:assert test=" if ((ns:GroupingCategory eq 'GR' and not(ns:GroupingCode)) or (ns:GroupingCategory eq 'AR' and not(ns:GroupingCode)) or (ns:GroupingCategory eq 'GA' and ns:GroupingCode) or (ns:GroupingCategory eq 'AA' and ns:GroupingCode) or (ns:GroupingCategory eq 'GM' and ns:GroupingCode) or (ns:GroupingCategory eq 'AM' and ns:GroupingCode)) then true() else false()" /> </xs:complexType> Test script: --------------- try { \libxml_use_internal_errors(true); $validate = true; $dom = new \DOMDocument("1.0", "ISO-8859-1"); $dom->load("D:/Downloads/saftpt1.04_01.xsd"); $validate = $dom->schemaValidate(self::XSD_PATH); } catch (\Exception $e) { $allErrors = libxml_get_errors(); $a = $e->getMessage(); } Expected result: ---------------- Should accept the xsd to validate the xml Actual result: -------------- Throws error, [0] => LibXMLError object { level => (int) 2 code => (int) 3033 column => (int) 0 message => (string) Element '{http://www.w3.org/2001/XMLSchema}complexType': The content is not valid. Expected is (annotation?, (simpleContent | complexContent | ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?)))). file => (string) file:/D:/NetBeansProjects/PHP/Saft-PT_4_PHP/tests/Rebelo/Test/../../Ressources/saftpt1.04_01.xsd line => (int) 196 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79391&edit=1

« previous php.doc.bugs (#17636) next »