Creating solo tags (i.e. <tag .../>) with WST XML api [message #231843] |
Mon, 25 May 2009 14:00  |
Eclipse User |
|
|
|
Hello,
I have an XML file that I process using the WST API (StructuredDocument,
etc). I use XPath for various parsing jobs and I insert nodes via the
standard DOM API (i.e. node.append(document.createElement(...));).
Is there a way to create an Element that will be saved in the xml file
using it's "short" form (i.e. <a_tag attr1=".."/> instead of <a_tag
attr1=".."></a_tag>.
Thanks in advance,
Cristi.
|
|
|
|
|
Re: Creating solo tags (i.e. <tag .../>) with WST XML api [message #231909 is a reply to message #231893] |
Wed, 27 May 2009 06:27  |
Eclipse User |
|
|
|
Dear Nitin,
>> Only by using IDOMElement.setEmptyTag(true) before inserting it into the
>> Document. I don't know of a DOM API way of controlling it before you
>> transform it into a stream, and even then it's a transformer-specific
>> parameter.
It worked. Thanks a lot!
Dear David,
> In general, if you don't have a Text node or another Child Node, then
> most serializers will serialize it out as <tag/>, otherwise they may
> serialize it as <tag></tag>, depending on the serializer.
This is not the case of the WST serializer.
Best regards and thanks again for your answers.
Cristi.
|
|
|
Powered by
FUDForum. Page generated in 0.03419 seconds