in reply to regex on XML
Valid XML only needs & and < to be turned into & and < respectively. You don't have to encode ' " or > at all.
Replacing all & by & is trivial. This still leaves you with the troublesome <, but I don't think there is any possibility (other than validating your XML against a DTD) to let the script differentiate between <FIELDS> and <do_what>: they both look like a "valid" XML tag.
Oh yes, just remembered: ]]> must be encoded as ]]> if you want to use it as text.
CountZero
"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: regex on XML
by diotalevi (Canon) on Feb 17, 2004 at 21:09 UTC | |
by CountZero (Bishop) on Feb 17, 2004 at 22:57 UTC | |
by diotalevi (Canon) on Feb 17, 2004 at 23:07 UTC | |
by CountZero (Bishop) on Feb 18, 2004 at 07:29 UTC | |
by diotalevi (Canon) on Feb 18, 2004 at 13:58 UTC | |
|