Writing XML DOM Document - empty tag

K

Krzysztof Nogal

Hello,

I have following Problem:
I am writing DOM XML Document with usage of Transformer. It runs ok and
produces correct XML file. But I would like the writer to write empty
elements following way:

<element></element>
instead of:
<element />

Is it possible? How can I achieve that? I searched among all
OutputProperties for an option to do that but no result. Any tips?

TIA

Regards,
Krzysztof Nogal
 
A

Alex Hunsley

Krzysztof said:
Hello,

I have following Problem:
I am writing DOM XML Document with usage of Transformer. It runs ok and
produces correct XML file. But I would like the writer to write empty
elements following way:

<element></element>
instead of:
<element />

Is it possible? How can I achieve that? I searched among all
OutputProperties for an option to do that but no result. Any tips?

I've come across this question before, and AFAIK you don't have this
level of control on transformers. There's no option I know of to specify
that you want the <element></element> style.
 
K

Krzysztof Nogal

The goal is to produce the same xml document as referenced document
(which has empty tags and is unchagable). Not only xml structure but
also exact constructs.

regards,
Krzysztof Nogal
 
D

Dag Sunde

Krzysztof Nogal said:
The goal is to produce the same xml document as referenced document
(which has empty tags and is unchagable). Not only xml structure but
also exact constructs.

Do you consider it too "rude" to walk the string/buffer afterwards,
and replace <xxx/> with <xxx></xxx>?

It _is_ a solution...
 
A

Arvind

1) You can also write a xsl filter, that looks at empty tags and writes
out <x></x>
2) Did you try packages like castor, digester to find whether they
have any support ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top