Hi,
Is it possible in .NET XML serialization to store element references in
attributes, maybe using IDs and IDREF? For element references, I always get a
copy of the element instead of a reference in the XML code.
That's what I want:
<FlightData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="htt
p://www.w3.org/2001/XMLSchema" xmlns="http://demo.ns/flightdata">
<airport code="FRA" cityName="Frankfurt" />
<airport code="SFO" cityName="San Francisco" />
<flight flightNumber="UA2344" from="#FRA" to="#SFO" />
</FlightData>
That's what I get instead:
<FlightData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="htt
p://www.w3.org/2001/XMLSchema" xmlns="http://demo.ns/flightdata">
<airport code="FRA" cityName="Frankfurt" />
<airport code="SFO" cityName="San Francisco" />
<flight flightNumber="UA2344">
<from code="FRA" cityName="Frankfurt" />
<to code="SFO" cityName="San Francisco" />
</flight>
</FlightData>
Is there any combination of serialization attributes that can accomplish this,
or do I have to use a custom XML serializer? BTW, I'm using Visual Studio
2008.
Regards,
Niklas