Schema Validation (devkit)
This is an open discussion with 8 replies, filed under Extensions.
Search
You are a star! Just what I needed!
Can a developer specify external URLs for the schema files if they are hosted at another location?
Also, can this functionality be hooked into from other extensions? My use case would be writing an extension to hook into an external API system that requires the XML to be validated on each call.
In this version, you will need to add the XSD files to a folder in /workspace/xsd/
. I guess it should not be hard to make this work using an external URL. I will create an issue for this on GitHub!
Can you clarify the use case for me, I don't think I understand. You want to use the validator in other extensions? Because if this is the case, that is indeed possible. The validation is done by a separate class called /lib/SchemaValidator.php
.
Simply include this file, create an instance of the SchemaValidator
class and call the validate()
function. It returns a boolean value indicating if the validation was successful. If it fails, you will find the errors as an array in the getErrors()
property getter.
Keep in mind that the Schema Validation extension is initially created to validate the XML output generated by Symphony based on parameters, events and datasources. External schema's should support this structure, else validation will fail.
If you want to be able to validate specific parts of the XML output, or non-symphony XML, this still needs to be implemented.
So if I were to make a page that output xml in a certain schema, would this extension be able to validate that?
As for the use case, I would be making pages that output xml and have an extension that would call these pages to send them off to an external API for acquisition into another system, but they will need to be validated first against a schema supplied by the other end, also I would need to validate the response.
edit: It seems like an odd setup, I know. One would expect the receiving REST service to validate the markup, but this one doesn't. This one just doesn't do anything, or even error out.
Validating standard Symphony xml doesn't seem like a requirement for me as we can already safely know what is coming out of the system.
Ok, so you want to be able to validate the output. I guess I didn't get that the first time around :) I will make the appropriate adjustments!
Schema Validation (devkit)
updated to version 0.9.1
on 31st of August 2011
@designermonkey: have you tried using the extension yet?
Not had chance to I'm afraid. I've been ordered to use Codeigniter instead, which I'm pretty miffed about, but hey, they're the bosses.
Create an account or sign in to comment.
A new extension, "Schema Validation (devkit)" is now available for download. Comments and feedback can be left here but if you discover any issues, please post it on the issue tracker.