How do I convert an XmlDocument to a XmlNode in C#? I need to send the entire XmlDocument object to as an input parameter to a .NET web service.
How do I convert an XmlDocument to a XmlNode in C#? I need to
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A XmlDocument is a XmlNode, so you can just pass the document object.
Or you could send its DocumentElement, or any Node returned from an XPath query.
No casting or converting is needed unless you need to disambiguate XmlNode from XmlDocument for a method with overloads for both parameter types. If this is the case, use either of the cast or
asoperators.