split html

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sami

    #1

    split html

    What's the best way to split

    <li>item 1</li><li>item 2</li><li>item 3</li>

    into a List<string>

    or is my only option to use the xml reader?

    thx
  • Peter Duniho

    #2
    Re: split html

    On Sat, 20 Sep 2008 14:50:18 -0700, Sami <sami_g@ymail.c omwrote:
    What's the best way to split
    >
    <li>item 1</li><li>item 2</li><li>item 3</li>
    >
    into a List<string>
    >
    or is my only option to use the xml reader?
    You could use String.Split(), assuming that your string literally will
    look like that. That is, you can safely specify "<li>" and "</li>" as
    delimiters, with everything else being text to be preserved.

    But yes...if you need to be more flexible with respect to the input,
    handling any valid XML that has <lielements containing desired text, I
    think one of the XML classes would be preferable.

    Pete

    Comment

    Working...