我在下面有这个 xml 文件
<XMLBIBLE xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" biblename="ENGLISHNKJ">
<BIBLEBOOK bnumber="1" bname="Genesis">
<CHAPTER cnumber="1">
<VERS vnumber="1"> In the beginning God created the heavens and the earth. </VERS>
<VERS vnumber="2"> The earth was without form, and void; and darkness [was] on the face of the deep. And the Spirit of God was hovering over the face of the waters. </VERS>
<VERS vnumber="3"> Then God said, "Let there be light"; and there was light. </VERS>
<VERS vnumber="4"> And God saw the light, that [it was] good; and God divided the light from the darkness. </VERS>
<VERS vnumber="5"> God called the light Day, and the darkness He called Night. So the evening and the morning were the first day. </VERS>
<VERS vnumber="6"> Then God said, "Let there be a firmament in the midst of the waters, and let it divide the waters from the waters." </VERS>
<VERS vnumber="7"> Thus God made the firmament, and divided the waters which [were] under the firmament from the waters which [were] above the firmament; and it was so. </VERS>
<VERS vnumber="8"> And God called the firmament Heaven. So the evening and the morning were the second day. </VERS>
<VERS vnumber="9"> Then God said, "Let the waters under the heavens be gathered together into one place, and let the dry [land] appear"; and it was so. </VERS>
我想要的是像这样在 c# datagrid 上显示它,
截至目前,我只能获取诗句
这是我使用的代码。我只为演示目的获取经文,因为当我获取所有元素时,datagridview 中没有显示。
XDocument xmlDocs = XDocument.Load(AppDomain.CurrentDomain.BaseDirectory + "Bible_English_NKJV.xml");
var q = from c in xmlDocs.Root.Descendants("BIBLEBOOK").Elements("CHAPTER")
select new
{
Scripture = c.Element("VERS").Value
};
dgvScriptures.DataSource = q.ToList();
请。谢谢。