Installed the module... It actually produces <element/> for empty elements:
use XML::Smart qw( ); my $xml = XML::Smart->new(); $xml->{foo}{bar}{empty} = {}; print scalar $xml->data();
<?xml version="1.0" encoding="iso-8859-1" ?> <?meta name="GENERATOR" content="XML::Smart/1.6.8 Perl/5.008008 [MSWin +32]" ?> <foo> <bar> <empty/> </bar> </foo>
If you use a DTD, then you need to specify the "EMPTY" keyword or else it'll generate <empty></empty> (which is fine cause it means the same thing).
use XML::Smart qw( ); my $xml = XML::Smart->new(); $xml->{foo}{bar}{empty} = {}; $xml->apply_dtd(<<'__EOI__'); <!DOCTYPE foo [ <!ELEMENT foo (bar*)> <!ELEMENT bar (empty*)> <!ELEMENT empty EMPTY> ]> __EOI__ print scalar $xml->data();
In reply to Re^2: empty element with xml::smart
by ikegami
in thread empty element with xml::smart
by makrospex
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |