David Henderson
Usenet Archive
- Joined
- Feb 20, 2003
- Messages
- 8
- Reaction score
- 0
Hi There...
I'm struggling with a problem:
I have a string (coming from a rich text editor) which contains a variety of span tags that need to be replaced with corresponding formatting tags.
e.g.
<span style="font-weight: bold;">line 2</span>
needs to become
<b>line 2</b>
So... with a single set of tags its simple. But then when you add in the underline and italic <span> tags it becomes a right mess - especially if you get nested tags which means you can't just replace the next </span> tag with the relevant formatting closing tag as it could be the closing tag from another nested tag.
e.g.
<span style="font-weight: bold;">bold and <span style="font-style:
italic;">italic <span style="text-decoration: underline;">Underlined bold & italic!! </span> just italic</span> now bold again </span>not bold<br />
Can anyone help?
Cheers
David Henderson
I'm struggling with a problem:
I have a string (coming from a rich text editor) which contains a variety of span tags that need to be replaced with corresponding formatting tags.
e.g.
<span style="font-weight: bold;">line 2</span>
needs to become
<b>line 2</b>
So... with a single set of tags its simple. But then when you add in the underline and italic <span> tags it becomes a right mess - especially if you get nested tags which means you can't just replace the next </span> tag with the relevant formatting closing tag as it could be the closing tag from another nested tag.
e.g.
<span style="font-weight: bold;">bold and <span style="font-style:
italic;">italic <span style="text-decoration: underline;">Underlined bold & italic!! </span> just italic</span> now bold again </span>not bold<br />
Can anyone help?
Cheers
David Henderson