This is a migrated thread and some comments may be shown as answers.
Best way to parse Editor.Content server side?
3 Answers 22 Views
This is a migrated thread and some comments may be shown as answers.
Jeffrey
Top achievements
Rank 1
Jeffrey asked on 29 Jan 2009, 03:48 PM
We're going to be using the RadEditor in our project.  We're going to need to parse the HTML content when the page is submitted in order to :

(1)Retrieve any images used in the HTML and store them in our database
(2)Retrieve custom tag-holders and replace with server-side criteria

Does anyone have any recommendations on the best way to do this?

Thanks

3 Answers, 1 is accepted

Sort by
0
Tervel
Telerik team
answered on 02 Feb 2009, 02:03 PM
Hi Jeffrey,

There are two "classic" approaches that you can take.
One is to parse the editor content using regular expressions and/or string.Replace (for the "replace" part of the task).

The second approach would be to load the editor content in an XmlDocument (since RadEditor produces XHTML content, and XHTML is essentially XML)  - and use XPath and other available aproaches for quering and manipulating an XML document.


Greetings,
Tervel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Mohammed
Top achievements
Rank 2
answered on 29 Jan 2013, 07:03 PM
Hi team,
i want to use XML document but the output is not xml 
for example if the editor has this content

Dear <span class="custom" target="test"> First Name </span>

in the server side i get the above html from the control editor. 

and it is not xml so how i can use xml document to get all the spans that has class "custom" 

Regards,
Mohammed
0
Rumen
Telerik team
answered on 30 Jan 2013, 03:40 PM
Hello,

The content returned by the Content server property of RadEditor is a standard string and it is up to the developer working with it to decide how to modify it using the methods provided by the .NET framework. For example you can use the String.Replace and other String methods to locate and replace strings in the content area as well as regular expressions.

Best regards,
Rumen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Asked by
Jeffrey
Top achievements
Rank 1
Answers by
Tervel
Telerik team
Mohammed
Top achievements
Rank 2
Rumen
Telerik team
Share this question
or