News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Francois Zaninotto's Blog:
Validating a YAML file against a schema in PHP
September 24, 2008 @ 12:58:35

Francois Zaninotto submitted a tutorial he's written up about creating a YAML validation script with PHP.

As of today, there is no simple way to validate the syntax of a YAML file in PHP. But with two simple tricks, it takes only a few dozens of lines of code to build a robust validator capable of checking the syntax of any YAML file against a given schema.

He points out that Ruby has a tool for this (kwalify) but PHP doesn't. He creates his own with the help of the sfYaml component from the symfony framework, translating the YAML data into something PHP can parse more easily - XML. He passes this through an XSL parser and uses the DOM XML schemaValidate function to check it against the given schema.

0 comments voice your opinion now!
yaml validate tutorial schema xsl domxml sfyaml symfony framework


blog comments powered by Disqus

Similar Posts

International PHP Magazine: Poll: Which is your favorite trick in running Symfony with Subversion?

Geshan Manandhar: 3 Bundles to get started with REST in Symfony 2 and some tips

NETTUTS.com: CodeIgniter from Scratch: File Uploading and Image Manipulation

Zend: Roll Your Own Search Engine with Zend_Search_Lucene

Lorna Mitchell: Using Phing with Travis CI


Community Events

Don't see your event here?
Let us know!


introduction series yii2 symfony composer community laravel framework opinion podcast language testing php7 interview list project api example part2 application

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework