[Mono-dev] Problems with DOM serialization to XHTML
Atsushi Eno
atsushi at ximian.com
Wed Feb 21 13:25:08 EST 2007
Hi,
You might want to use this special XmlWriter:
http://svn.myrealbox.com/source/trunk/mono/web/web/XhtmlWriter.cs
disclaimer: it is almost a hack without lots of verification, so
there could be things that need fixes. By overriding XmlWriter like
this, it is relatively easy to customize outputs.
Atsushi Eno
Federico Di Gregorio wrote:
> Hi *,
>
> this is my first post to this list so, please, feel free to tell me (in
> private) about policies and to redirect me to the right place if I am
> out of topic. Thank you.
>
> We are having some problems serializing an XmlDocument (DOM) that
> represents an XHTML document into valid indented XHTML. The problem is
> that the serialization code breaks empty tags adding a NL/CR between the
> open and the closed tag, adding significant whitespace and making it
> non-empty. So, for example, if a tag like:
>
> <img src="..."></img>
>
> is parsed (note that even not in the <img... /> form, it is a perfectly
> valid, closed tag) a different one is output when the document is
> serialized:
>
> <img src="...">
> </img>
>
> That is not valid XHTML anymore. A very simple solution would be to not
> break empty tags (XmlElement.IsEmpty == true) or even shorten them into
> the <.../> form (this probably would output invalid XHTML too but would
> be easily fixable in the code manipulating the DOM while the current
> problem has no apparent solution in the application code.)
>
> Or am I simply doing it the wrong way? :D
>
> federico
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
More information about the Mono-devel-list
mailing list