Generate PHP Classes from Xsd

How to use an XSD schema in php

The PHP DOM extension, which is available almost all the time can do this natively.

$dom = new DomDocument;
$dom->loadXML($contentOfResponse);
if ($dom->schemaValidate('path/to/schema.xsd')) {
// Valid response from service
} else {
// Invalid response
}

Of course, you can also load the document to validate from a file.

Documentation: http://ca.php.net/manual/en/domdocument.schemavalidate.php

Generate Java classes from .XSD files...?

JAXB does EXACTLY what you want. It's built into the JRE/JDK starting at 1.6



Related Topics



Leave a reply



Submit