Serializing XML data to store in MySQL with PHP
I have a series of very complex XML files. I need to access these often, so reading .xml files is something of a hangup. I've been considering writing a series of massive SQL statements, but before I begin that massive task, I wanted to know about serializing whole XML files to store as blobs in MySQL.
My intentions: XML -> store_into_database() database -> read_seralized_data($row) echo -> un_serialize_data($row)
This would allow me to store .xml files that I parse from an onlinedatabse, and only have to do I/O operations once.
or is the the wrong way to do this?
XML is a conspiracy foisted on the world by storage manufacturers seeking to increase their profits by making all data bloat exponentially in size by xmling it all. It's crap as a storage/retrieval format, with both massive storage and parsing overhead.
Since you need to access these xml files often, you'd be better off converting them into a native SQL table structure so you can use actual DB operations, indexing, etc... on them. If you're lucky, maybe you've got a DB that can handle XML natively, and you should take advantage of that. otherwise you're stucking retrieving a blob, unserializing the blob, feeding that blob into a DOM parser, then doing DOM operations, each and every time you need to check if the sky is still blue.