> I'm not sure that you really can (or even if it would be desirable);
> perhaps fix the data instead? It simply doesn't meet the expected
> contract...
>
> Marc
sure.
i must load the file into a xmldocument, and parse each node and rebuild
a xmldocument with the good case ...
if no solution... i do it.
i will wait for a solution (few days...)
thanks.
Jon Skeet [C# MVP] - 10 Jan 2008 09:09 GMT
> sure.
> i must load the file into a xmldocument, and parse each node and rebuild
> a xmldocument with the good case ...
> if no solution... i do it.
>
> i will wait for a solution (few days...)
To be honest, that *is* the solution. I would certainly *hope* that
deserialization expects valid data and will complain if you give it
garbage.
If the problems are predictable, an XSLT transform may help you.
Jon
Marc Gravell - 10 Jan 2008 10:23 GMT
darnit, just after I post... scroll down and you beat me to it ;-p
Oh well - at least we concur...
Marc
Jon Skeet [C# MVP] - 10 Jan 2008 10:35 GMT
> darnit, just after I post... scroll down and you beat me to it ;-p
>
> Oh well - at least we concur...
I have to say it goes against the grain for me to suggest XSLT. In
general I find XSLT hard to both read *and* write. I dare say it's
very neat in its own way, but that doesn't actually make it pleasant
to use :)
Jon
Marc Gravell - 10 Jan 2008 10:50 GMT
I'd agree to a point... but used for appropriate scenarios xslt can be
a very powerful and elegant tool. Used inappropriately it is
nightmarish.
Certainly the LINQ-to-XML (for reading) and XElement etc (for writing)
might make it a lot more appealing to do the transform in code (in
Orcas, at least) moving forward; but quite possibly the xslt would be
more readable that the XmlDocument (or XmlReader/XmlWriter)
alternative.
Marc
Marc Gravell - 10 Jan 2008 10:22 GMT
Actually xslt might be able to do this quite easily...
<xsl:template match="data|DATA">
<DATA><xsl:apply-templates select="*"/></DATA>
</xsl:template>
<xsl:template match="code|CODE">
<code><xsl:value-of select="."/></code>
</xsl:template>
etc; depends on the real complexity, of course...
Marc