Reading HTML Tag information

SyntaxEditor for Windows Forms Forum

Posted 19 years ago by Paul Huckstepp - UK
Could someone tell me if it is possible to retrieve the full HTML tag that the Caret is currently in, and if it is how?. For example if a user clicked within the line below:

<table width=100 cellpadding=2>

A string could be read that would contain everything above (<table ... > )

Thanks for your help.

Comments (2)

Posted 19 years ago by Boyd - Sr. Software Developer, Patterson Consulting, LLC
I don't have the exact code to offer, but I can suggest how I do it. I use the SyntaxEditor.SelectedView.GetCurrentToken method to get the current token. If the token key is something that might be in a tag or the Token.LexicalState.Key is the proper state, then you'll need to scan for the opening tag. You can use the SyntaxEditor.Document.GetTokenStream method to get a token stream. You'll then do a ReadReverse until you get to the token that starts your HTML tag. At that point, you'll start to read forward until you reach the end token (trapping the text of each token as you go).

Sorry I don't have exact code samples to offer, and I may be off on the location of some of those methods. You can see an example of scanning backwards in the C# Sample. Look at the code used for the IntelliSenseMemberList because it scans backward from the current token to find the full name of the current member. It'll help move you in the right direction.
Posted 19 years ago by Paul Huckstepp - UK
Thanks for the pointers. I'm sure I'll work it out from your info. <IMG SRC="smile.gif" border="0">
The latest build of this product (v24.1.0) was released 4 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.