Hi, I have a script that takes an xml template, and populates various fields. The order of the elements is important. Anyway, I've been using XML::Smart, and it works like a dream for the most part. The one thing I can't figure out is an easy way to remove empty elements. For example:
I don't have a dtd file (not really sure how to make one), or if there is some other way to remove the empty elements (but otherwise maintain order of the xml).<?xml version="1.0" encoding="utf-8" ?> <?meta name="GENERATOR" content="XML::Smart/1.6.9 Perl/5.010000 [cygwi +n]" ?> <mgdToneUpdate xmlns="http://www.blah.net/telcel/mgdTone" xmlns:blah=" +http://www.blah.com/content" xmlns:jcr="http://www.jcp.org/jcr/1.0"> <blah:ppuid>blah602527000831</blah:ppuid> <thumbnailUpdate/> <prelistenUpdate> <prelistenMp3ResourceUpdate/> <prelistenWavResourceUpdate/> <prelistenSmafResourceUpdate/> <prelistenAmrwbResourceUpdate/> <prelistenRmfResourceUpdate/> </prelistenUpdate> <premiumUpdate> <mp3ResourceUpdate> <blah:resourceFilename/> <blah:resourceFilename>prelistenMTT00602527000831.mmf</blah:reso +urceFilename> <blah:deviceId/> <blah:deviceId>blackberry9000_ver1</blah:deviceId> <blah:deviceId>nokia_e71_ver1_subua2</blah:deviceId> <blah:deviceId>mot_l6_ver1</blah:deviceId> </mp3ResourceUpdate> <wavResourceUpdate/> <smafResourceUpdate/> <amrwbResourceUpdate/> <rmfResourceUpdate/> </premiumUpdate> </mgdToneUpdate>
Any tips appreciated!
In reply to removing empty elements in xml? by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |