C# 从XML文件读取到ListView-Windows Phone bible应用程序

C# 从XML文件读取到ListView-Windows Phone bible应用程序,c#,xml,windows-phone,C#,Xml,Windows Phone,我是visual studio 2012中的windows phone新手,我想用我的母语非洲语言构建一个圣经应用程序。我在从xml文件读取书名、章节和诗句以及在ListView中显示时遇到问题。这就是我所做的。请帮忙 XML文件 where子句抛出异常,因为无法将值Old、GENESIES或1转换为布尔值 ... where (bool)c.Parent.Parent.Parent.Attribute("name") //throw exception! where (bool)c.Paren

我是visual studio 2012中的windows phone新手,我想用我的母语非洲语言构建一个圣经应用程序。我在从xml文件读取书名、章节和诗句以及在ListView中显示时遇到问题。这就是我所做的。请帮忙

XML文件 where子句抛出异常,因为无法将值Old、GENESIES或1转换为布尔值

...
where (bool)c.Parent.Parent.Parent.Attribute("name") //throw exception!
where (bool)c.Parent.Parent.Attribute("name")
where (bool)c.Parent.Attribute("number")
select new BibleLoad 
{
    ...
如果您想过滤那些具有这些属性的元素,那么可以这样编写代码

...
where ((c.Parent.Parent.Parent.Attribute("name") != null) &&
       (c.Parent.Parent.Attribute("name")!= null) &&
       (c.Parent.Attribute("number") != null))
select new BibleLoad
{
    ...
...
where (bool)c.Parent.Parent.Parent.Attribute("name") //throw exception!
where (bool)c.Parent.Parent.Attribute("name")
where (bool)c.Parent.Attribute("number")
select new BibleLoad 
{
    ...
...
where ((c.Parent.Parent.Parent.Attribute("name") != null) &&
       (c.Parent.Parent.Attribute("name")!= null) &&
       (c.Parent.Attribute("number") != null))
select new BibleLoad
{
    ...