If you use System.Xml.XmlReader in the .NET Framework to read XML data, the blank characters in the attribute values are not normalized.
Normalization of blank characters in attribute values is as follows:
I can normalize it myself when I use XmlReader directly, but I can't think of a good way to normalize it when I pass XmlReader to XmlSerializer for de-serialize it.
Is there any other way to avoid this problem other than the following two methods?
Action (image) that would be good for both processing and implementation efficiency if:c# .net xml
At first, a character reference such as
ሴ means adding the character it indicates to an empty box.Adding to a normalized value means adding characters to an empty box, meaning that characters written in a character reference are treated as characters and are no longer treated.In that respect, the results are clearly different from those described later.You may have a technique to write characters as references.
is described (especially the last sentence).Of course, Extensible Markup Language (XML) 1.0 (Fifth Edition), 3.3.3 Attribute-Value Normalization is also
\r\n and is not replaced by
under normal behavior?
The value of
attribute in was
The real problem is that
"foo bar" does not become
"foo bar" (blank before and after deletion and blank compression in the middle).
This is exactly what the link says.
The first half described the conditions under which this regulation is invoked.If DTD is not used, attributes should be treated as CDATA types, so this is a meaningful provision mainly when DTD describes the type of attributes.
If you specify the attribute
NMTOKENS in DTD, it will be normalized to the specification, and if it is unspecified or CDATA, it will not be converted to the specification.In addition,
XmlReaderSettings.DtdProcessing must be set to
DtdProcessing.Parse to handle DTD.
Although the entire question statement states that the translation is in accordance with the specification, such as "Blank characters in attribute values are not normalized", it should be recognized that you want an out-of-spec special translation.
You can inherit the
Value property only override if you do not want to do asynchronous processing.
© 2022 OneMinuteCode. All rights reserved.