Determine if a XmlNode is empty or null in C#? -
the following code takes xmlnode
data type , populates dataset
object xmlnode
content. write dataset's content file.
public void populatedataset(xmlnode node) { xmlnodereader reader = new xmlnodereader(node); dataset ds = new dataset(); ds.readxml(reader); system.guid guid = system.guid.newguid(); string name = string.format("{0}{1}_{2}.xml", utility.xmloutputpath, utility.xmloutputfilename, guid.tostring()); //need write "node empty" file if xmlnode object empty of null ds.writexml(name, xmlwritemode.ignoreschema); }
the problem encountered 1 scenario not write content file. how determine if xmlnode
object null or empty?
you can check if node parameter null or has innertext
or innerxml
properties null or empty, when enter method before creating xmlnodereader
.
Comments
Post a Comment