Our UI designers would like to validate that the HTML they specify should appear on a page does, in fact appear on the page as generated by a .jsp. They need to specify a particular set of HTML nodes with rules like 'this node set appears 1-3 times' 'this node set must appear' 'this node must contain these fixed attributes and these variable attributes'. There would be one testcase per rule, with up to about 100 testcases on one page.
I have automated navigating to the page in question using Selenium in Java. Once on the page, is there a good Java API or automated tool for doing these types of rule-based validations of the DOM?
Another approach I considered is writing up an xpath expression for each expected result. My concern is that they could be very hard to read. Also, I would like to hand off the creation of these rules to the UI developers, and I do't know if they will be able to (easily) create them in xpath.