I am considering to store my html document in table like this:
id content parent tag
1 0 html
2 1 head
3 1 body
4 Main page 2 title
5 Hello world 3 h1
This is just simplistic example. The result should be
<html>
<head>
<title> Main page </title>
</head>
<body>
<h1> Hello world </h1>
</body>
</html>
Right now, I am able to use CTE with SQL to have query resulting in correct tree structure. My idea was inspired by this page: https://www.sqlite.org/lang_with.html (Scroll down for the best part as solving sudoku with sql.)
I want to use sql as most as possible to avoid php code for my reasons. My questions are like this:
Do you have any idea to finish the process? (E.g. map html tags, orderings, inserting and deleting nodes etc). Any thoughts would be appreciated.
Did you try (or see) anything similar? Personal experiences, tutorials and so on?
How would you suggest to make table structures? For example to avoid repeating of same html structures (typically headers, menus, footers)?
Anything else what could be useful and related to this topic?
I hope you find this topic as intriguing as me :)
PS: I want to use SQLite but I think it doesnt matter if you wont suggest anything too much database specific
PPS: Please read before you advice it is not good idea :)
I would like to make most part of project in sql. It is my time to waste so dont worry :) It is just experimental thing. I would use python instead of php if the choice of language was that important. Basically, as you have ORM to have database-independent apps I am trying to make opposite - to have language independent sql database accessed just by any language. That is my target more or less. Speaking of wasting my time I could say the very same for the poor ones who are involved in any php frameworks. Recently, I had checked few of them and from my perspective I would call waste of time something really different :)