Go Back   Velocity Reviews > Newsgroups > XML
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

XML - Xml indent problem

 
Thread Tools Search this Thread
Old 09-13-2006, 08:18 AM   #1
Default Xml indent problem


hello ,everybody

I'm a newer to xml,
and I need to format and indent xml in a textpanel,

as when input is
<root>
<node1>
<node11/>
</node1>
<node2/>
</root>

and need to put a button to format it ,let it shows like
<root>
<node1>
<node11/>
</node1>
<node2/>
</root>

I used the java1.5 and Eclipse platform , and not sure if I should use
the XSL .

regrads,
@CL



@cl
  Reply With Quote
Old 09-14-2006, 12:19 AM   #2
Joe Kesselman
 
Posts: n/a
Default Re: Xml indent problem

Well, XSLT could be used, with a stylesheet that has its xslutput
directive set to indent (and possibly additional implementation-specific
settings to say how much indentation to use; Xalan defaults to indenting
by 0, for historical reasons). Or you could hand-code a stylesheet to
track nesting depth and accomplish the same thing.

But I submit that you probably don't really want to do this. Changing
the indentation of XML risks changing the _MEANING_ of the XML, since
the indentation becomes part of the document's content.

What I would recommend, if you really want a tree view of your XML, is a
real XML viewer. There are many Java implementations thereof available;
it's quite easy for a Java hacker to make the standard Java tree views
run against a DOM back-end.
  Reply With Quote
Old 09-14-2006, 02:54 AM   #3
@cl
 
Posts: n/a
Default Re: Xml indent problem

Well ,I see.
I don't really want to change the content of the xml file,
and just to find some nodes easily.
And I had found some tools to do it for me.

Best regards,
Richard

Joe Kesselman 写é“:

> But I submit that you probably don't really want to do this. Changing
> the indentation of XML risks changing the _MEANING_ of the XML, since
> the indentation becomes part of the document's content.


  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump