hey,
Some guys asked me to have a look at monodocer XML
formatting problem
that the latest XmlTextWriter formats xml differently than
before.
Here I list what I analyzed. Any corrections are welcome:
- Basically, the latest XmlTextWriter's behavior is what
exactly matches
.net's, so it is rather problems in existing documents
(if you
disagree file a bug please). MSDN document tells that it
invalidates
indentation when it found a mixed content, but it is
simply wrong
(it cannot explain why an empty element is formatted as
<foo>\n</foo>
while a simple text element is formatted as
<foo>string</foo>).
- If there are text contents (texts, CDATA and whitespaces),
the
container element does not indent its contents after it
found a
content mix. But since XmlTextWriter is not the God, it
does not
foresee whether the content is mixed or not when they
write first
child.
- An applied example is what happens with whitespaces. If
there are
extra whitespaces between <foo> and <bar>
(i.e. like <foo>\n<bar>),
*the entire element foo* is not indented. That is, until
</foo>
there will be no generated whitespaces.
(At first I thought that the "problem" lies in
the entire whitespace
thingy, but as the above implies, it is just one example
case.)
- Existing documents need formatting, so we can't just
disable
indentation.
- There is no way to reproduce exactly the same results from
the correct XmlTextWriter.
Thus, the solution is only in two ways:
- enbrace inevitable diffs
- add old wrong XmlTextWriter to be used in monodocer to
replace
correct XmlTextWriter.
Grab XmlTextWriter.cs and XmlTextWriterOpenElement.cs from
branches/mono-1-1-16/mcs/class/System.XML/System.Xml.
Which would be better?
Atsushi Eno
_______________________________________________
Mono-docs-list maillist - Mono-docs-list lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-docs-list
a>
|