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="Frank furt" />
<airport code="SFO" cityName="San Francisco" />
<flight flightNumber="U A2344" 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="Frank furt" />
<airport code="SFO" cityName="San Francisco" />
<flight flightNumber="U A2344">
<from code="FRA" cityName="Frank furt" />
<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
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="Frank furt" />
<airport code="SFO" cityName="San Francisco" />
<flight flightNumber="U A2344" 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="Frank furt" />
<airport code="SFO" cityName="San Francisco" />
<flight flightNumber="U A2344">
<from code="FRA" cityName="Frank furt" />
<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
Comment