views:

38

answers:

3

Many times I had errors like:

-tag is not closed(xml error)

-xhtml has duplicated id

Id like to write validator to check is those errors exist in files. I bet there is some facelets compiler that compile xhtml into java classes and than validates it.

A: 

Have you considered using a good XML editor? It will catch the bad XML.

I also believe that schema aware XML editors will catch that id's must be unique.

Thorbjørn Ravn Andersen
+2  A: 

Eclipse WTP, although not being the best thing out there, has some validation for .xhtml / .jsp files. You can try the corresponding editor in NetBeans or IntelliJ.

If checking the validity by opening the page takes you too much time (due to slow redeployment), consider sending the page to the servlet container on save - either using WTP dynamic project, deployed on a server, or via the FileSync plugin.

Bozho
A: 

You can't "compile" them, but if working with Seam on JBoss, just by saving the xhtml file the changes will be transfered to the running instance, so you can check "on the fly".

Also, on the duplicate id issue, if you don't add the id field, it will be autogenerated, avoiding this problem.

Pere Villega