473,378 Members | 1,471 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,378 software developers and data experts.

Why is the return value not XmlDocument ?

hi gurus

I have a asp.net web services and in that i have a function which returns XmlDocument as the return value, when I test the service it works fine and I can see the XML.

When I try to call the XML from asp.net, it does not return XmlDocument and gives me this message

Cannot implicitly convert type 'System.Xml.XmlNode' to 'System.Xml.XmlDocument'

This is my code
XmlDocument xd = new XmlDocument();
xd = sdws.CreateSurvey(ValidXMLFile);

Am I missing something ?

thanks,
shailendra batham

Nov 21 '05 #1
2 2734
We need to see the code that defines what "sdws.CreateSurvey(ValidXMLFile) is.

The error message indicates that you are trying to use an XML node (a piece of an XML document) in a place where an actual XMLDocument is required.
"Shailendra Batham" <sh********@sitesystems.com> wrote in message news:Oj**************@TK2MSFTNGP09.phx.gbl...
hi gurus

I have a asp.net web services and in that i have a function which returns XmlDocument as the return value, when I test the service it works fine and I can see the XML.

When I try to call the XML from asp.net, it does not return XmlDocument and gives me this message

Cannot implicitly convert type 'System.Xml.XmlNode' to 'System.Xml.XmlDocument'

This is my code
XmlDocument xd = new XmlDocument();
xd = sdws.CreateSurvey(ValidXMLFile);

Am I missing something ?

thanks,
shailendra batham

Nov 21 '05 #2
Shailendra Batham wrote:
XmlDocument xd = new XmlDocument();
xd = sdws.CreateSurvey(ValidXMLFile);


XmlDocument implements XmlNode, which is abstract class. If
CreateSurvey() method does return XmlDocument, but as XmlNode, you nedd
only to cast it explicitly:

XmlDocument xd = (XmlDocument)sdws.CreateSurvey(ValidXMLFile);

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 21 '05 #3

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

Similar topics

11
by: Tom Leylan | last post by:
(I posted this in languages.vb also... I can't figure out where things go if you use a little of a lot of things) Hi all... I'm looking for an example (or a pointer to one) related to the...
6
by: Bruce W.1 | last post by:
The intent of my web service is an RSS feed from a blog. Originally I used a StringBuilder to make the XML and returned a string from the webmethod. But this doesn't display properly in IE. So...
2
by: Shailendra Batham | last post by:
hi gurus I have a asp.net web services and in that i have a function which returns XmlDocument as the return value, when I test the service it works fine and I can see the XML. When I try to...
1
by: Brett | last post by:
I often have to change a single value in an xml file based off of a given ID. Is there any easy way to do this through .net.xml? Do I have to parse the file then write it out again?
1
by: R.A. | last post by:
Hi, I have an web service method that accept an xml document and returns a different xml document. Based on the input xml I fill a dataset with information from a database. If the dataset has...
4
by: David Dvali | last post by:
Hello. I have such XML file: <root> <elem1> <optional> Some data <optional> </elem1> </root>
0
by: Kathy Burke | last post by:
I'm providing the following syntax in hopes someone could tell me why I get an object reference error on the second one. The first one works, using an xmlDocument, the second one immediately...
1
by: prashanth023 | last post by:
Hi, This is prashanth kumar. I am getting error , i am gettign number of records using ajax. Please solve this if n >0 i am putting return false in response function. but form is going to...
2
by: thuythu | last post by:
Please help me.... I used and Javascript to view the data. But when i click button open a popup windows, then select data and click save button. The popup close and return the main page, but the...
11
by: casucci | last post by:
I do a return as XMLDataDocument in my webservice but it returns not with the namespaces etc in them. Anyone have and example where I can have the webservice return it as a XML. C# preferred....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

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.