public static final String simpleCds = “p{ctrl-content:$test;}”;
public static final String simpleHtml = “<html><p>Mock</p></html>”;
public static final String simpleResult = “<html><p>Hello World!</p></html>”;
public void testReplaceByTagName(){
View view = new View(new StringReader(simpleCds), new StringReader(simpleHtml));
Map data = new HashMap();
data.put(”test”, “Hello World!”);
StringWriter out = new StringWriter();
view.render(data, out);
out.flush();
String val = out.getBuffer().toString();
assertEquals(”View got invalid output.”, simpleResult, val);
}
Green baby green…you can imagine how ugly the actual impl is (hint: not parsing anything). I dug around the net a bit and stumbled onto a w3c page on SAC (Simple API for CSS). They modeled it after SAX…seems like a good place to start.