Click here to Skip to main content
15,894,896 members

Comments by Christoph Keller (Top 82 by date)

Christoph Keller 10-Sep-13 4:28am View    
Thanks for your answer, this would be a solution, but is not an option with using an xslt transformation for this (because we're trying to refactor the current xslt processing and replace it by standard .net object structure and asp.net controls for displaying).

But thanks anyway for your appreciated help!

Best regards,
Chris
Christoph Keller 10-Sep-13 4:26am View    
Ok, we will generate a new schema according the XML output of the transformation we got.
There seems no other way around, I just hope to catch all properties correctly.. :)

Thanks for your help!
Christoph Keller 10-Sep-13 3:04am View    
Ok, you are right. I now tried to implement the overrides, but now the data inside the xml do not exactly match (attribute definied in xml, but defined as normal nodes in xsd). So this will never work...

After digging around in the actual code, I found out that the resulting XML is generated using the original xml-data (where the xsd really matches) which will be pulled through an xslt transformation where no output-scheme exists..

Is there any way to generate a xsd scheme for a given xslt (for the output xml)?
Christoph Keller 9-Sep-13 15:55pm View    
Hey SA,

I created a small test-project with both serializing and deserializing. Here is the code https://bitbucket.org/cke/xsdxmldeserializertest/overview (open for pulling).

I know, the serialize part is a bit silly using the XmlAttributeOverrides, but this produces exactly the XML I got. And unfortunately it is not possible to make changes to the XML output nor to the XSD scheme.

By creating the test-project, I saw a (very hacky) workaround, by adding such overrides for each class defined in the XSD, but this should be really the last solution. Are there any other possibilities to deserialize the XML where there are no namespaces defined?

Thanks for your help.

Best regards,
Chris
Christoph Keller 9-Sep-13 14:07pm View    
Hey SA,

Thanks for your reply. The xml unfortunately was generated using the schema I used to generate the classes.. They match except for the xmlns on the root node, and that is the source of the problem I think.

How can I get the XmlSerializer to deserialize the xml data without lookung at the xmlns, or other way around, how can I inject the xmlns attribute onto the xml string?

Thank you very much for your help.

Best regards,
Chris