Hello, I have a premade XML schema from a third-party but wish to know is it possible to use this as a way of creating an XML document that conforms to this schema using PHP ? I'm using a schema from Garmin : http://www.garmin.com/xmlschemas/TrainingCenterDatabasev2.xsd ..and my website creates a series of points from a google map which will form the data of a course, eventually to be put into a .TCX file (Garmin's own XML document). The schema provides the framework for the .TCX file but how can I use the schema to generate the file ? As far as I have read, schemas are only good for validating XML files. So how does one use a schema to create an XML file (using PHP) ? Or is this not the purpose of schema ? Many thanks for anybody's reply
Short answer, it doesn't. The schema is the blueprint. It tells you what is allowed, what's required and where it goes. It does nothing to put it there, that's the coder's job. The schema helps though since lots of questions are answered already.
Thanks for the reply shallowink.. I suspected as much ! The thing is.. a schema, particularly the one I have to work with is not really in a human readable form, it would be much better presented graphically as a tree. Are there any freeware programs that will present schemas as such ?
What I did was I took the php xml parser and made it parse the XSD. Essentially looking for minOccurs so I knew what was required then printed out the annotations to give me a semi legible copy to work from. Maybe that's not what you want, maybe cooktop or one of the other xml editors would help you more.