如何使用C#删除头节点的命名空间 [英] How can I remove the namespace of header node using C#
本文介绍了如何使用C#删除头节点的命名空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有任何可能的方法来读取下面的xml子节点的数据。由于标题节点的命名空间,我无法读取内部节点的值
Is there any possible way to read data of child nodes of xml below. Because of the header node's namespace, i cant read inner node's values
<?xml version="1.0" ?>
<Header xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<H1>A</H1>
<H2>B</H2>
<H3>C</H3>
<H4>D</H4>
</Header>
没有头节点名称空间的
如下所示可以读取内部节点的值。任何建议请
without namespace of header node's like below can reads values of inner nodes. Any advice please
<pre><?xml version="1.0" ?>
<Header>
<H1>A</H1>
<H2>B</H2>
<H3>C</H3>
<H4>D</H4>
</Header>
我尝试过:
我试图替换标题节点但仍然没有任何进展
What I have tried:
I tried to replace the header node and still no any progress
推荐答案
XmlTextReader.Namespaces属性(System.Xml)| Microsoft Docs [ ^ ]
c# - 我可以让XmlSerializer在反序列化时忽略命名空间吗? - 堆栈溢出 [ ^ ]
这篇关于如何使用C#删除头节点的命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文