php and xsd

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
snicolas
Forum Commoner
Posts: 97
Joined: Tue Nov 09, 2004 8:32 am

php and xsd

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

snicolas
Forum Commoner
Posts: 97
Joined: Tue Nov 09, 2004 8:32 am

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

maybe you should look into the xml extensiosn in php..
snicolas
Forum Commoner
Posts: 97
Joined: Tue Nov 09, 2004 8:32 am

Post by snicolas »

here we go again..your favourite "simple" answers.
I looked in the xml php section for 3 hrs...!
s
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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..
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post 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.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post 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.
snicolas
Forum Commoner
Posts: 97
Joined: Tue Nov 09, 2004 8:32 am

Post by snicolas »

thanks onion2k and Patrick for the extra info..

will dig in ...

s
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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)
Post Reply