Best way to parse Editor.Content server side?

4 posts, 0 answers
  1. Jeffrey
    Jeffrey avatar
    2 posts
    Member since:
    Jan 2009

    Posted 29 Jan 2009 Link to this post

    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?

  2. Tervel
    Tervel avatar
    1337 posts

    Posted 02 Feb 2009 Link to this post

    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.

    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Telerik UI for ASP.NET Core is out
  4. Mohammed
    Mohammed avatar
    87 posts
    Member since:
    Aug 2011

    Posted 29 Jan 2013 Link to this post

    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" 

  5. Rumen
    Rumen avatar
    12788 posts

    Posted 30 Jan 2013 Link to this post


    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,
    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.
Back to Top