A
Andrew Montgomery
Here's a challenge for all the hard-core regexp writers out there:
pretty-printing XML in as few regular expressions as possible.
Basically what I'm looking for is a method of converting this:
<tag1 attr="value"><tag2 earth="round"><tag3
bob="youruncle"></tag3><tag4 perl="cool" /></tag2></tag1>
into this:
<tag1 attr="value">
<tag2 earth="round">
<tag3 bob="youruncle">
</tag3>
<tag4 perl="cool" />
</tag2>
</tag1>
with as little code as possible. Thanks!
pretty-printing XML in as few regular expressions as possible.
Basically what I'm looking for is a method of converting this:
<tag1 attr="value"><tag2 earth="round"><tag3
bob="youruncle"></tag3><tag4 perl="cool" /></tag2></tag1>
into this:
<tag1 attr="value">
<tag2 earth="round">
<tag3 bob="youruncle">
</tag3>
<tag4 perl="cool" />
</tag2>
</tag1>
with as little code as possible. Thanks!