Validating XML Schema

From: Date: Sat, 20 Nov 2004 21:31:09 +0000
Subject: Validating XML Schema
Groups: php.general 
Request: Send a blank email to php-general+get-202566@lists.php.net to get a copy of this message
Hi, I am trying to use php to validate a document using it's schema. I keep getting Warning: Element 'Invoices': No matching global declaration available. My xsd has <?xml version="1.0" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.mysite.com" xmlns="http://www.mysite.com" elementFormDefault="qualified"> <xs:element name="Invoices" type="InvoicesType"/> <xs:complexType name="InvoicesType"> <xs:element name="Invoice" type="xs:string"/> </xs:complexType> </xs:schema> The xml test <?xml version="1.0" ?> <Invoices> <Invoice>10</Invoice> </Invoices> The php $xml = new DOMDocument(); $xml->load( 'invoice.xml' ); if ($xml->schemaValidate("invoice.xsd")) { echo "Validated OK" ; } else { echo "Validate FAILED"; }

« previous php.general (#202566) next »