auto indent on xml

Questions on using RText should go here.

Moderator: robert

auto indent on xml

Postby stefdhol » Thu Feb 23, 2012 1:54 pm

Hi,

I'm using RSyntaxTextArea for some xml related java developments (dispaying xml retrieved from blob in database etc.).
The problem I am facing is that the xml I insert in the TextArea does not get displayed as:
Code: Select all
<x>
    <y>test</y>
</x>

but as
Code: Select all
<x><y>test</y></x>


--> no autoIndent etc.

Code:
Code: Select all
RSyntaxTextArea txt = new RSyntaxTextArea();
          txt.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_XML);
          txt.setCodeFoldingEnabled(true);
          txt.setAutoIndentEnabled(true);
          txt.setText("<x><y>test</y></x>");


Any Idea how I can get full xml "pretty printing" and tag folding?

Thanks
Stefaan
stefdhol
 
Posts: 2
Joined: Thu Feb 23, 2012 1:47 pm

Re: auto indent on xml

Postby robert » Thu Feb 23, 2012 2:13 pm

RSTA doesn't have a pretty-printing feature out-of-the-box unfortunately. If you'd like that considered for a future release, please add a Feature Request so it can be tracked.

That said, for RText I integrated JTidy, which is a simple port of HTML Tidy for Java. You might consider trying that out to see if it works for you.
User avatar
robert
 
Posts: 794
Joined: Sat May 10, 2008 5:16 pm

Re: auto indent on xml

Postby stefdhol » Thu Feb 23, 2012 2:34 pm

Feature request added: Item created successfully. (Artifact 3492076)

Thanks for the quick reply.
Stefaan
stefdhol
 
Posts: 2
Joined: Thu Feb 23, 2012 1:47 pm


Return to Help

Who is online

Users browsing this forum: No registered users and 1 guest