T
tosudesh2005
hi all
I write code like this to remove perticular node. but it left closing
tag in xml file. but i want remove this closing tag also.
------------------------------------------------------------
string filename = Server.MapPath("DutyStatus.xml").ToString();
XmlNodeList objnodelst;
XmlDocument doc = new XmlDocument();
doc.Load(filename);
objnodelst = doc.SelectNodes("/DutyStatus/
DSNO[@ID='30006006200']");
foreach (XmlNode objnode in objnodelst)
{
objnode.RemoveAll();
doc.Save(Server.MapPath("DutyStatus.xml"));
}
my xml file look like this
-------------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
- <DutyStatus>
- <DSNO ID="30006006200">
<UserID>AMIT KUMAR - 17</UserID>
<Status>frmDutyStart</Status>
</DSNO>
</DutyStatus
after deleting this node my file look like this
------------------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
- <DutyStatus>
<DSNO />
</DutyStatus
i want also remove <DSNO/> tag also
from
sudesh
I write code like this to remove perticular node. but it left closing
tag in xml file. but i want remove this closing tag also.
------------------------------------------------------------
string filename = Server.MapPath("DutyStatus.xml").ToString();
XmlNodeList objnodelst;
XmlDocument doc = new XmlDocument();
doc.Load(filename);
objnodelst = doc.SelectNodes("/DutyStatus/
DSNO[@ID='30006006200']");
foreach (XmlNode objnode in objnodelst)
{
objnode.RemoveAll();
doc.Save(Server.MapPath("DutyStatus.xml"));
}
my xml file look like this
-------------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
- <DutyStatus>
- <DSNO ID="30006006200">
<UserID>AMIT KUMAR - 17</UserID>
<Status>frmDutyStart</Status>
</DSNO>
</DutyStatus
after deleting this node my file look like this
------------------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
- <DutyStatus>
<DSNO />
</DutyStatus
i want also remove <DSNO/> tag also
from
sudesh