473,406 Members | 2,847 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,406 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 7275
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. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.