【发布时间】:2011-11-06 19:15:06
【问题描述】:
我有以下 xml。
命名空间非常分散,但 xml 本身是有效的。有什么方法可以配置编写器以在顶部输出所有相关名称空间的 xml,以及 xml 清洁器?我的 xml 阅读器/编写器组合似乎忠实地再现了这一点。我宁愿合并所有的命名空间。
如果可能的话,我真的不想不使用 xslt。
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:a="http://www.w3.org/2005/Atom/extensions/property" a:length="1">
<title type="text">Search Results: '80706'</title>
<subtitle type="text">search results</subtitle>
<id>80706</id>
<updated>2011-08-30T09:05:21+02:00</updated>
<author>
<name>XXXXXX</name>
<uri>contact@xxxx</uri>
<email>contact@xxxx.com</email>
</author>
<entry">
<id>8000</id>
<title type="text">Investment 0000000</title>
<summary type="text">pre populated form</summary>
<published>2011-08-30T14:57:45Z</published>
<updated>2011-08-30T09:05:21+02:00</updated>
<content type="application/xml">
<prop:query-result xmlns:prop="http://www.w3.org/2005/Atom/extensions/property" xmlns="http://www.w3.org/2005/Atom/extensions/property">
<prop:PartyId>000000</prop:PartyId>
<prop:IDReferenceNumber>000000</prop:IDReferenceNumber>
<prop:FullName></prop:FullName>
<prop:FirstName>FIRST</prop:FirstName>
<prop:LastName>LAST</prop:LastName>
<prop:Title>Mr</prop:Title>
<prop:BirthDate>1967-05-24T00:00:00</prop:BirthDate>
<prop:PartySystemKey source="Number">000000</prop:PartySystemKey>
<prop:Address type="Mailing">BOX ...</prop:Address>
<prop:Address type="Home">39 ...</prop:Address>
<prop:ContactNumber>0000000</prop:ContactNumber>
<prop:InvestmentNumber source="ContractNumber">0000000</prop:InvestmentNumber>
<prop:InvestmentNumber source="AccountNumber">0000000</prop:InvestmentNumber>
</prop:query-result>
</content>
</entry>
</feed>
【问题讨论】:
-
何必呢?命名空间的放置位置无关紧要,只要它们在使用之前出现即可。
-
完美,真的没有别的好理由。
标签: c# xslt namespaces