3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $schema = <<<SCHEMA <?xml version="1.0" encoding="utf-8"?> <xs:schema id="vnd.autotrack.supplier.car.request" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="0.3"> <xs:element name="aanbieder_vraag" > <xs:complexType> <xs:sequence> <xs:element name="auto_id" minOccurs="1" maxOccurs="1"> <xs:simpleType> <xs:restriction base="xs:integer"> <xs:minInclusive value="0" /> <xs:maxInclusive value="9999999999" /> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="aanbieder_id" minOccurs="1" maxOccurs="1"> <xs:simpleType> <xs:restriction base="xs:integer"> <xs:minInclusive value="0" /> <xs:maxInclusive value="9999999999" /> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="email" minOccurs="1" maxOccurs="1"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:maxLength value="80" /> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="stuur_kopie" minOccurs="1" maxOccurs="1"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="J"/> <xs:enumeration value="N"/> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="soort_aanvraag" minOccurs="1" maxOccurs="1"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="P"/> <xs:enumeration value="V"/> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="telefoon" nillable="true" minOccurs="0" maxOccurs="1"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:minLength value="10" /> <xs:maxLength value="10" /> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="datum" nillable="true" minOccurs="0" maxOccurs="1"> <xs:simpleType> <xs:restriction base="xs:date" /> </xs:simpleType> </xs:element> <xs:element name="vragen" minOccurs="0" maxOccurs="1"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:maxLength value="1000" /> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="locale" minOccurs="0" maxOccurs="1" default="nl_NL"> <xs:complexType> <xs:restriction base="xs:string"> <xs:enumeration value="nl_NL"/> <xs:enumeration value="nl_BE"/> <xs:enumeration value="fr_BE"/> </xs:restriction> <xs:attribute name="is-foo" type="xs:boolean" default="true" use="optional" /> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> SCHEMA; $xml = <<<XML <?xml version="1.0"?> <aanbieder_vraag><auto_id>7493124</auto_id><aanbieder_id>40284</aanbieder_id><email>nbelhomme@enrise.com</email><stuur_kopie>J</stuur_kopie><soort_aanvraag>V</soort_aanvraag><vragen>blabla</vragen></aanbieder_vraag> XML; $document = new DOMDocument(); $document->loadXML($xml); $document->schemaValidateSource($schema, LIBXML_SCHEMA_CREATE); $document->resolveExternals = true; $document->substituteEntities = true; var_dump($document->getElementsByTagName('locale'));
Output for 5.5.2 - 5.6.28, 7.0.0 - 7.1.0
Warning: DOMDocument::schemaValidateSource(): 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?)))). in /in/XrpdW on line 101 Warning: DOMDocument::schemaValidateSource(): Invalid Schema in /in/XrpdW on line 101 object(DOMNodeList)#2 (1) { ["length"]=> int(0) }
Output for hhvm-3.10.0 - 3.13.2
Warning: DOMDocument::schemaValidateSource() expects exactly 1 parameter, 2 given in /in/XrpdW on line 101 object(DOMNodeList)#2 (1) { ["length"]=> int(0) }
Output for 5.3.11 - 5.3.29, 5.4.1 - 5.5.1
Notice: Use of undefined constant LIBXML_SCHEMA_CREATE - assumed 'LIBXML_SCHEMA_CREATE' in /in/XrpdW on line 101 Warning: DOMDocument::schemaValidateSource() expects exactly 1 parameter, 2 given in /in/XrpdW on line 101 object(DOMNodeList)#2 (1) { ["length"]=> int(0) }
Output for 5.0.0 - 5.1.1, 5.1.3 - 5.3.10, 5.4.0
Notice: Use of undefined constant LIBXML_SCHEMA_CREATE - assumed 'LIBXML_SCHEMA_CREATE' in /in/XrpdW on line 101 Warning: DOMDocument::schemaValidateSource() expects exactly 1 parameter, 2 given in /in/XrpdW on line 101 object(DOMNodeList)#2 (0) { }
Output for 5.1.2
Notice: Use of undefined constant LIBXML_SCHEMA_CREATE - assumed 'LIBXML_SCHEMA_CREATE' in /in/XrpdW on line 103 Warning: DOMDocument::schemaValidateSource() expects exactly 1 parameter, 2 given in /in/XrpdW on line 103 object(DOMNodeList)#2 (0) { }
Output for 4.3.2 - 4.4.1, 4.4.3 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/XrpdW on line 99
Process exited with code 255.
Output for 4.4.2
Fatal error: Cannot instantiate non-existent class: domdocument in /in/XrpdW on line 101
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: domdocument in /in/XrpdW on line 99