tags:

views:

48

answers:

1

I'm trying to write a script in PHP5 that will:

  1. read in an XSD
  2. let the user give an element/tag name which will serve as the context
  3. output a list of elements allowed within that element/tagname based on the XSD

So far I'm only able to see solutions for using XSDs to validate XML files. Anyone done something like this before?

A: 

Check this tool http://github.com/moyarada/XSD-to-PHP It generates PHP classes from XSd schema, and allows XML marshalling/unmarshalling. After you generate PHP models, your IDE will show you which elements/attributes particular item has. See more examples in the test suite /test/Php2XmlTest.php

Mike Bevz