Flattening XML data during deserialization

R

Robert Jacobson

Hi,

If I have an XML file that stores its data in a hierarchical relationship,
is there a way to automatically "flatten" this relationship when I
deserialize it (using the XmlSerializer) to a collection of objects?

For example, assume that I have an XML file that contains the following data
for lastnames/firstnames:

Anderson
Bob
Ann
Jones
Betty
Fred
Mark
Smith
Paul
Gina

I'd like to deserialize this file into a set of "Person" objects, with each
Person containing both a lastname and firstname (rather than separate
"LastName" and "FirstName" objects in a hierarchical relationship):

Anderson, Bob
Anderson, Ann
Jones, Betty
Jones, Fred
Jones, Mark
Smith, Paul
Smith, Gina

Is there any Framework way to do this automatically (perhaps by using an
attribute), or do I need to write custom deserialization code to do this?
Many thanks.
 
C

Cowboy \(Gregory A. Beamer\)

Deserialize and run through an XSLT stylesheet that gives you what you are
looking for. With XSLT, this exercise will be fairly easy and fast.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
 
R

Robert Jacobson

It looks like that will do the trick. Thanks!

Cowboy (Gregory A. Beamer) said:
Deserialize and run through an XSLT stylesheet that gives you what you are
looking for. With XSLT, this exercise will be fairly easy and fast.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top