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>
Suppose doc
is your existing document. Then you just need
var wrapped = new XElement("open", doc);
and you have an XElement
with what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With