XML, XHTML editing, indenting [message #183155] |
Thu, 23 November 2006 00:56  |
Eclipse User |
|
|
|
Originally posted by: marilen.corciovei.nemesisit.ro
Hello,
I have recently migrated from Idea to Eclipse and I am trying to find some
of the functionalities I got so used to especially xml editing.
I need to edit xml, xhtml, and various other "xml" like documents. I edit
xhtml like files which contain specific tags (for tapestry templates for
example) but I cannot convince the editor (from wtp) to proper indent
files. It seems to hate <span..> and is very keen on respecting the dtd.
All I need is some proper indentation of line start without attribute
splitting on multiple lines or adding new lines. After days of trouble the
only solution I found was to write an external python script which does
what I like (http://len.is-a-geek.org/down/xmlIndent.py/) and call it as
an external tool.
Is there an xml editor with this kind of indenting for eclipse? Is there
an easy way to write a code indenter?
Thank you,
Len
http://len.is-a-geek.org
|
|
|
Re: XML, XHTML editing, indenting [message #183232 is a reply to message #183155] |
Fri, 24 November 2006 16:27   |
Eclipse User |
|
|
|
Originally posted by: eclipse4.rizzoweb.com
Marilen Corciovei wrote:
> Hello,
>
> I have recently migrated from Idea to Eclipse and I am trying to find
> some of the functionalities I got so used to especially xml editing. I
> need to edit xml, xhtml, and various other "xml" like documents. I edit
> xhtml like files which contain specific tags (for tapestry templates for
> example) but I cannot convince the editor (from wtp) to proper indent
> files. It seems to hate <span..> and is very keen on respecting the dtd.
> All I need is some proper indentation of line start without attribute
> splitting on multiple lines or adding new lines.
Sounds like you are just running into the line-length setting, which is
easy to change: Preferences > Web and XML > XML Files > XML Source.
After setting up those preferences the way you want, also look at the
general text editor preferences under General > Editors > Text Editors -
some of those are inherited by the other editors (XML, HTML, JSP, etc.)
Hope this helps,
Eric
|
|
|
|
|
|
Re: XML, XHTML editing, indenting [message #183407 is a reply to message #183367] |
Tue, 28 November 2006 14:04   |
Eclipse User |
|
|
|
Originally posted by: eclipse4.rizzoweb.com
Marilen Corciovei wrote:
> Take another case I have seen today:
>
> <?xml version="1.0"?>
> <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="html" />
> <xsl:template match="/">
> <table class="tableList">
> <tr>
> <th>Name</th>
> <th>Value</th>
> </tr>
> <xsl:for-each select="//Property">
> <tr>
> <td><xsl:value-of select="@Name" /></td>
> <td><xsl:value-of select="@Value" /></td>
> </tr>
> </xsl:for-each>
> </table>
> </xsl:template>
> </xsl:stylesheet>
>
> This gets formated as:
>
> <?xml version="1.0"?>
> <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="html" />
> <xsl:template match="/">
> <table class="tableList">
> <tr>
> <th>Name</th>
> <th>Value</th>
> </tr>
> <xsl:for-each select="//Property">
> <tr>
> <td>
> <xsl:value-of select="@Name" />
> </td>
> <td>
> <xsl:value-of select="@Value" />
> </td>
> </tr>
> </xsl:for-each>
> </table>
> </xsl:template>
> </xsl:stylesheet>
[snip]
> How can I control these newlines entered. In fact I only want the amount
> of empty space in front of a line to change not for new lines to be
> added or removed. If I have a <td><xsl:value-of select="@Name" /></td>
> then I just need for this to be aligned at his place and not to be split
> in several lines. Is this possible?
The formatting applied depends on the editor you are using. If this is
in the XML editor, the format gives each child element its own line
(rightly so, according to "accepted" XML formatting convention). The
HTML editor, however, keeps each <td> and its content and closing </td>
on a single line as long as the total line length does not exceed the
configured maximum.
There is no preference for telling it not to add any new lines - I'm not
sure formatting is very useful without that, but you are free to file an
enhancement request to make it a configurable option:
http://bugs.eclipse.org
As a work-around, you can highlight a line or group of lines and alter
the indentation by hitting Tab and Shit+Tab. That might be better for
you than applying the entire formatting rules using Ctrl+F.
Hope this helps,
Eric
|
|
|
|
Re: XML, XHTML editing, indenting [message #183460 is a reply to message #183367] |
Wed, 29 November 2006 09:51   |
Eclipse User |
|
|
|
On Tue, 28 Nov 2006 11:53:11 -0500, Marilen Corciovei
<marilen.corciovei@nemesisit.ro> wrote:
> Take another case I have seen today:
>
....
>
> How can I control these newlines entered.....
In general, you should use <xsl:text> to let XSLT know that
you want _it_ to honor your newlines and spaces.
But ... I think our editor still won't correctly recognize that
yet. But, then you'd at least have a problem you could manually
control ... without the xsl:text, you may be seeing two problems,
one from editors formatter, and one from XSLT changing your formatting.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07149 seconds