
wow...just wow.
pass it to XSLT for presentation
Snap! I use that too, I like it very much
The other value of doing it this way is that I only load contextual information into memory, VS one-mega-XML file.
Hmm yes that is a big plus, I am slightly worried about the complexity of the data in the database and the number of queries required to pull a single node. but this is something you can only know having done it.
So you want to bind classes (behaviour) to specific nodes names? For instance:
Code: Select all
<wood>
<tree type="oak" />
<weed type="kettle" />
</wood
Code: Select all
class Wood extends XmlDataType
{
public function removeWeeds()
{
// necessary database interactions
}
}
only bolster that kind of stuff on top of DOM.
You could of course rewrite a DOM that interacts with your database directly, this would be even better performance wise because you then only need to query
exactly what you need. So if you just want to get the first child in the wood (1000s of trees and weeds) you wouldn't pull the entire wood and construct loads of DOM objects to do so.
Another technique (really tricky tho):
Compile your XML files somehow. So that the byte offsets certain things are stored in a binary file and you can find things really quickly / get portions of XML files without loading the entire thing first. Perhaps someone has already done something like this (doubtful in PHP but the Java world maybe). This does remove all the issue of database interactions for you though. Again you would need to code your own DOM.