473,236 Members | 1,563 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,236 software developers and data experts.

Is it possible to get an XDocument from an XmlNode?

I searched a little, and saw a few people who also wanna do this, but
I haven't found a solution.

Thank you.
Jun 27 '08 #1
5 7264
Untested, but how about:

XmlNode node;// TODO
XDocument doc = XDocument.Load(new XmlNodeReader(node));
Jun 27 '08 #2
you can use OwnerDocument attribute of XMLNode class...

-ArunDhaJ
Jun 27 '08 #3
On Jun 4, 3:39 pm, ArunDhaJ <arund...@gmail.comwrote:
you can use OwnerDocument attribute of XMLNode class...

-ArunDhaJ
Thank you, but I think OwnerDocument property returns an XmlDocument
instead of XDocument. I explicitly want XDocument, not XmlDocument.
Jun 27 '08 #4
On Jun 4, 3:33 pm, Marc Gravell <marc.grav...@gmail.comwrote:
Untested, but how about:

XmlNode node;// TODO
XDocument doc = XDocument.Load(new XmlNodeReader(node));
That may work since XmlNodeReader is an XmlReader and the XDocument's
Load method does take an XmlReader argument. I need to give it a
shot. Thank you.
Jun 27 '08 #5
On Jun 4, 3:33 pm, Marc Gravell <marc.grav...@gmail.comwrote:
Untested, but how about:

XmlNode node;// TODO
XDocument doc = XDocument.Load(new XmlNodeReader(node));
Just tested it, it works like a charm. Thanks a lot.
Jun 27 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mahesh Devjibhai Dhola | last post by:
Hi All, I want to make a custom class in c#, which extends System.Xml.XmlNode class of BCL. Now in custom class, I have implement abstract methods of XmlNode class also. Now when I am trying to...
2
by: J Mon | last post by:
I have a XML document with elements like <offer> <field name="name"><!]></field> <field name="merchant_id"><!]></field> ..... </offer> I know not the best XML! Now I am selecting different...
5
by: Paul | last post by:
Here I have the definition of an XmlNode which is a property (PayPreference) on my Customer class containing an enum describing how the customer will pay. <PayPerference...
5
by: Mahesh Devjibhai Dhola | last post by:
Hi All, I want to make a custom class in c#, which extends System.Xml.XmlNode class of BCL. Now in custom class, I have implement abstract methods of XmlNode class also. Now when I am trying to...
3
by: Mae | last post by:
Dear All, I have a problem here, I'm using C# Webform calling a webservices. The webservices return me a XMLnode, using this XMLnode I want to convert it to dataset so I can bind to the...
7
by: Buddy Ackerman | last post by:
I created this class Public Class HTMLFileInput : Inherits System.Web.UI.HtmlControls.HtmlInputFile Public Property Data As String Get Return ViewState("HTMLFileInput.Data") End Get Set...
2
by: =?Utf-8?B?c29uaWNt?= | last post by:
Hi, Has anyone got any examples on how to return a XDocument type back to a website calling a WCF service? I have spent over a day on this and don't seem to be getting anywhere, any help would be...
2
by: viepia | last post by:
Hi, How would I edit the code below to read XML CData text? Thanks, Viepia XDocument connectedPCsXML = XDocument.Load(new...
3
by: Tom | last post by:
I can successfully do the following: xdocument doc = xdocument.load(... my file); xelement bla = doc.descendants.("it").first(); .... do stuff ... doc.save("myfile"); the above works great. ...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.