views:

547

answers:

5

I'm building an MVC framework, and I'm looking for native solutions / frameworks / tag libraries to draw from or to replace my framework entirely.

I'm interested in the following features specifically:

  • server-side DOM manipulation
  • server-side events (page reload, form submit, node insertion, etc.)
  • traversing the DOM tree using css selectors
  • validation of html nodes nesting
  • validation of html nodes allowed attributes
  • support for tag libraries / user controls

Pretty much what you get with JavaScript, but on the server-side and with some little extras.

Any solution will do (even if partial), any language will do, any pointers are appreaciated (even from client-side languages, as long as it's possible to check the source code). Dealing with malformed html is not a prerequisite. Outputting valid markup is a big plus.


Please offer practical solutions by pointing the language/framework that is being discussed and, if possible, what features it provides.

+1  A: 

If you load your page into a DOM-parser you would be able to modify it from there. Then outputting it to the output buffer seems trivial.

But you would need to store the entire document in memory, which will inflict on the performance.

jishi
That's the approach I took when writing my php framework. However, this solution requires me to manually code an event system an a selector system. Making a bare bones solution for those is not so hard, but optimizing it is a problem. Are you familiar with any more featured DOM manipulators?
facildelembrar
A: 

So, jQuery has a sort of selectors API implemented, I guess I can take a look at their source code. Also, PHP has support for XPath, this could help too.

facildelembrar
+1  A: 

have you checked out aptana jaxer?

why the downvote?gosh pepole please explain
the_drow
+1 for a legit answer to the question. Albeit, a bit spartan. Ya see, @the_drow, rather than discuss an issue, some people would rather "Lash out" in an anonymous fashion, thereby avoiding all that messy explanation of ones thoughts and actions. Some people think they are just too busy to explain what they think is "obvious".
Richard B
A: 

Found a php html dom parser that also implements some html selectors here: http://simplehtmldom.sourceforge.net

facildelembrar
A: 

Fizzler uses HTMLAgility pack and adds a server side queryselectorall to provide css selection: http://code.google.com/p/fizzler/

Bless Yahu