George George

George George

  • NA
  • 778
  • 0

generating XML file issue

Nov 29 2008 3:51 AM

Hello everyone,

I want to generate an XML file like below. My confusion is what technologies could I use to concatenate all information into a single XML document.

The root confusion is, I have a class called teacher which matches the teacher sub-section (ID, name and major) -- which I could use serialization technologies to generate teacher part XML information.

For other parts, like department, I also have a class to represent the information -- I could also use serialization technologies to serialize the information to XML -- but it has no relationship between teachers. So, my confusion is, how to concatenate different parts altogether, like department, club and teachers, and also make the whole XML document looks like below to reflect the relationships and hierarchies between them?

[Code]
<?xml version="1.0" encoding="utf-8"?>
<Department>
  <DepartmentInfo ID ="100">
    <Location> San Jose </Location>
    <Type> Computer Science</Type>
  </DepartmentInfo>
    <Clubs>
      <Club ID="200">
        <Name>Football</Name>
      </Club>
      <Club ID="201">
        <Name>Basketball</Name>
      </Club>
    </Clubs>
    <Teachers>
      <Teacher ID="300">
        <Name>Thomas</Name>
        <Major>Algorithm</Major>
      </Teacher>
      <Teacher ID="301">
        <Name>Zhou</Name>
        <Major>Linear Programming</Major>
      </Teacher>
    </Teachers>
</Department>
[/Code]

thanks in advance,
George


Answers (1)