Re: Simple Text Parser

John Brett <[email protected]> Wed, 12 Sep 2007 11:54:11 +0100
Newsgroups gmane.comp.windows.devel.dotnet.winforms
Message-ID <[email protected]>
> I am looking at developing a simple text parser.

Is that a specific requirement, or just an inference from your requirements?

From what you describe, using the WebBrowser control would surely
be the quickest and easiest way of displaying static content that might
have hyperlinks, pictures, bold, underline and italics.


Failing that, if you just want textual formatting and can follow the hyperlinks
yourself, you could use the RichTextBox control and store the data in RTF.
That would give you an avenue to allow user-editing of the content (I couldn't
decide from your eMail whether that was a requirement or not).
You are, I think, relient upon the RichTextBox control identifying
URLs in the body of the text and rendering them as links.


> Is there an easy way to
> format '<b>hello</b> world' and place it in a textbox or label.


Depends what you mean by 'format'. If you just want to display the
text, then xml would seem a natural choice of document, in which
case you can just pull out the text component thereof and display
it. Won't give you hyperlinks, images, bold, italic or underline.
If you want something more fancy but based upon a label, then you'll
be painting it yourself (and therefore doing whatever you want wrt formatting).


> I'm looking at implementing hyperlinks and maybe a picture from a text
> document like the example above and I might as well add in the normal
> b/u/i. Basically I'm looking for speed and a reduction in the size of
> the file that needs to be stored as doing this using word documents
> would be very sloppy.
>
> Are there any useful controls out there or am I going to have to craft
> something myself. And if I'm crafting it myself is there an easy way to
> go about it or do I have to start hovering link-labels over textboxes
> etc.


If you are going to create your own and not use the RichTextBox
control, then at least use xml so you have the parsing done for you.

John