id0 Posted July 15, 2008 Share Posted July 15, 2008 hi, i'm new to xml schema and i don't see a way to validate my xml file.here is 2 xml sample : <liste> <entete> <colonne name="filename" /> <colonne name="size" /> </entete> <item> <filename>File 2</filename> <size>14523</size> </item> <item> <filename>File 3</filename> <size>5901</size> </item></liste> and <liste> <entete> <colonne name="filename" /> <colonne name="size" /> <colonne name="date" /> <colonne name="info" /> </entete> <item> <filename>File 2</filename> <size>14523</size> <date>01.01.01</date> <info>new file</info> </item> <item> <filename>File 3</filename> <size>5901</size> <date>02.02.02</date> <info>old file</info> </item></liste> i need an XSD that can validate both xml and i don't see how to do that as u can see the attribute "name" on the "colonne" element gives the element name inside item element.any help is welcome, i'll continue searching for a solution on the web anyway.thks Link to comment Share on other sites More sharing options...
boen_robot Posted July 15, 2008 Share Posted July 15, 2008 There is no way to do that in XML Schema 1.0. I think XML Schema 1.1 will provide such a facility. Link to comment Share on other sites More sharing options...
id0 Posted July 15, 2008 Author Share Posted July 15, 2008 thank you boen_robot, i'll validate my xml Through a PHP script then Link to comment Share on other sites More sharing options...
boen_robot Posted July 16, 2008 Share Posted July 16, 2008 Well, you could have a basic, really loose schema against you could verify the document initially.Then, after analyzing the entete contents, you could generate a new schema with PHP, and validate against that. That's the first time I've ever thought about this, so doing it may not be as easy as it sounds, nor it will be efficient, but it sounds like something worth playing with. Link to comment Share on other sites More sharing options...
id0 Posted July 16, 2008 Author Share Posted July 16, 2008 yep, i also thought about making an xsd in php using the "entete" content to check if all the <item> element are well done. I'll try that tomorrow since i 've worked on something else today Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.