![]() |
XML as a datasource.? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: XML as a datasource.? (/showthread.php?tid=11428) |
XML as a datasource.? - El Forum - 09-08-2008 [eluser]rvent[/eluser] Hello, Our ERP uses IBM UniData and the version we run does not support connection pooling so we would have to use Red Back Object in order to access our data. I am not familiar with RBO so i want to avoid having to go that route. So here is can i can do. UniData can generate and XML file with the results from the query Code: <?xml version="1.0"?> How can i use CI to use that XML file as a database..? I want to be able to have some sort of selection based on team and return a JSON to my JavaScript pages... Possible...? Any ideas...? Thanks XML as a datasource.? - El Forum - 09-10-2008 [eluser]gRoberts[/eluser] its possible but all depends on how much functionality you want to have. Do you want to be able to search any/specific columns with part or whole values? XML as a datasource.? - El Forum - 09-15-2008 [eluser]madla[/eluser] I've got the same question. I have a list of articles in an XML file (an Rss feed). I want to be able to search the articles based on the meta data e.g. categories. No updates no changes, just for search purposes. How would I go about connecting the xml file as a database? Thanks...martin XML as a datasource.? - El Forum - 09-15-2008 [eluser]Crafter[/eluser] [quote author="madla" date="1221526953"]I've got the same question. How would I go about connecting the xml file as a database? [/quote] That would only be the route if you want to run database queries against the XML file. In that case, you would want to create a new adapter for xml data sources. Probably more trouble than it is worth. Otherwise, create a model to read/write the xml files. If you need more than one model reading from xml sources, you might look at implementing an xml library if you don;t have one. XML as a datasource.? - El Forum - 09-16-2008 [eluser]Michael Wales[/eluser] A pretty simple function I have only tested on the del.icio.us API but it seems to be working properly - will convert an XML string into a multi-dimensional array. Code: function xml2array($contents, $get_attributes=1) { XML as a datasource.? - El Forum - 09-16-2008 [eluser]Bramme[/eluser] PHP has 3 built in XML parsing classes (if I'm not mistaken). xml_parser being one of them. I guess you should look into those. I know there's one that's pretty easy (read: simple with not so much functions), but I can't think of the name right away. XML as a datasource.? - El Forum - 09-16-2008 [eluser]madla[/eluser] Thanks for the quick responses! The reason I was thinking db was, that once the file is parsed, I'll have to hit the data constantly for filtering out part and bits. But I can read it once and cache it on the Application scope assuming there is such a thing in CI (I'm new to CI -- but liking it already). Thanks again...martin |