Bug #79391 [NEW]: Dom validate schema does not accepts tag <xs:assert test="..." />

From: Date: Wed, 18 Mar 2020 11:07:53 +0000
Subject: Bug #79391 [NEW]: Dom validate schema does not accepts tag <xs:assert test="..." />
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226145@lists.php.net to get a copy of this message
From: joao dot rebelo at pchouse dot pt Operating system: Windows PHP version: Irrelevant Package: DOM XML related Bug Type: Bug Bug description:Dom validate schema does not accepts tag <xs:assert test="..." /> 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 bug report at https://bugs.php.net/bug.php?id=79391&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79391&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79391&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79391&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79391&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79391&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79391&r=support Expected behavior: https://bugs.php.net/fix.php?id=79391&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79391&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79391&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79391&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79391&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79391&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79391&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79391&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79391&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79391&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79391&r=mysqlcfg

« previous php.bugs (#226145) next »