简体   繁体   中英

How do I return empty XML (Type XmlElement) in C#?

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

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/> .

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM