Hi group
I have been stocked by two day with this and this is why i am asking
some help or ideas to solve my issue, i hope you can help me.
I have a two web service methods, one returns me a dataset and the
other one returns me an xml, both of them has the following structure:
<Folders>
<Folder ID="338468" HasArticle="hasArticles">
<FolderRefname>Folder1</FolderRefname>
<FolderTitle>Folder 1</FolderTitle>
<Articles>
<Article ID="49467">
<ArticleTitle>Outlook 2003</ArticleTitle>
<ArticleKeywords>Outlook 2003</ArticleKeywords>
<ArticleType>0</ArticleType>
<ArticleRefname>0</ArticleRefname>
<IsCots>0</IsCots>
<Solutions>
<Solution ID="359719">
<SolutionTitle>Outlook 2003</SolutionTitle>
<SolutionDescription>ABCDEF GHIJ</SolutionDescription>
<Attachment />
<AuthorCreated>Salvador</AuthorCreated>
<DateCreated>3/24/2005</DateCreated>
<LastRevisionDate>12/1/2006</LastRevisionDate>
</Solution>
</Solutions>
</Article>
<Articles>
<Article ID="49468">
<ArticleTitle>Outlook 2007</ArticleTitle>
<ArticleKeywords>Outlook 2007</ArticleKeywords>
<ArticleType>0</ArticleType>
<ArticleRefname>0</ArticleRefname>
<IsCots>0</IsCots>
<Solutions>
<Solution ID="359720">
<SolutionTitle>Outlook 2007</SolutionTitle>
<SolutionDescription>ABCDEF GHIJ</SolutionDescription>
<Attachment />
<AuthorCreated>Salvador</AuthorCreated>
<DateCreated>3/24/2005</DateCreated>
<LastRevisionDate>12/1/2006</LastRevisionDate>
</Solution>
</Solutions>
<Solutions>
<Solution ID="359721">
<SolutionTitle>OWA 2007</SolutionTitle>
<SolutionDescription>ABCDEF GHIJ</SolutionDescription>
<Attachment />
<AuthorCreated>Salvador</AuthorCreated>
<DateCreated>3/24/2005</DateCreated>
<LastRevisionDate>12/1/2006</LastRevisionDate>
</Solution>
</Solutions>
</Article>
</Folder>
<Folder ID="338469" HasArticle="hasArticles">
<FolderRefname>Folder2</FolderRefname>
<FolderTitle>Folder 2</FolderTitle>
<Articles>
<Article ID="49470">
<ArticleTitle>Office 2003</ArticleTitle>
<ArticleKeywords>Office 2003</ArticleKeywords>
<ArticleType>0</ArticleType>
<ArticleRefname>0</ArticleRefname>
<IsCots>0</IsCots>
<Solutions>
<Solution ID="359722">
<SolutionTitle>Office 2003</SolutionTitle>
<SolutionDescription>ABCDEF GHIJ</SolutionDescription>
<Attachment />
<AuthorCreated>Salvador</AuthorCreated>
<DateCreated>3/24/2005</DateCreated>
<LastRevisionDate>12/1/2006</LastRevisionDate>
</Solution>
</Solutions>
</Article>
<Articles>
<Article ID="49471">
<ArticleTitle>Project 2007</ArticleTitle>
<ArticleKeywords>Project 2007</ArticleKeywords>
<ArticleType>0</ArticleType>
<ArticleRefname>0</ArticleRefname>
<IsCots>0</IsCots>
<Solutions>
<Solution ID="359723">
<SolutionTitle>Project 2007</SolutionTitle>
<SolutionDescription>ABCDEF GHIJ</SolutionDescription>
<Attachment />
<AuthorCreated>Salvador</AuthorCreated>
<DateCreated>3/24/2005</DateCreated>
<LastRevisionDate>12/1/2006</LastRevisionDate>
</Solution>
</Solutions>
<Solutions>
<Solution ID="359724">
<SolutionTitle>Visio 2007</SolutionTitle>
<SolutionDescription>ABCDEF GHIJ</SolutionDescription>
<Attachment />
<AuthorCreated>Salvador</AuthorCreated>
<DateCreated>3/24/2005</DateCreated>
<LastRevisionDate>12/1/2006</LastRevisionDate>
</Solution>
</Solutions>
</Article>
</Folder>
</Folders>
I was trying with the one that returns me a dataset and load it into a
datagrid (BTW i am using visual studio 2003 since the project is for
maintenance and it is developed on the framework 1.1), but the problem
i has is that it return a dataset with 4 tables and couln't relation
them. So now i am trying with the one that returns an xml.
What i want to do is that one i have a repsonse from the web service,
enable a button to export to excel,, but just few tags, for example:
Folder ArticleID ArticleTitle ArticleKeywords Iscots
Solution SolutionID SolutionDescription Attachment
Folder 1 49467 Outlook2003 Test A 1
Outlook2003
234 Test Desc A1 test.doc
Folder 1 49468 Outlook2007 Test A 1
Outlook2007
245 Test Desc A2 test.xls
Folder 2 49470 Office 2003 Test C 0
Office 2003
127 Test Description C
Folder 2 49471 Project 2007 Test D 0
Project 2007 452 Description file1.doc
Folder 2 49471 Project 2007 Test D 0 Visio
2007 452 Description 2 file2.doc
My datagrid is just showing me IsCots and solution description don't
know whye, my code to read the xml is the following:
DataTable casesDataTable;
casesDataTable = new DataTable();
DataColumn[] caseColumns = new DataColumn[6];
caseColumns[0] = new DataColumn("ArticleTitle");
caseColumns[1] = new
DataColumn("ArticleKeywords");
caseColumns[2] = new DataColumn("ArticleType");
caseColumns[3] = new
DataColumn("ArticleRefname");
caseColumns[4] = new DataColumn("IsCots");
caseColumns[5] = new DataColumn("Solutions");
casesDataTable.Columns.AddRange(caseColumns);
DataRow row;
XmlDocument doc = new XmlDocument();
string xmlArticlesData = "";
xmlArticlesData =
oKewa.ShowAllByFolder(ContractCode, FolderRef,
UserID, "", Language, setAPI, AppType, Access, Email, Fname, Lname,
Job, Phone, Product, Version, "", "", "", "", DateTime);
doc.LoadXml(xmlArticlesData);
XmlNodeList xmlArticleNode;
XmlNodeList xmlArticleDetails;
xmlArticleNode =
doc.GetElementsByTagName("Article");
for (int j = 0; j < xmlArticleNode.Count; j++)
{
xmlArticleDetails =
xmlArticleNode[j].ChildNodes;
row = casesDataTable.NewRow();
for (int i = 0; i <= 5; i++)
{
if (xmlArticleDetails[i] !=
null) //make sure we are getting the
data
{
switch
(xmlArticleDetails[i].Name.Trim().ToUpper())
{
case
"ARTICLETITLE": row["ArticleTitle"] = xmlArticleDetails
[i].InnerXml; break;
case
"ARTICLEKEYWORDS": row["ArticleKeywords"] =
xmlArticleDetails[i].InnerXml; break;
case
"ARTICLETYPE": row["ArticleType"] = xmlArticleDetails
[i].InnerXml; break;
case
"ARTICLEREFNAME": row["ArticleRefname"] =
xmlArticleDetails[i].InnerXml; break;
case "ISCOTS":
row["IsCots"] = xmlArticleDetails[i].InnerXml;
break;
case
"SOLUTIONS": row["Solutions"] = xmlArticleDetails
[i].InnerXml; break;
}
}
}
casesDataTable.Rows.Add(row);
}
dgArticles.DataSource = casesDataTable;
dgArticles.DataBind();
I hope somebody can advice me on this.
Regards