Is there a way we can dynamically create table and structure for a database using Xml?
So that columns are generated using Xml as a reference.
Is something like that available in Cakephp?
Below is the sample XML that I intend to use: (I did not copy paste all of them as it is rather large)
</dsr_data_agg_stats>
<state code="ACT">
<post_code code="2600">
<locality name="DEAKIN">
<dwelling_type code="H">
<typical_value rank="3341/3697">831000</typical_value>
<dom score="1" rank="454/5673">56</dom>
<discount score="0" rank="779/5673">5%</discount>
<acr score="-1" rank="914/5531">59%</acr>
<renters score="0" rank="5131/5627">42%</renters>
<vacancy score="1" rank="4714/5673">2.61%</vacancy>
<yield score="-1" rank="678/3697">3.69%</yield>
<som score="1" rank="3915/5144">2.08%</som>
<search_dsr score="-3" rank="3578/4009">4.9</search_dsr>
<dsr rank="3121/5673">23</dsr>
<sr rank="2552/5673">5.8</sr>
</dwelling_type>
</locality>
<locality name="YARRALUMLA">
<dwelling_type code="H">
<typical_value rank="3438/3697">931250</typical_value>
<dom score="1" rank="454/5673">56</dom>
<discount score="0" rank="779/5673">5%</discount>
<acr score="-2" rank="1999/5531">42%</acr>
<renters score="0" rank="5131/5627">42%</renters>
<vacancy score="1" rank="4714/5673">2.61%</vacancy>
<yield score="1" rank="678/3697">4.76%</yield>
<som score="0" rank="4333/5144">3.03%</som>
<search_dsr score="-3" rank="3277/4009">7</search_dsr>
<dsr rank="3121/5673">23</dsr>
<sr rank="2552/5673">5.8</sr>
</dwelling_type>
…
I’m working on doing something similar, but with RSS feeds. I’ve found that I really like the redis syntax, which allows you to use as complex and rigidly structured a vocabulary as you like, but with all the advantages of access to any of the the major modern datatypes, laid out flatly on a hash map. There are very easy-to-use clients in a ton of different languages, but it boils down to thinking about how you can reliably structure string patterns to find what you want, like below, in the pattern ‘action’ ‘key’ ‘value’, where $ denotes a variabe component of the given string:
I use PHP to interact directly with redis, and make client-side calls via jQuery $.post async interactions to a server-side interface which routes commands to the redis accessor class. The interface is pretty simple. Here is the jQuery side.
and an example query_map looks like the following:
which for example the the PHP router could interpret with:
where $this->locality_by_id() is a query you wrote to touch redis via the predis client interface.
Redis makes random access of XML files much faster and easier to wrap your head around, once you wrap your head around laying tree data structures out on a flat map. Meaning, you have to write a parser that converts the DOM items to redis-friendly key-value pairs. I’m sure you’ll have some ideas about how best to do this. And once you’ve written a converter, it will be easy to do the reverse.
(I would add more links, but spam control sez no)