I have an XML well formatted without any spaces. It' must be like that.
When I load it to XMLDocument to sign, the self-closing tags gets an extra white space and
<cEAN/>
becomes:
<cEAN />
Once this document must be signed, it's impossible to remove the white space.
The property PreserveWhiteSpace doesn't made any difference to the result.
How can I change this behavior?
All tags in XML or XHTML can be used as self-closing by closing them with (<.. />). HTML5: Using a slash is absolutely optional. HTML4: Using a slash is technically invalid. However, the W3C's HTML validator still accepts it.
A self-closing tag is an element of HTML code that has evolved in the language. Typically, the self-closing tag makes use of a “/” character in order to effectively close out a beginning tag enclosed in sideways carets.
The end tag functions exactly like a right parenthesis or a closing quotation mark or a right curly brace. It contains no data of its own; it simply ends the most recent (innermost) tag with the same name. XML requires a matching end tag for each start tag.
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?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With