Why isn't server-side web made with XML libs?
Two variants exist: 1) there is the continuation-passing model, used by POJO Java servlets and Node.js, of creating a request and a response objects, and passing them along the pipeline of the request handlers while adding text to the response stream, and 2) there is the tag model, which is the essence of PHP, JSP and if I understood correctly, ASP, where the page itself is raw HTML, with the option of adding actual code to denote business logic, with some syntactic sugar to append to the underlying HTML page which is the text stream.
Now what bugs me is that [X]HTML tries really hard to be a tree, and the current model of treating the HTML response as a fundamentally flat stream leaves the responsibility of creating a well-formed tree to the developer. XML probably is the simplest recursive grammar around, which is the cause of the woes of people who try to treat it with Regex, and Java almost treat XML like an actual extension of itself, and most languages offer decent libraries to read, create and generally mangle XML trees.
So why isn't XHTML created by building XML trees?
Why isn't it mainstream to do stuff like this? (in pseudo-Java)
Element root = new Element("html"); Element body = new Element("body").append(new Element("p").text("Hello, world!")); root.append(body);
Why don't I ever see that idiom?