tags:

views:

273

answers:

2

I have a method which returns XML in C#( type: XmlElement). How do I return an Empty XML? Can't use string.Empty obviously.

+3  A: 

What do you mean, "empty"? Return null if you want to indicate nothing is being returned.

Otherwise, you'll need to return a minimal document, which consists of an empty element: <element/>.

John Saunders
A: 

if there is an element like this in xml then while parsing in ie produces object required javascript error.

document.getElementById("city").value = xmlDoc.getElementsByTagName("city")[0].childNodes[0].nodeValue;

which can be stopped by adding if conditions

Jayapal Chandran