Last post Aug 27, 2008 02:00 PM by guywithdoubts
Aug 22, 2008 09:40 PM|guywithdoubts|LINK
I have an object as following:
dim oXE as XElement = ?????
How do I creat XElement from an existing XmlNode? I don't want to convert XmlNode to string and again parse the same to get to XElement.
Any solution available?
Thanks in Advance.
Aug 24, 2008 08:06 PM|Bonekrusher|LINK
XSLT is perfect for what you want to do.
Aug 25, 2008 02:51 PM|guywithdoubts|LINK
XElement is a LINQ class. I am not going to transform anything to use XSLT. I would like to query few things using LINQ to XML.
Any more ideas?
Aug 26, 2008 10:32 AM|Samu Zhang - MSFT|LINK
Hi guywithdoubts ,
XElement xdoc = new XElement(node.Name,node.InnerXml);
Aug 27, 2008 02:00 PM|guywithdoubts|LINK
thanks. It worked!
However, I got a small issue.
My root element of XML source has few attributes associated with it.
If I write the following, it gives me what I need:
Dim xe As XElement = XElement.Load(New XmlNodeReader(GetTaskBarXML(FormName)))
But, if I write in the following manner, it gives different XElement and thus I am unable to use:
After examining a bit in depth, I came to see that in the first case, xe.Value is empty. Where as, in the second case, xe.Value contains what I am getting from InnerXml/OuterXml. But xe is automatically HTML encoded in the second case. How to solve this
problem. I am interested in the second case (as you suggested), if it works as expected in the first case.
Can you help me out on this as well?