You can, but there are a lot of problems. You can't display formatted text in a textarea, so you'd have to add some text cues to represent the XML hierarchy, for example:
And I'm not sure if you are guaranteed a monospace font. If you got a font that didn't respect your spacing your formatting would be all screwed up.
I sure hope you aren't intending to let someone edit an XML file via this text area. That would be a recipe for disaster. Perhaps you could clue us in on what your requirement is.
This view is not full xml, the xml tags are created in the db as rows with releation to each other like parent and child releation. What I have to do is get the tags from db and then show it as tree view in the text area or if possible a scroll pane not necessarily a frame. frames need to be avoided as page should not be refreshed.
You don't want end users messing around in a text area with XML. XML has a strict form and the users are certain to screw it up.
I'd suggest using the tree widget from the Struts jQuery plugin. You can see a demo here, click on "Widgets" then "Tree". You will have to add some controls to add/edit/delete nodes, but this will help you preserve the integrity of the XML while giving the user an easy-to-use interface to manipulate it.