# ZUL formatting problem

xmedeko
1021 1 16
http://xmedeko.blogspot.c...

Hi,
when i have two elements in ZUL like:

    <n:span>A<n:span><n:span>B<n:span>

then the automatic Eclipse formatting (Source->Format Ctrl+Shift+F) changes them to:
    <n:span>A<n:span>
<n:span>B<n:span>

which makes a different result in the HTML: "AB" vs. "A B". Is there any way how to fix this?

Thanks

delete retag edit

## 7 Replies

iantsai
2755 1

Is it a valid XML format?
Zul Editor requires a strict XML file for input, and there's no end tag for each of four <n:span> in your case.

henrichen
3869 2

zul is registered as a kind of XML file and what you proceed is done by Eclipse formatter, not ZK Studio.

xmedeko
1021 1 16
http://xmedeko.blogspot.c...

@iantsai: Sorry, it was a mistake. There should be proper end tags in my example.

@henrichen: May ZK Studio change these rules? Maybe Ant pluging do it ...

henrichen
3869 2

Well, ZK Studio only handles part inside <zscript> tag. We would not change Eclipse's behavior since it is too risky. Maybe you want to check if there was any way to "configure" the Eclipse formatter.

xmedeko
1021 1 16
http://xmedeko.blogspot.c...

Wow, I have found this in the spec http://www.w3.org/TR/2004/REC-xml-20040204/#sec-white-space and Eclipse (3.5, WTP) can handle it, so

<window xml:space="preserve">
<n:span>A</n:span><n:span>B</n:span>
</window>

Does not change the format even if I run (Source->Format Ctrl+Shift+F).

Always learning ...

xmedeko
1021 1 16
http://xmedeko.blogspot.c...

BTW. Generally, it should be possible to switch on/off in the XSD, see http://www.w3.org/TR/xmlschema-1/#cAttributeUse but I do not know how Eclipse handle it. I have tried to edit zul.xsd in the org.zkoss.eclipse.editor_0.9.6.v200912041237.jar, but the formatting was still generating new lines.

RetoH
44 5

When I use

<div xml:space="preserve">asdfasf</div>


I get this exception:

org.zkoss.zk.ui.metainfo.PropertyNotFoundException: Method setSpace not found for class org.zkoss.zul.Div


Did you ever solve this problem?

[hide preview]