XML : Maintaining Parent-Child Relationship During XML Serialization/Deserialization

Is it possible to maintain parent-child relationships when deserializing an XML file where there is a unique identifier in each the parent and child. For example, if the "Name" tag always contains a unique ID what would be the best means of maintaining the parent-child relationship in the following XML:

  <Building>      <Name>Bldg 1</Name>      <Room>          <Name>Room 1</Name>          <Table>              <Name>Table 1</Name>          </Table>      </Room>  </Building>    

In the class there is a property to house the parent node's text value in the "Name" tag, as well as the parent name's tag. For example, the "Room" tag with name "Room 1" would have a property for the parent node's name, which is "Bldg 1" and a property for the parent node's tag, which would be "Building". I don't have control over the schema, but this is a simplified version of the format the data is in.

No comments:

Post a Comment