Linq to XML: XDocument, XElement, XAttribute... (including XDocument.Load)
Hi,
We are pleased to inform you that the feature that you have voted for on UserVoice (Linq to XML) is now available in C#/XAML for HTML5 (CSHTML5), including XDocument, XElemenbt, XAttribute, XDocument.Load, and more
You can download the latest stable version from:
http://cshtml5.com/download.aspx
Please feel free to send feedback by posting on the forums (forums.cshtml5.com) or by sending an email to support@cshtml5.com
Your UserVoice votes have been given back to you. You can use them to vote for other features on http://cshtml5.uservoice.com
Thank you for your valuable feedback!
Regards,
The CSHTML5 Team
-
UlyssesWu commented
It is uncompleted. For me I need `AddAfterSelf` `AddBeforeSelf` `ReplaceWith` `Remove` etc.
I've tried the following but not seems to work...
public static object GetJsObject(this XNode node)
{
var INTERNAL_jsnode = typeof(XNode).GetField("INTERNAL_jsnode", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(node);
if (INTERNAL_jsnode == null)
{
throw new Exception("Can not get internal js node");
}
return INTERNAL_jsnode;
}public static void AddAfterSelf(this XElement element, XElement newElement)
{
var nodes = new object[] { element.GetJsObject(), newElement.GetJsObject() };
Interop.ExecuteJavaScript("$0.after($1)", nodes);
}