I want to get survey information through a list of web services and display the questions in the survey.
The result contains a large number of Field nodes , some of which are questions in the survey. Other fields contain other information such as author, last modified, etc.
How can I choose questions? I thought that all non-questions would be hidden, but it is not.
Here is my code as of now. It returns about 16 items. The survey has 6 questions ...
string[] HandleTypes = new string[] { "Number", "DateTime", "Text", "Choice", "GridChoice", "Boolean" };
var query = from n in node.Descendants(ns+"Field")
where (n.Attribute("Hidden") == null || n.Attribute("Hidden").Value.ToLower() == "true")
&& (n.Attribute("Type") != null && HandleTypes.Contains(n.Attribute("Type").Value))
select new Question(n.Attribute("ID").Value)
{
Text = n.Attribute("DisplayName").Value,
QuestionType = n.Attribute("Type").Value,
Element = n
};
Anyone ideas?
source
share