[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: How to retain the end tag when outputting an empty
> Using this (admittedly simplified) theory of XML processing, though, the answer to bhow to get <duck></duck> instead of <duck/>b is > $ perl -pe 's,<([A-Za-z][A-Za-z0-9._-]+)/>,<$1></$1>,g;' < INPUT.xml > OUTPUT.xml > or similar. > And, like all attempts to process XML using regular expressions, it is of course wrong. - It won't match an empty element tag that contains whitespace or attributes - It will match things that aren't empty element tags, because they occur in comments or CDATA. So if you have a document with a comment that says: <!-- The code below changes <x/> to <x></x> --> then be prepared for your comments to be garbled. Michael Kay Saxonica
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|