如何使XMLDocument不在自封闭标签上放置空格? [英] How make XMLDocument do not put spaces on self-closed tags?

查看:241
本文介绍了如何使XMLDocument不在自封闭标签上放置空格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个格式正确的XML,没有任何空格。

I have an XML well formatted without any spaces. It' must be like that.

当我将其加载到XMLDocument上进行签名时,自闭合标签会获得额外的空白,并且

When I load it to XMLDocument to sign, the self-closing tags gets an extra white space and

    <cEAN/>

成为:

     <cEAN />

必须签署此文档后,才能删除空白。

Once this document must be signed, it's impossible to remove the white space.

PreserveWhiteSpace属性对结果没有任何影响。

The property PreserveWhiteSpace doesn't made any difference to the result.

如何更改此行为?

推荐答案

XmlDocument 中,结束 /前没有空格。 XmlDocument 是一个由节点组成的数据结构。它是二进制的。它不是文本。

There is no space before the closing "/" in the XmlDocument. XmlDocument is a data structure consisting of nodes. It is binary. It is not text.

只有当将文档序列化为文本时,您看到的任何多余空间都存在。

Any extra space you are seeing exists only when you serialize the document as text.

您实际上在签名方面有问题吗,还是只认为自己有这样的问题?

Are you actually having a problem with signing, or do you only think you will have such a problem?

这篇关于如何使XMLDocument不在自封闭标签上放置空格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆