Page 1 of 1

php and xsd

Posted: Tue Mar 01, 2005 9:04 am
by snicolas
Hi,

I have a xsd file and need to create a parser or something to be able to read the information in a "friendly" way.
This xsd file contain a list of attributes that will be used on a form.

I searched the web for hours but cannot find anything about xsd.

s

Posted: Tue Mar 01, 2005 9:21 am
by feyd

Posted: Tue Mar 01, 2005 9:24 am
by snicolas
thx feyd but what can i do with this file ?
The whole idea is to pick up all the informaion in it and try to creat a php page with select options (from this xsd file)

s

Posted: Tue Mar 01, 2005 9:34 am
by feyd
maybe you should look into the xml extensiosn in php..

Posted: Tue Mar 01, 2005 9:37 am
by snicolas
here we go again..your favourite "simple" answers.
I looked in the xml php section for 3 hrs...!
s

Posted: Tue Mar 01, 2005 9:47 am
by feyd
your not understanding it isn't my problem. The ability to parse xml is all there for you using those functions: http://php.net/xml

there have been at least a few threads on xml parsers here.. timvw participated in one..

Posted: Tue Mar 01, 2005 10:33 am
by onion2k
I've yet to encounter a working example of a PHP xml script that can actually make use of an xsd or xsl file. I don't think one exists. Theres loads of examples of PHP xml things that take the raw xml data and turn it into nicer data structure.. but if you're after any sort of validation of an xml file against a schema.. well, I think you're probably screwed.

Posted: Tue Mar 01, 2005 11:00 am
by patrikG
xsd files are XML-schemas which are used as a template when generating XML files. What you most probably want to do is parse an XML file after is has been generated according to the xsd. Read up on XML, the manual is a good start, google another.

Posted: Tue Mar 01, 2005 11:10 am
by snicolas
thanks onion2k and Patrick for the extra info..

will dig in ...

s

Posted: Tue Mar 01, 2005 11:48 am
by timvw
xsd is the xml version of dtd. they both declare the format of an xml document (which tags are allowed, which sibblings can a node have...)

the xml extension in php doesn't allow you to validate against dtd/xsd. (is one of the first lines in the php manual)

but with php5 and the dom extension you can do it :)
just load the DOMDocument and call schemaValidate($path_to_xsd_file)