Wrapping an additional element around an existing XDocument

Posted by user1382827 on Stack Overflow See other posts from Stack Overflow or by user1382827
Published on 2012-08-31T09:34:04Z Indexed on 2012/08/31 9:38 UTC
Read the original article Hit count: 243

Filed under:
|
|

Let's say I have a converted HTML document, and I wanted to wrap an extra tag around the parent, so that I could read the head and body. How would I do that with C#? The file is used as an XDocument.

change

<html>
    <head>
        <!-- data -->
    </head>
    <body>
       <!-- data -->
    </body>
</html>

to

<open>
    <html>
        <head>
            <!-- data -->
        </head>
        <body>
            <!-- data -->
        </body>
   </html>
</open>

© Stack Overflow or respective owner

Related posts about c#

Related posts about Xml