conditional xml serialization

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Carel
    New Member
    • Nov 2009
    • 4

    conditional xml serialization

    Running into trouble conditioning what gets serialized by the XmlSerializer.

    Case is as follows:

    When a serialized element C is serialized under (as a child of) a specific other element P then I want the serializer to only serialize specific elements of C.

    I know of ...Specified but found no way of achieving the above using it. Is there another way?

    Any help would be greatly appreciated,

    Regards
  • Carel
    New Member
    • Nov 2009
    • 4

    #2
    ... seems I have to flatten and introduce id's for structuring so I can use XmlExclude, still it would be nice to have say a callback from the serializer that gave me structural information like 'parent element' that I could use to enable/disable output of some element, is that possible?

    Comment

    • Dormilich
      Recognized Expert Expert
      • Aug 2008
      • 8694

      #3
      Hm, would be nice to know, what serializer (which language) you are talking about…

      Comment

      • Carel
        New Member
        • Nov 2009
        • 4

        #4
        I am using C# and the XmlSerializer that comes with .Net. The introduction of identifiers replacing references solces the problem of the serializer serializing the instance more than once.

        Comment

        Working...