Inserted space when Format and Indent

<oXygen/> general issues.
tatra603
Posts: 72
Joined: Fri Sep 17, 2004 10:53 am
Location: Prague, the Czech Republic, Europe

Inserted space when Format and Indent

Post by tatra603 » Thu Jan 11, 2007 9:19 pm

Hello!

I have following XHTML code:

Code: Select all

<td>
The Office for the Counterparty:
</td>
When I run Format and Indent, I receive following code:

Code: Select all

<td> The Office for the Counterparty: </td>
Why there are added these two spaces? Where can I switch these behavior? Between "<td>" and "The" are just 0D0A hexadecimal, as shown by XVI32 hexadecimal editor.

I am using oXygen 8.0 on JRE 1.5.0_06 on MS Windows 2000. Thank You in advance for Your answer.

Stepan

george
Site Admin
Posts: 2102
Joined: Thu Jan 09, 2003 2:58 pm

Post by george » Thu Jan 11, 2007 10:32 pm

Hi Stepan,

It is not clear from your message what you would expect.
oXygen adds the space to account for the whitespace that you had previous the format and indent action.

Best Regards,
George
George Cristian Bina

tatra603
Posts: 72
Joined: Fri Sep 17, 2004 10:53 am
Location: Prague, the Czech Republic, Europe

Post by tatra603 » Thu Jan 11, 2007 11:55 pm

I expected this:

Code: Select all

<td>The Office for the Counterparty:</td>
and NOT this:

Code: Select all

<td> The Office for the Counterparty: </td>
Stepan

george
Site Admin
Posts: 2102
Joined: Thu Jan 09, 2003 2:58 pm

Post by george » Fri Jan 12, 2007 12:26 am

Hi Stepan,

That is not equivalent with the initial document that has whitespaces before and after the text. Imagine that you have b instead of td and the content is something like

Code: Select all


<p>this is a<b> 
bold
</b>word.</p>
which is rendered like
this is a bold word.

If after format and indent we loose the spaces and get something like

Code: Select all


<p>this is a<b>bold</b>word.</p>
then you will end up rendering something like
this is aboldword.

Hope that helps,
Geprge
George Cristian Bina

tatra603
Posts: 72
Joined: Fri Sep 17, 2004 10:53 am
Location: Prague, the Czech Republic, Europe

Post by tatra603 » Fri Jan 12, 2007 10:15 am

Hi George,

1) I guess, that Your (and my) initial document has no white space between "a" and "bold" or between "bold" and "word". Is new line white space? But OK - let us skip this point.

2) Your approach (adding space) should be used for inline elements, not other (block, table...) ones. oXygen also does not include space after <p> and before </p>. And <td> is also some kind of block element. Has oXygen this rule for different elements? If yes, table elements should be treated as block elements, otherwise, forget about it and do not add any new Java code into oXygen (and waste Your time).

Stepan

george
Site Admin
Posts: 2102
Joined: Thu Jan 09, 2003 2:58 pm

Post by george » Fri Jan 12, 2007 10:25 am

Hi Stepan,

Yes, new line is white space.

oXygen applies different rules depending whether the content is element only or not. The content of a td element is mixed so whitespace is preserved.

Best Regards,
George
George Cristian Bina

tatra603
Posts: 72
Joined: Fri Sep 17, 2004 10:53 am
Location: Prague, the Czech Republic, Europe

Post by tatra603 » Fri Jan 12, 2007 10:38 am

In http://www.w3.org/TR/html4/struct/text.htmlm chapter "9.1 White space" is written:
In order to avoid problems with SGML line break rules and inconsistencies among extant implementations, authors should not rely on user agents to render white space immediately after a start tag or immediately before an end tag. Thus, authors, and in particular authoring tools, should write:

<P>We offer free <A>technical support</A> for subscribers.</P>

and not:

<P>We offer free<A> technical support </A>for subscribers.</P>
Is it not our case? Stepan

george
Site Admin
Posts: 2102
Joined: Thu Jan 09, 2003 2:58 pm

Post by george » Fri Jan 12, 2007 10:49 am

That's something related to SGML so I cannot comment on that. Anyway, it sounds like a recommendation to avoid white spaces after a start tag and before an end tag. I agree with that as a recommendation, but all this has no relevance to the format and indent action. We have already a document, if that document has whitespaces already as in your initial example then the format and indent action will not remove it, because as I explained in my example the content can be changed if that whitespace is removed. If you do not enter whitespace in the first place oXygen will not add it.

Best Regards,
George
George Cristian Bina

Post Reply