c# - C# XmlNode.ChildNodes 断线计为节点
问题描述
我有这些 xml
<?xml version="1.0" encoding="UTF-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/" xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/">
<atom:id>urn:uuid:00000000-0000-0000-0000-00000000000</atom:id>
<atom:title>RenamedDocument</atom:title>
<atom:updated>2012-07-13T06:14:05Z</atom:updated>
<cmisra:object xmlns:ns3="http://docs.oasis-open.org/ns/cmis/messaging/200908/">
<cmis:properties>
<cmis:propertyString propertyDefinitionId="cmis:name">
<cmis:value>RenamedDocument</cmis:value>
</cmis:propertyString>
<cmis:propertyString propertyDefinitionId="cmisma:[OSTERONE]Test">
<cmis:value>[NULL]</cmis:value>
</cmis:propertyString>
</cmis:properties>
</cmisra:object>
</atom:entry>
我想拥有每个孩子,cmis:property
所以我这样做
XmlNodeList list = rawData.GetElementsByTagName("cmis:properties")[0].ChildNodes;
但我有 5 个孩子。似乎每个 \n 都被视为一个节点。
我怎样才能压制这些断线只有“真正的孩子”?
解决方案
感谢juharr,我找到了一种方法NodeType
。只需要使用NodeType != NodeType.Whitespace
. 谢谢 !
推荐阅读
- android - Android 在片段内添加片段
- django - 使用 django 的分页函数中出现错误“count() 恰好需要 2 个参数(给定 1 个)”
- java - 当前日期是前一周的日期
- css - css scroll snap 不适用于 React 应用程序中的 div
- sharepoint-2013 - SPField.FieldRenderingControl 等效于 CSOM 或 JSOM
- laravel - 编写自定义 Laravel 队列驱动程序
- javascript - 隐藏图表中的重复图例
- python - 如何修复python中不一致的return语句?
- tensorflow - deeplab 我的自定义数据集的权重标准是什么?
- java - 从 JAVA 中的 Jira 自定义字段中读取值