How to move around a XML node using C# or Linq

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JavedS
    New Member
    • Sep 2012
    • 1

    How to move around a XML node using C# or Linq

    I want to move a node around in XML

    for e.g. if the string is

    <strong><u><?cu stom_mark_start ForFormatCount= 'BU' Forunformatchar ='i' data='evolved'? >evolved<?custo m_format_mark_e nd ?></u></strong>

    then the custom PI should be moved before the formatting tags

    The Result should be

    <?custom_mark_s tart ForFormatCount= 'BU' Forunformatchar ='i' data='evolved'? ><strong><u>evo lved</u></strong><?custom _format_mark_en d ?>

    I need to do this for the Entire XML file.

    Can we do it with Regex or Linq?
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Not sure if this is useful for a string, but I would look into using the XmlDocument class to help me manage XML nodes.

    -Frinny

    Comment

    Working...