How do I clear the body content placed inside a Custom tag?
<abc:myTag display="true">
<b> Clear this content </b>
<abc:myTag />
Based on the display=”true” boolean flag in my tag handler, I want to clear out the content “Clear this content”. I tried:
if(display){
getBodyContent();
} else
try {
getBodyContent().clear();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
but its throwing a null pointer exception
If you have a reference to the custom element you can do
If you need to get a reference to the custom element you can do something like
or if you aren’t using XML namespaces, you can do