son Posted November 28, 2008 Share Posted November 28, 2008 I have to convert a comma separated list of products into an xml document (conforming to given xsd specifications). Is there a quick way to do just that? Would take me hours to manually enter 100 products in the XML document.Son Link to comment Share on other sites More sharing options...
boen_robot Posted November 28, 2008 Share Posted November 28, 2008 Nope. There isn't an easy way to do that.About the easiest one I can think of is to use fgetcvs to turn the file into an array, and then trasnalte the array into a "generic" XML (via SimpleXML or better yet, DOM) that may or may not conform to the schema. If it doesn't, create an XSLT file that would convert it into one that would, and use the XSL extension to execute the transformation. Either way, make sure you validate against the schema with DOMDocument::schemaValidate(). Link to comment Share on other sites More sharing options...
son Posted December 2, 2008 Author Share Posted December 2, 2008 Nope. There isn't an easy way to do that.About the easiest one I can think of is to use fgetcvs to turn the file into an array, and then trasnalte the array into a "generic" XML (via SimpleXML or better yet, DOM) that may or may not conform to the schema. If it doesn't, create an XSLT file that would convert it into one that would, and use the XSL extension to execute the transformation. Either way, make sure you validate against the schema with DOMDocument::schemaValidate().Thanks for your input;-)Son Link to comment Share on other sites More sharing options...
Skemcin Posted December 2, 2008 Share Posted December 2, 2008 Do you need to do this on the fly, or just one initial time? You could try using MS Excel to create the XML, otherwise, you will need a server side scripting language to do as boen_robot outlined. Link to comment Share on other sites More sharing options...
son Posted December 2, 2008 Author Share Posted December 2, 2008 Do you need to do this on the fly, or just one initial time? You could try using MS Excel to create the XML, otherwise, you will need a server side scripting language to do as boen_robot outlined.I will receive soon a comma separated file (or Excel spreadsheet) with data I have to convert. How would I do this with Excel?Son Link to comment Share on other sites More sharing options...
Skemcin Posted December 3, 2008 Share Posted December 3, 2008 If you are using MS Excel 2003, then you simply open the file and save as - and select XML.or, you can use Open Office:re: http://www.openoffice.org/dev_docs/features/1.1/index.html Link to comment Share on other sites More sharing options...
son Posted December 3, 2008 Author Share Posted December 3, 2008 If you are using MS Excel 2003, then you simply open the file and save as - and select XML.or, you can use Open Office:re: http://www.openoffice.org/dev_docs/features/1.1/index.html That sounds easy enough Thanks,Son Link to comment Share on other sites More sharing options...
poorak Posted February 11, 2009 Share Posted February 11, 2009 you can also use altova XMLspy Link to comment Share on other sites More sharing options...
son Posted February 12, 2009 Author Share Posted February 12, 2009 you can also use altova XMLspySounds good, but quite expensive:-(Son Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.