I have written xml file which contains html tags as element like
now i want to first write a html file with these tags like
<input type="button" class="mytest" id="1">
.and when i change button to text,in xml also it shud be change button to text.
Yes, use the Observer pattern.
Every time your HTML is changed, a method should be called which then processes the XML.
You could create a watch service, as shown here. The service will notify you of any changes and you can take the appropriate action.