Originally posted by Katja Ernst: hi, im trying to convert a string like this
hello mylist liststart:1.one 2.this is point two 3.and here we have point three 4.whatever12345 5.:-) end:listend rest of the line
into some valid html code (html list). when im finished it should look like this:
<ol start="1" type="1"> <li>one</li> <li>this is point two</li> <li>and here we have point three</li> <li>whatever12345</li> <li>:-)</li> </ol>
here is what i have so far:
but this code doenst work correctly. anyone any idea?
thanks in advance :-)
I wouldn't do this with a regular expression. I think it's better handled by a parser class that would take a String input and turn it into the appropriate tokens. I'd have a toXML() method that would return the tokens as the XML stream that you want: liststart, liststart, and a delimited string in-between. Choose the delimiter carefully - "dot" might not be the best choice if any of the data can sensibly contain a period.