I am using JTidy to convert my existing HTML to an XML which works fine but now I have a set of rules that e.g. if a tag <h1> is found in the HTML that should be replaced with <h3>, if tag <blink> is found then ignore it etc. while converting to the XML. How would I do this?? Is there such API available in java/XML world??