DataTable dt = new DataTable();
XPathNavigator xpNav;
XmlNamespaceManager nsMgr;
XmlDocument ipForm = null;
Stream formStream = null;
formStream = spfile_Flag.OpenBinaryStream();
ipForm = new XmlDocument();
ipForm.Load(formStream);
xpNav = ipForm.CreateNavigator();
nsMgr = new XmlNamespaceManager(xpNav.NameTable);
nsMgr.AddNamespace("my", "http://schemas.microsoft.com/office/infopath/2003/myXSD/2014-10-16T17:16:01");
XPathNodeIterator baFormNodes = null;
string Products = string.Empty;
string Individual_Stock_IDs = string.Empty;
baFormNodes = xpNav.Select("/my:MembComm/my:ProductDetails/my:Itemwise", nsMgr);
foreach (XPathNavigator baLine in baFormNodes)
{
if (baLine.HasChildren)
{
dt.Rows.Add();
baLine.MoveToFirstChild();
Products = string.Empty;
Products = baLine.Value;
if (!string.IsNullOrEmpty(Products))
{
dt.Rows[rowcount]["Products"] = Products;
}
else
{
dt.Rows[rowcount]["Products"] = " ";
}
baLine.MoveToNext();
Individual_Stock_IDs = string.Empty;
Individual_Stock_IDs = baLine.Value;
if (!string.IsNullOrEmpty(Individual_Stock_IDs))
{
dt.Rows[rowcount]["Individual Stock IDs"] = Individual_Stock_IDs;
}
else
{
dt.Rows[rowcount]["Individual Stock IDs"] = " ";
}
baLine.MoveToNext();
}
}
XPathNavigator xpNav;
XmlNamespaceManager nsMgr;
XmlDocument ipForm = null;
Stream formStream = null;
formStream = spfile_Flag.OpenBinaryStream();
ipForm = new XmlDocument();
ipForm.Load(formStream);
xpNav = ipForm.CreateNavigator();
nsMgr = new XmlNamespaceManager(xpNav.NameTable);
nsMgr.AddNamespace("my", "http://schemas.microsoft.com/office/infopath/2003/myXSD/2014-10-16T17:16:01");
XPathNodeIterator baFormNodes = null;
string Products = string.Empty;
string Individual_Stock_IDs = string.Empty;
baFormNodes = xpNav.Select("/my:MembComm/my:ProductDetails/my:Itemwise", nsMgr);
foreach (XPathNavigator baLine in baFormNodes)
{
if (baLine.HasChildren)
{
dt.Rows.Add();
baLine.MoveToFirstChild();
Products = string.Empty;
Products = baLine.Value;
if (!string.IsNullOrEmpty(Products))
{
dt.Rows[rowcount]["Products"] = Products;
}
else
{
dt.Rows[rowcount]["Products"] = " ";
}
baLine.MoveToNext();
Individual_Stock_IDs = string.Empty;
Individual_Stock_IDs = baLine.Value;
if (!string.IsNullOrEmpty(Individual_Stock_IDs))
{
dt.Rows[rowcount]["Individual Stock IDs"] = Individual_Stock_IDs;
}
else
{
dt.Rows[rowcount]["Individual Stock IDs"] = " ";
}
baLine.MoveToNext();
}
}
No comments:
Post a Comment