利用dom4j解析xml文件导入MySql

时间:2024-04-09 13:04:30

#添加pom.xml的依赖架包
因为我的项目是基于Maven管理,有个父pom,所以不用添加版本号

	<dependency>
         <groupId>dom4j</groupId>
         <artifactId>dom4j</artifactId>
        </dependency>
        <dependency>
        <groupId>jaxen</groupId>
        <artifactId>jaxen</artifactId>
        </dependency>
       <!--导入数据库依赖架包-->
        <dependency>
       <groupId>mysql</groupId>
       <artifactId>mysql-connector-java</artifactId>
        <version>8.0.11</version>
    </dependency>

举个例子1.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<EBUILD Airline="CA" ChannelID="CTO_PEK" ServiceName="AirAvailability" Version="1.0">
  <Header>
        <tc>
            <iden p="TEST_PWD" u="090297" pseudocity="PEK003" agy="08392053"/>
			<provider session="CA_CTO_PEK_201504141854216902" host="d"/>
        </tc>
  </Header>
  <Body>
    <RES>
      <AirAvailabilityRS>
        <OriginDestination>
          <Flight>
            <Segment>
              <Departure>
                <AirportCode>PEK</AirportCode>
                <AirportName>首都机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>06:50</Time>
                <Terminal>T3</Terminal>
              </Departure>
              <Arrival>
                <AirportCode>SHA</AirportCode>
                <AirportName>虹桥机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>09:05</Time>
                <Terminal>T2</Terminal>
              </Arrival>
              <Carrier>
                <AirlineCode>CA</AirlineCode>
                <AirlineName>CA</AirlineName>
                <FlightNumber>5901</FlightNumber>
              </Carrier>
              <OperatingCarrier>
                <AirlineCode>HO</AirlineCode>
                <AirlineName>HO</AirlineName>
                <FlightNumber>1252</FlightNumber>
              </OperatingCarrier>
              <Equipment>
                <Code>320</Code>
                <Name>320</Name>
              </Equipment>
              <NumberOfStops>0</NumberOfStops>
              <Meals>B</Meals>
              <Frequency />
              <ElectronicTicketing>Y</ElectronicTicketing>
              <LegMiles />
              <Classes>
                <ClassOfService Status="A">B</ClassOfService>
                <ClassOfService Status="A">H</ClassOfService>
                <ClassOfService Status="A">K</ClassOfService>
                <ClassOfService Status="A">L</ClassOfService>
                <ClassOfService Status="A">Q</ClassOfService>
                <ClassOfService Status="A">Y</ClassOfService>
              </Classes>
            </Segment>
          </Flight>
          <Flight>
            <Segment>
              <Departure>
                <AirportCode>PEK</AirportCode>
                <AirportName>首都机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>07:30</Time>
                <Terminal>T3</Terminal>
              </Departure>
              <Arrival>
                <AirportCode>SHA</AirportCode>
                <AirportName>虹桥机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>09:40</Time>
                <Terminal>T2</Terminal>
              </Arrival>
              <Carrier>
                <AirlineCode>CA</AirlineCode>
                <AirlineName>CA</AirlineName>
                <FlightNumber>1831</FlightNumber>
              </Carrier>
              <Equipment>
                <Code>330</Code>
                <Name>330</Name>
              </Equipment>
              <NumberOfStops>0</NumberOfStops>
              <Meals>B</Meals>
              <Frequency />
              <ElectronicTicketing>N</ElectronicTicketing>
              <LegMiles />
              <Classes>
                <ClassOfService Status="3">A</ClassOfService>
                <ClassOfService Status="A">B</ClassOfService>
                <ClassOfService Status="S">E</ClassOfService>
                <ClassOfService Status="3">F</ClassOfService>
                <ClassOfService Status="S">G</ClassOfService>
                <ClassOfService Status="A">H</ClassOfService>
                <ClassOfService Status="A">K</ClassOfService>
                <ClassOfService Status="A">L</ClassOfService>
                <ClassOfService Status="A">M1</ClassOfService>
                <ClassOfService Status="S">N</ClassOfService>
                <ClassOfService Status="2">O</ClassOfService>
                <ClassOfService Status="A">Q</ClassOfService>
                <ClassOfService Status="A">S</ClassOfService>
                <ClassOfService Status="S">T</ClassOfService>
                <ClassOfService Status="A">U</ClassOfService>
                <ClassOfService Status="S">V1</ClassOfService>
                <ClassOfService Status="2">X</ClassOfService>
                <ClassOfService Status="A">Y</ClassOfService>
              </Classes>
            </Segment>
          </Flight>
          <Flight>
            <Segment>
              <Departure>
                <AirportCode>PEK</AirportCode>
                <AirportName>首都机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>07:30</Time>
                <Terminal>T3</Terminal>
              </Departure>
              <Arrival>
                <AirportCode>SHA</AirportCode>
                <AirportName>虹桥机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>09:40</Time>
                <Terminal>T2</Terminal>
              </Arrival>
              <Carrier>
                <AirlineCode>CA</AirlineCode>
                <AirlineName>CA</AirlineName>
                <FlightNumber Suffix="A">1831</FlightNumber>
              </Carrier>
              <Equipment>
                <Code>330</Code>
                <Name>330</Name>
              </Equipment>
              <NumberOfStops>0</NumberOfStops>
              <Meals>B</Meals>
              <Frequency />
              <ElectronicTicketing>Y</ElectronicTicketing>
              <LegMiles />
              <Classes>
                <ClassOfService Status="R">A</ClassOfService>
                <ClassOfService Status="R">B</ClassOfService>
                <ClassOfService Status="R">E</ClassOfService>
                <ClassOfService Status="R">F</ClassOfService>
                <ClassOfService Status="R">G</ClassOfService>
                <ClassOfService Status="R">H</ClassOfService>
                <ClassOfService Status="R">K</ClassOfService>
                <ClassOfService Status="R">L</ClassOfService>
                <ClassOfService Status="R">M1</ClassOfService>
                <ClassOfService Status="R">N</ClassOfService>
                <ClassOfService Status="R">O</ClassOfService>
                <ClassOfService Status="R">Q</ClassOfService>
                <ClassOfService Status="R">S</ClassOfService>
                <ClassOfService Status="R">T</ClassOfService>
                <ClassOfService Status="R">U</ClassOfService>
                <ClassOfService Status="R">V1</ClassOfService>
                <ClassOfService Status="R">X</ClassOfService>
                <ClassOfService Status="R">Y</ClassOfService>
              </Classes>
            </Segment>
          </Flight>
          <Flight>
            <Segment>
              <Departure>
                <AirportCode>PEK</AirportCode>
                <AirportName>首都机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>08:05</Time>
                <Terminal>T3</Terminal>
              </Departure>
              <Arrival>
                <AirportCode>PVG</AirportCode>
                <AirportName>浦东机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>10:15</Time>
                <Terminal>T2</Terminal>
              </Arrival>
              <Carrier>
                <AirlineCode>CA</AirlineCode>
                <AirlineName>CA</AirlineName>
                <FlightNumber>1835</FlightNumber>
              </Carrier>
              <Equipment>
                <Code>32A</Code>
                <Name>32A</Name>
              </Equipment>
              <NumberOfStops>0</NumberOfStops>
              <Meals>S</Meals>
              <Frequency />
              <ElectronicTicketing>N</ElectronicTicketing>
              <LegMiles />
              <Classes>
                <ClassOfService Status="S">A</ClassOfService>
                <ClassOfService Status="A">B</ClassOfService>
                <ClassOfService Status="S">E</ClassOfService>
                <ClassOfService Status="A">F</ClassOfService>
                <ClassOfService Status="S">G</ClassOfService>
                <ClassOfService Status="A">H</ClassOfService>
                <ClassOfService Status="A">K</ClassOfService>
                <ClassOfService Status="8">L</ClassOfService>
                <ClassOfService Status="A">M1</ClassOfService>
                <ClassOfService Status="S">N</ClassOfService>
                <ClassOfService Status="S">O</ClassOfService>
                <ClassOfService Status="S">Q</ClassOfService>
                <ClassOfService Status="A">S</ClassOfService>
                <ClassOfService Status="S">T</ClassOfService>
                <ClassOfService Status="A">U</ClassOfService>
                <ClassOfService Status="S">V1</ClassOfService>
                <ClassOfService Status="3">X</ClassOfService>
                <ClassOfService Status="A">Y</ClassOfService>
              </Classes>
            </Segment>
          </Flight>
          <Flight>
            <Segment>
              <Departure>
                <AirportCode>PEK</AirportCode>
                <AirportName>首都机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>08:05</Time>
                <Terminal>T3</Terminal>
              </Departure>
              <Arrival>
                <AirportCode>SHA</AirportCode>
                <AirportName>虹桥机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>11:40</Time>
                <Terminal>T2</Terminal>
              </Arrival>
              <Carrier>
                <AirlineCode>CA</AirlineCode>
                <AirlineName>CA</AirlineName>
                <FlightNumber>1125</FlightNumber>
              </Carrier>
              <Equipment>
                <Code>73G</Code>
                <Name>73G</Name>
              </Equipment>
              <NumberOfStops>0</NumberOfStops>
              <Meals>B</Meals>
              <Frequency />
              <ElectronicTicketing>N</ElectronicTicketing>
              <LegMiles />
              <Classes>
                <ClassOfService Status="R">A</ClassOfService>
                <ClassOfService Status="R">B</ClassOfService>
                <ClassOfService Status="R">E</ClassOfService>
                <ClassOfService Status="R">F</ClassOfService>
                <ClassOfService Status="R">G</ClassOfService>
                <ClassOfService Status="R">H</ClassOfService>
                <ClassOfService Status="R">K</ClassOfService>
                <ClassOfService Status="R">L</ClassOfService>
                <ClassOfService Status="R">M1</ClassOfService>
                <ClassOfService Status="S">N</ClassOfService>
                <ClassOfService Status="R">O</ClassOfService>
                <ClassOfService Status="R">Q</ClassOfService>
                <ClassOfService Status="R">S</ClassOfService>
                <ClassOfService Status="R">T</ClassOfService>
                <ClassOfService Status="R">U</ClassOfService>
                <ClassOfService Status="R">V1</ClassOfService>
                <ClassOfService Status="R">X</ClassOfService>
                <ClassOfService Status="R">Y</ClassOfService>
              </Classes>
            </Segment>
          </Flight>
          <Flight>
            <Segment>
              <Departure>
                <AirportCode>PEK</AirportCode>
                <AirportName>首都机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>08:30</Time>
                <Terminal>T3</Terminal>
              </Departure>
              <Arrival>
                <AirportCode>SHA</AirportCode>
                <AirportName>虹桥机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>10:40</Time>
                <Terminal>T2</Terminal>
              </Arrival>
              <Carrier>
                <AirlineCode>CA</AirlineCode>
                <AirlineName>CA</AirlineName>
                <FlightNumber Suffix="Q">1501</FlightNumber>
              </Carrier>
              <Equipment>
                <Code>77S</Code>
                <Name>77S</Name>
              </Equipment>
              <NumberOfStops>0</NumberOfStops>
              <Meals>B</Meals>
              <Frequency />
              <ElectronicTicketing>Y</ElectronicTicketing>
              <LegMiles />
              <Classes>
                <ClassOfService Status="R">A</ClassOfService>
                <ClassOfService Status="R">B</ClassOfService>
                <ClassOfService Status="R">E</ClassOfService>
                <ClassOfService Status="R">F</ClassOfService>
                <ClassOfService Status="R">G</ClassOfService>
                <ClassOfService Status="R">H</ClassOfService>
                <ClassOfService Status="R">K</ClassOfService>
                <ClassOfService Status="R">L</ClassOfService>
                <ClassOfService Status="R">M1</ClassOfService>
                <ClassOfService Status="R">N</ClassOfService>
                <ClassOfService Status="R">O</ClassOfService>
                <ClassOfService Status="R">Q</ClassOfService>
                <ClassOfService Status="R">S</ClassOfService>
                <ClassOfService Status="R">T</ClassOfService>
                <ClassOfService Status="R">U</ClassOfService>
                <ClassOfService Status="R">V1</ClassOfService>
                <ClassOfService Status="R">W</ClassOfService>
                <ClassOfService Status="R">X</ClassOfService>
                <ClassOfService Status="R">Y</ClassOfService>
              </Classes>
            </Segment>
          </Flight>
          <Flight>
            <Segment>
              <Departure>
                <AirportCode>PEK</AirportCode>
                <AirportName>首都机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>08:30</Time>
                <Terminal>T3</Terminal>
              </Departure>
              <Arrival>
                <AirportCode>SHA</AirportCode>
                <AirportName>虹桥机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>10:40</Time>
                <Terminal>T2</Terminal>
              </Arrival>
              <Carrier>
                <AirlineCode>CA</AirlineCode>
                <AirlineName>CA</AirlineName>
                <FlightNumber>1501</FlightNumber>
              </Carrier>
              <Equipment>
                <Code>77S</Code>
                <Name>77S</Name>
              </Equipment>
              <NumberOfStops>0</NumberOfStops>
              <Meals>B</Meals>
              <Frequency />
              <ElectronicTicketing>N</ElectronicTicketing>
              <LegMiles />
              <Classes>
                <ClassOfService Status="6">A</ClassOfService>
                <ClassOfService Status="A">B</ClassOfService>
                <ClassOfService Status="Q">E</ClassOfService>
                <ClassOfService Status="A">F</ClassOfService>
                <ClassOfService Status="Q">G</ClassOfService>
                <ClassOfService Status="A">H</ClassOfService>
                <ClassOfService Status="A">K</ClassOfService>
                <ClassOfService Status="A">L</ClassOfService>
                <ClassOfService Status="A">M1</ClassOfService>
                <ClassOfService Status="S">N</ClassOfService>
                <ClassOfService Status="S">O</ClassOfService>
                <ClassOfService Status="Q">Q</ClassOfService>
                <ClassOfService Status="A">S</ClassOfService>
                <ClassOfService Status="Q">T</ClassOfService>
                <ClassOfService Status="A">U</ClassOfService>
                <ClassOfService Status="Q">V1</ClassOfService>
                <ClassOfService Status="A">W</ClassOfService>
                <ClassOfService Status="S">X</ClassOfService>
                <ClassOfService Status="A">Y</ClassOfService>
              </Classes>
            </Segment>
          </Flight>
          <Flight>
            <Segment>
              <Departure>
                <AirportCode>PEK</AirportCode>
                <AirportName>首都机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>09:30</Time>
                <Terminal>T3</Terminal>
              </Departure>
              <Arrival>
                <AirportCode>SHA</AirportCode>
                <AirportName>虹桥机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>11:40</Time>
                <Terminal>T2</Terminal>
              </Arrival>
              <Carrier>
                <AirlineCode>CA</AirlineCode>
                <AirlineName>CA</AirlineName>
                <FlightNumber>1519</FlightNumber>
              </Carrier>
              <Equipment>
                <Code>77L</Code>
                <Name>77L</Name>
              </Equipment>
              <NumberOfStops>0</NumberOfStops>
              <Meals>S</Meals>
              <Frequency />
              <ElectronicTicketing>Y</ElectronicTicketing>
              <LegMiles />
              <Classes>
                <ClassOfService Status="S">A</ClassOfService>
                <ClassOfService Status="A">B</ClassOfService>
                <ClassOfService Status="S">E</ClassOfService>
                <ClassOfService Status="A">F</ClassOfService>
                <ClassOfService Status="S">G</ClassOfService>
                <ClassOfService Status="A">H</ClassOfService>
                <ClassOfService Status="A">K</ClassOfService>
                <ClassOfService Status="3">L</ClassOfService>
                <ClassOfService Status="A">M1</ClassOfService>
                <ClassOfService Status="S">N</ClassOfService>
                <ClassOfService Status="S">O</ClassOfService>
                <ClassOfService Status="S">Q</ClassOfService>
                <ClassOfService Status="A">S</ClassOfService>
                <ClassOfService Status="S">T</ClassOfService>
                <ClassOfService Status="A">U</ClassOfService>
                <ClassOfService Status="S">V1</ClassOfService>
                <ClassOfService Status="A">W</ClassOfService>
                <ClassOfService Status="4">X</ClassOfService>
                <ClassOfService Status="A">Y</ClassOfService>
              </Classes>
            </Segment>
          </Flight>
          <Flight>
            <Segment>
              <Departure>
                <AirportCode>PEK</AirportCode>
                <AirportName>首都机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>10:00</Time>
                <Terminal>T3</Terminal>
              </Departure>
              <Arrival>
                <AirportCode>SHA</AirportCode>
                <AirportName>虹桥机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>11:40</Time>
                <Terminal>T2</Terminal>
              </Arrival>
              <Carrier>
                <AirlineCode>CA</AirlineCode>
                <AirlineName>CA</AirlineName>
                <FlightNumber>113</FlightNumber>
              </Carrier>
              <Equipment>
                <Code>738</Code>
                <Name>738</Name>
              </Equipment>
              <NumberOfStops>0</NumberOfStops>
              <Frequency />
              <ElectronicTicketing>N</ElectronicTicketing>
              <LegMiles />
              <Classes>
                <ClassOfService Status="R">B</ClassOfService>
                <ClassOfService Status="R">C</ClassOfService>
                <ClassOfService Status="R">D</ClassOfService>
                <ClassOfService Status="R">E</ClassOfService>
                <ClassOfService Status="R">G</ClassOfService>
                <ClassOfService Status="R">H</ClassOfService>
                <ClassOfService Status="R">I</ClassOfService>
                <ClassOfService Status="R">J</ClassOfService>
                <ClassOfService Status="R">K</ClassOfService>
                <ClassOfService Status="R">L</ClassOfService>
                <ClassOfService Status="R">M1</ClassOfService>
                <ClassOfService Status="R">N</ClassOfService>
                <ClassOfService Status="R">Q</ClassOfService>
                <ClassOfService Status="R">R</ClassOfService>
                <ClassOfService Status="R">S</ClassOfService>
                <ClassOfService Status="R">T</ClassOfService>
                <ClassOfService Status="R">U</ClassOfService>
                <ClassOfService Status="R">V1</ClassOfService>
                <ClassOfService Status="R">X</ClassOfService>
                <ClassOfService Status="R">Y</ClassOfService>
                <ClassOfService Status="R">Z</ClassOfService>
              </Classes>
            </Segment>
          </Flight>
          <Flight>
            <Segment>
              <Departure>
                <AirportCode>PEK</AirportCode>
                <AirportName>首都机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>11:00</Time>
                <Terminal>T3</Terminal>
              </Departure>
              <Arrival>
                <AirportCode>SHA</AirportCode>
                <AirportName>虹桥机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>13:30</Time>
                <Terminal>T2</Terminal>
              </Arrival>
              <Carrier>
                <AirlineCode>CA</AirlineCode>
                <AirlineName>CA</AirlineName>
                <FlightNumber>1006</FlightNumber>
              </Carrier>
              <Equipment>
                <Code>773</Code>
                <Name>773</Name>
              </Equipment>
              <NumberOfStops>0</NumberOfStops>
              <Meals>S</Meals>
              <Frequency />
              <ElectronicTicketing>Y</ElectronicTicketing>
              <LegMiles />
              <Classes>
                <ClassOfService Status="R">A</ClassOfService>
                <ClassOfService Status="R">B</ClassOfService>
                <ClassOfService Status="R">C</ClassOfService>
                <ClassOfService Status="R">D</ClassOfService>
                <ClassOfService Status="R">E</ClassOfService>
                <ClassOfService Status="R">F</ClassOfService>
                <ClassOfService Status="R">G</ClassOfService>
                <ClassOfService Status="R">H</ClassOfService>
                <ClassOfService Status="R">I</ClassOfService>
                <ClassOfService Status="R">J</ClassOfService>
                <ClassOfService Status="R">K</ClassOfService>
                <ClassOfService Status="R">L</ClassOfService>
                <ClassOfService Status="R">M1</ClassOfService>
                <ClassOfService Status="S">N</ClassOfService>
                <ClassOfService Status="R">O</ClassOfService>
                <ClassOfService Status="R">Q</ClassOfService>
                <ClassOfService Status="R">R</ClassOfService>
                <ClassOfService Status="R">S</ClassOfService>
                <ClassOfService Status="R">T</ClassOfService>
                <ClassOfService Status="R">U</ClassOfService>
                <ClassOfService Status="R">V1</ClassOfService>
                <ClassOfService Status="R">X</ClassOfService>
                <ClassOfService Status="R">Y</ClassOfService>
                <ClassOfService Status="R">Z</ClassOfService>
              </Classes>
            </Segment>
          </Flight>
          <Flight>
            <Segment>
              <Departure>
                <AirportCode>PEK</AirportCode>
                <AirportName>首都机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>11:30</Time>
                <Terminal>T3</Terminal>
              </Departure>
              <Arrival>
                <AirportCode>SHA</AirportCode>
                <AirportName>虹桥机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>13:40</Time>
                <Terminal>T2</Terminal>
              </Arrival>
              <Carrier>
                <AirlineCode>CA</AirlineCode>
                <AirlineName>CA</AirlineName>
                <FlightNumber>1557</FlightNumber>
              </Carrier>
              <Equipment>
                <Code>33A</Code>
                <Name>33A</Name>
              </Equipment>
              <NumberOfStops>0</NumberOfStops>
              <Meals>L</Meals>
              <Frequency />
              <ElectronicTicketing>Y</ElectronicTicketing>
              <LegMiles />
              <Classes>
                <ClassOfService Status="1">A</ClassOfService>
                <ClassOfService Status="S">B</ClassOfService>
                <ClassOfService Status="S">E</ClassOfService>
                <ClassOfService Status="4">F</ClassOfService>
                <ClassOfService Status="S">G</ClassOfService>
                <ClassOfService Status="S">H</ClassOfService>
                <ClassOfService Status="S">K</ClassOfService>
                <ClassOfService Status="S">L</ClassOfService>
                <ClassOfService Status="S">M1</ClassOfService>
                <ClassOfService Status="S">N</ClassOfService>
                <ClassOfService Status="1">O</ClassOfService>
                <ClassOfService Status="S">Q</ClassOfService>
                <ClassOfService Status="S">S</ClassOfService>
                <ClassOfService Status="S">T</ClassOfService>
                <ClassOfService Status="A">U</ClassOfService>
                <ClassOfService Status="S">V1</ClassOfService>
                <ClassOfService Status="A">W</ClassOfService>
                <ClassOfService Status="4">X</ClassOfService>
                <ClassOfService Status="A">Y</ClassOfService>
              </Classes>
            </Segment>
          </Flight>
          <Flight>
            <Segment>
              <Departure>
                <AirportCode>PEK</AirportCode>
                <AirportName>首都机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>12:00</Time>
                <Terminal>T3</Terminal>
              </Departure>
              <Arrival>
                <AirportCode>SHA</AirportCode>
                <AirportName>虹桥机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>14:00</Time>
                <Terminal>T2</Terminal>
              </Arrival>
              <Carrier>
                <AirlineCode>CA</AirlineCode>
                <AirlineName>CA</AirlineName>
                <FlightNumber>8003</FlightNumber>
              </Carrier>
              <Equipment>
                <Code>330</Code>
                <Name>330</Name>
              </Equipment>
              <NumberOfStops>0</NumberOfStops>
              <Frequency />
              <ElectronicTicketing>Y</ElectronicTicketing>
              <LegMiles />
              <Classes>
                <ClassOfService Status="R">A</ClassOfService>
                <ClassOfService Status="R">B</ClassOfService>
                <ClassOfService Status="R">E</ClassOfService>
                <ClassOfService Status="R">H</ClassOfService>
                <ClassOfService Status="R">K</ClassOfService>
                <ClassOfService Status="R">L</ClassOfService>
                <ClassOfService Status="R">M1</ClassOfService>
                <ClassOfService Status="S">N</ClassOfService>
                <ClassOfService Status="R">O</ClassOfService>
                <ClassOfService Status="R">Q</ClassOfService>
                <ClassOfService Status="R">S</ClassOfService>
                <ClassOfService Status="R">T</ClassOfService>
                <ClassOfService Status="R">U</ClassOfService>
                <ClassOfService Status="R">V1</ClassOfService>
                <ClassOfService Status="R">X</ClassOfService>
                <ClassOfService Status="R">Y</ClassOfService>
              </Classes>
            </Segment>
          </Flight>
          <Flight>
            <Segment>
              <Departure>
                <AirportCode>PEK</AirportCode>
                <AirportName>首都机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>13:30</Time>
                <Terminal>T3</Terminal>
              </Departure>
              <Arrival>
                <AirportCode>SHA</AirportCode>
                <AirportName>虹桥机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>15:40</Time>
                <Terminal>T2</Terminal>
              </Arrival>
              <Carrier>
                <AirlineCode>CA</AirlineCode>
                <AirlineName>CA</AirlineName>
                <FlightNumber>1517</FlightNumber>
              </Carrier>
              <Equipment>
                <Code>744</Code>
                <Name>744</Name>
              </Equipment>
              <NumberOfStops>0</NumberOfStops>
              <Meals>M</Meals>
              <Frequency />
              <ElectronicTicketing>N</ElectronicTicketing>
              <LegMiles />
              <Classes>
                <ClassOfService Status="S">A</ClassOfService>
                <ClassOfService Status="S">B</ClassOfService>
                <ClassOfService Status="A">C</ClassOfService>
                <ClassOfService Status="5">D</ClassOfService>
                <ClassOfService Status="S">E</ClassOfService>
                <ClassOfService Status="A">F</ClassOfService>
                <ClassOfService Status="S">G</ClassOfService>
                <ClassOfService Status="S">H</ClassOfService>
                <ClassOfService Status="2">I</ClassOfService>
                <ClassOfService Status="S">J</ClassOfService>
                <ClassOfService Status="S">K</ClassOfService>
                <ClassOfService Status="S">L</ClassOfService>
                <ClassOfService Status="S">M1</ClassOfService>
                <ClassOfService Status="S">N</ClassOfService>
                <ClassOfService Status="S">O</ClassOfService>
                <ClassOfService Status="S">Q</ClassOfService>
                <ClassOfService Status="2">R</ClassOfService>
                <ClassOfService Status="S">S</ClassOfService>
                <ClassOfService Status="S">T</ClassOfService>
                <ClassOfService Status="A">U</ClassOfService>
                <ClassOfService Status="S">V1</ClassOfService>
                <ClassOfService Status="4">X</ClassOfService>
                <ClassOfService Status="A">Y</ClassOfService>
                <ClassOfService Status="2">Z</ClassOfService>
              </Classes>
            </Segment>
          </Flight>
          <Flight>
            <Segment>
              <Departure>
                <AirportCode>PEK</AirportCode>
                <AirportName>首都机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>14:30</Time>
                <Terminal>T3</Terminal>
              </Departure>
              <Arrival>
                <AirportCode>SHA</AirportCode>
                <AirportName>虹桥机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>16:40</Time>
                <Terminal>T2</Terminal>
              </Arrival>
              <Carrier>
                <AirlineCode>CA</AirlineCode>
                <AirlineName>CA</AirlineName>
                <FlightNumber>1521</FlightNumber>
              </Carrier>
              <Equipment>
                <Code>773</Code>
                <Name>773</Name>
              </Equipment>
              <NumberOfStops>0</NumberOfStops>
              <Meals>S</Meals>
              <Frequency />
              <ElectronicTicketing>Y</ElectronicTicketing>
              <LegMiles />
              <Classes>
                <ClassOfService Status="2">A</ClassOfService>
                <ClassOfService Status="S">B</ClassOfService>
                <ClassOfService Status="S">E</ClassOfService>
                <ClassOfService Status="A">F</ClassOfService>
                <ClassOfService Status="S">G</ClassOfService>
                <ClassOfService Status="S">H</ClassOfService>
                <ClassOfService Status="S">K</ClassOfService>
                <ClassOfService Status="S">L</ClassOfService>
                <ClassOfService Status="S">M1</ClassOfService>
                <ClassOfService Status="S">N</ClassOfService>
                <ClassOfService Status="S">O</ClassOfService>
                <ClassOfService Status="8">P</ClassOfService>
                <ClassOfService Status="S">Q</ClassOfService>
                <ClassOfService Status="S">S</ClassOfService>
                <ClassOfService Status="S">T</ClassOfService>
                <ClassOfService Status="A">U</ClassOfService>
                <ClassOfService Status="S">V1</ClassOfService>
                <ClassOfService Status="3">X</ClassOfService>
                <ClassOfService Status="A">Y</ClassOfService>
              </Classes>
            </Segment>
          </Flight>
          <Flight>
            <Segment>
              <Departure>
                <AirportCode>PEK</AirportCode>
                <AirportName>首都机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>15:25</Time>
                <Terminal>T3</Terminal>
              </Departure>
              <Arrival>
                <AirportCode>PVG</AirportCode>
                <AirportName>浦东机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>17:35</Time>
                <Terminal>T2</Terminal>
              </Arrival>
              <Carrier>
                <AirlineCode>CA</AirlineCode>
                <AirlineName>CA</AirlineName>
                <FlightNumber>177</FlightNumber>
              </Carrier>
              <Equipment>
                <Code>330</Code>
                <Name>330</Name>
              </Equipment>
              <NumberOfStops>0</NumberOfStops>
              <Meals>S</Meals>
              <Frequency />
              <ElectronicTicketing>Y</ElectronicTicketing>
              <LegMiles />
              <Classes>
                <ClassOfService Status="Q">B</ClassOfService>
                <ClassOfService Status="A">C</ClassOfService>
                <ClassOfService Status="S">D</ClassOfService>
                <ClassOfService Status="Q">E</ClassOfService>
                <ClassOfService Status="Q">G</ClassOfService>
                <ClassOfService Status="Q">H</ClassOfService>
                <ClassOfService Status="1">I</ClassOfService>
                <ClassOfService Status="S">J</ClassOfService>
                <ClassOfService Status="Q">K</ClassOfService>
                <ClassOfService Status="Q">L</ClassOfService>
                <ClassOfService Status="Q">M1</ClassOfService>
                <ClassOfService Status="Q">N</ClassOfService>
                <ClassOfService Status="Q">Q</ClassOfService>
                <ClassOfService Status="S">R</ClassOfService>
                <ClassOfService Status="Q">S</ClassOfService>
                <ClassOfService Status="Q">T</ClassOfService>
                <ClassOfService Status="A">U</ClassOfService>
                <ClassOfService Status="Q">V1</ClassOfService>
                <ClassOfService Status="Q">X</ClassOfService>
                <ClassOfService Status="A">Y</ClassOfService>
                <ClassOfService Status="S">Z</ClassOfService>
              </Classes>
            </Segment>
          </Flight>
          <Flight>
            <Segment>
              <Departure>
                <AirportCode>PEK</AirportCode>
                <AirportName>首都机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>15:30</Time>
                <Terminal>T3</Terminal>
              </Departure>
              <Arrival>
                <AirportCode>SHA</AirportCode>
                <AirportName>虹桥机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>17:40</Time>
                <Terminal>T2</Terminal>
              </Arrival>
              <Carrier>
                <AirlineCode>CA</AirlineCode>
                <AirlineName>CA</AirlineName>
                <FlightNumber>1515</FlightNumber>
              </Carrier>
              <Equipment>
                <Code>77L</Code>
                <Name>77L</Name>
              </Equipment>
              <NumberOfStops>0</NumberOfStops>
              <Meals>S</Meals>
              <Frequency />
              <ElectronicTicketing>Y</ElectronicTicketing>
              <LegMiles />
              <Classes>
                <ClassOfService Status="S">A</ClassOfService>
                <ClassOfService Status="S">B</ClassOfService>
                <ClassOfService Status="S">E</ClassOfService>
                <ClassOfService Status="A">F</ClassOfService>
                <ClassOfService Status="S">G</ClassOfService>
                <ClassOfService Status="S">H</ClassOfService>
                <ClassOfService Status="S">K</ClassOfService>
                <ClassOfService Status="S">L</ClassOfService>
                <ClassOfService Status="S">M1</ClassOfService>
                <ClassOfService Status="S">N</ClassOfService>
                <ClassOfService Status="S">O</ClassOfService>
                <ClassOfService Status="S">Q</ClassOfService>
                <ClassOfService Status="S">S</ClassOfService>
                <ClassOfService Status="S">T</ClassOfService>
                <ClassOfService Status="A">U</ClassOfService>
                <ClassOfService Status="S">V1</ClassOfService>
                <ClassOfService Status="A">W</ClassOfService>
                <ClassOfService Status="4">X</ClassOfService>
                <ClassOfService Status="A">Y</ClassOfService>
              </Classes>
            </Segment>
          </Flight>
          <Flight>
            <Segment>
              <Departure>
                <AirportCode>PEK</AirportCode>
                <AirportName>首都机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>16:30</Time>
                <Terminal>T3</Terminal>
              </Departure>
              <Arrival>
                <AirportCode>SHA</AirportCode>
                <AirportName>虹桥机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>18:40</Time>
                <Terminal>T2</Terminal>
              </Arrival>
              <Carrier>
                <AirlineCode>CA</AirlineCode>
                <AirlineName>CA</AirlineName>
                <FlightNumber>1549</FlightNumber>
              </Carrier>
              <Equipment>
                <Code>77L</Code>
                <Name>77L</Name>
              </Equipment>
              <NumberOfStops>0</NumberOfStops>
              <Meals>S</Meals>
              <Frequency />
              <ElectronicTicketing>Y</ElectronicTicketing>
              <LegMiles />
              <Classes>
                <ClassOfService Status="S">A</ClassOfService>
                <ClassOfService Status="S">B</ClassOfService>
                <ClassOfService Status="S">E</ClassOfService>
                <ClassOfService Status="A">F</ClassOfService>
                <ClassOfService Status="S">G</ClassOfService>
                <ClassOfService Status="S">H</ClassOfService>
                <ClassOfService Status="S">K</ClassOfService>
                <ClassOfService Status="S">L</ClassOfService>
                <ClassOfService Status="S">M1</ClassOfService>
                <ClassOfService Status="S">N</ClassOfService>
                <ClassOfService Status="S">O</ClassOfService>
                <ClassOfService Status="S">Q</ClassOfService>
                <ClassOfService Status="S">S</ClassOfService>
                <ClassOfService Status="S">T</ClassOfService>
                <ClassOfService Status="A">U</ClassOfService>
                <ClassOfService Status="S">V1</ClassOfService>
                <ClassOfService Status="A">W</ClassOfService>
                <ClassOfService Status="4">X</ClassOfService>
                <ClassOfService Status="A">Y</ClassOfService>
              </Classes>
            </Segment>
          </Flight>
          <Flight>
            <Segment>
              <Departure>
                <AirportCode>PEK</AirportCode>
                <AirportName>首都机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>17:30</Time>
                <Terminal>T3</Terminal>
              </Departure>
              <Arrival>
                <AirportCode>SHA</AirportCode>
                <AirportName>虹桥机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>19:40</Time>
                <Terminal>T2</Terminal>
              </Arrival>
              <Carrier>
                <AirlineCode>CA</AirlineCode>
                <AirlineName>CA</AirlineName>
                <FlightNumber>1855</FlightNumber>
              </Carrier>
              <Equipment>
                <Code>773</Code>
                <Name>773</Name>
              </Equipment>
              <NumberOfStops>0</NumberOfStops>
              <Meals>D</Meals>
              <Frequency />
              <ElectronicTicketing>N</ElectronicTicketing>
              <LegMiles />
              <Classes>
                <ClassOfService Status="2">A</ClassOfService>
                <ClassOfService Status="S">B</ClassOfService>
                <ClassOfService Status="S">E</ClassOfService>
                <ClassOfService Status="A">F</ClassOfService>
                <ClassOfService Status="S">G</ClassOfService>
                <ClassOfService Status="S">H</ClassOfService>
                <ClassOfService Status="S">K</ClassOfService>
                <ClassOfService Status="S">L</ClassOfService>
                <ClassOfService Status="S">M1</ClassOfService>
                <ClassOfService Status="S">N</ClassOfService>
                <ClassOfService Status="S">O</ClassOfService>
                <ClassOfService Status="4">P</ClassOfService>
                <ClassOfService Status="S">Q</ClassOfService>
                <ClassOfService Status="S">S</ClassOfService>
                <ClassOfService Status="S">T</ClassOfService>
                <ClassOfService Status="A">U</ClassOfService>
                <ClassOfService Status="S">V1</ClassOfService>
                <ClassOfService Status="4">X</ClassOfService>
                <ClassOfService Status="A">Y</ClassOfService>
              </Classes>
            </Segment>
          </Flight>
          <Flight>
            <Segment>
              <Departure>
                <AirportCode>PEK</AirportCode>
                <AirportName>首都机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>18:30</Time>
                <Terminal>T3</Terminal>
              </Departure>
              <Arrival>
                <AirportCode>SHA</AirportCode>
                <AirportName>虹桥机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>20:40</Time>
                <Terminal>T2</Terminal>
              </Arrival>
              <Carrier>
                <AirlineCode>CA</AirlineCode>
                <AirlineName>CA</AirlineName>
                <FlightNumber>1885</FlightNumber>
              </Carrier>
              <Equipment>
                <Code>77S</Code>
                <Name>77S</Name>
              </Equipment>
              <NumberOfStops>0</NumberOfStops>
              <Meals>S</Meals>
              <Frequency />
              <ElectronicTicketing>Y</ElectronicTicketing>
              <LegMiles />
              <Classes>
                <ClassOfService Status="S">A</ClassOfService>
                <ClassOfService Status="S">B</ClassOfService>
                <ClassOfService Status="S">E</ClassOfService>
                <ClassOfService Status="A">F</ClassOfService>
                <ClassOfService Status="S">G</ClassOfService>
                <ClassOfService Status="S">H</ClassOfService>
                <ClassOfService Status="S">K</ClassOfService>
                <ClassOfService Status="S">L</ClassOfService>
                <ClassOfService Status="S">M1</ClassOfService>
                <ClassOfService Status="S">N</ClassOfService>
                <ClassOfService Status="S">O</ClassOfService>
                <ClassOfService Status="S">Q</ClassOfService>
                <ClassOfService Status="S">S</ClassOfService>
                <ClassOfService Status="S">T</ClassOfService>
                <ClassOfService Status="A">U</ClassOfService>
                <ClassOfService Status="S">V1</ClassOfService>
                <ClassOfService Status="A">W</ClassOfService>
                <ClassOfService Status="2">X</ClassOfService>
                <ClassOfService Status="A">Y</ClassOfService>
              </Classes>
            </Segment>
          </Flight>
          <Flight>
            <Segment>
              <Departure>
                <AirportCode>PEK</AirportCode>
                <AirportName>首都机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>19:30</Time>
                <Terminal>T3</Terminal>
              </Departure>
              <Arrival>
                <AirportCode>SHA</AirportCode>
                <AirportName>虹桥机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>21:55</Time>
                <Terminal>T2</Terminal>
              </Arrival>
              <Carrier>
                <AirlineCode>CA</AirlineCode>
                <AirlineName>CA</AirlineName>
                <FlightNumber>1857</FlightNumber>
              </Carrier>
              <Equipment>
                <Code>77L</Code>
                <Name>77L</Name>
              </Equipment>
              <NumberOfStops>0</NumberOfStops>
              <Meals>D</Meals>
              <Frequency />
              <ElectronicTicketing>Y</ElectronicTicketing>
              <LegMiles />
              <Classes>
                <ClassOfService Status="1">A</ClassOfService>
                <ClassOfService Status="S">B</ClassOfService>
                <ClassOfService Status="S">E</ClassOfService>
                <ClassOfService Status="A">F</ClassOfService>
                <ClassOfService Status="S">G</ClassOfService>
                <ClassOfService Status="S">H</ClassOfService>
                <ClassOfService Status="S">K</ClassOfService>
                <ClassOfService Status="S">L</ClassOfService>
                <ClassOfService Status="S">M1</ClassOfService>
                <ClassOfService Status="S">N</ClassOfService>
                <ClassOfService Status="S">O</ClassOfService>
                <ClassOfService Status="S">Q</ClassOfService>
                <ClassOfService Status="S">S</ClassOfService>
                <ClassOfService Status="S">T</ClassOfService>
                <ClassOfService Status="A">U</ClassOfService>
                <ClassOfService Status="S">V1</ClassOfService>
                <ClassOfService Status="A">W</ClassOfService>
                <ClassOfService Status="4">X</ClassOfService>
                <ClassOfService Status="A">Y</ClassOfService>
              </Classes>
            </Segment>
          </Flight>
          <Flight>
            <Segment>
              <Departure>
                <AirportCode>PEK</AirportCode>
                <AirportName>首都机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>20:15</Time>
                <Terminal>T3</Terminal>
              </Departure>
              <Arrival>
                <AirportCode>PVG</AirportCode>
                <AirportName>浦东机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>22:25</Time>
                <Terminal>T2</Terminal>
              </Arrival>
              <Carrier>
                <AirlineCode>CA</AirlineCode>
                <AirlineName>CA</AirlineName>
                <FlightNumber>1883</FlightNumber>
              </Carrier>
              <Equipment>
                <Code>330</Code>
                <Name>330</Name>
              </Equipment>
              <NumberOfStops>0</NumberOfStops>
              <Meals>B</Meals>
              <Frequency />
              <ElectronicTicketing>Y</ElectronicTicketing>
              <LegMiles />
              <Classes>
                <ClassOfService Status="A">A</ClassOfService>
                <ClassOfService Status="S">B</ClassOfService>
                <ClassOfService Status="S">E</ClassOfService>
                <ClassOfService Status="A">F</ClassOfService>
                <ClassOfService Status="S">G</ClassOfService>
                <ClassOfService Status="S">H</ClassOfService>
                <ClassOfService Status="S">K</ClassOfService>
                <ClassOfService Status="S">L</ClassOfService>
                <ClassOfService Status="S">M1</ClassOfService>
                <ClassOfService Status="S">N</ClassOfService>
                <ClassOfService Status="S">O</ClassOfService>
                <ClassOfService Status="S">Q</ClassOfService>
                <ClassOfService Status="S">S</ClassOfService>
                <ClassOfService Status="S">T</ClassOfService>
                <ClassOfService Status="A">U</ClassOfService>
                <ClassOfService Status="S">V1</ClassOfService>
                <ClassOfService Status="4">X</ClassOfService>
                <ClassOfService Status="A">Y</ClassOfService>
              </Classes>
            </Segment>
          </Flight>
          <Flight>
            <Segment>
              <Departure>
                <AirportCode>PEK</AirportCode>
                <AirportName>首都机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>20:15</Time>
                <Terminal>T3</Terminal>
              </Departure>
              <Arrival>
                <AirportCode>PVG</AirportCode>
                <AirportName>浦东机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>22:25</Time>
                <Terminal>T2</Terminal>
              </Arrival>
              <Carrier>
                <AirlineCode>CA</AirlineCode>
                <AirlineName>CA</AirlineName>
                <FlightNumber Suffix="A">1883</FlightNumber>
              </Carrier>
              <Equipment>
                <Code>330</Code>
                <Name>330</Name>
              </Equipment>
              <NumberOfStops>0</NumberOfStops>
              <Meals>B</Meals>
              <Frequency />
              <ElectronicTicketing>Y</ElectronicTicketing>
              <LegMiles />
              <Classes>
                <ClassOfService Status="R">A</ClassOfService>
                <ClassOfService Status="R">B</ClassOfService>
                <ClassOfService Status="R">E</ClassOfService>
                <ClassOfService Status="R">F</ClassOfService>
                <ClassOfService Status="R">G</ClassOfService>
                <ClassOfService Status="R">H</ClassOfService>
                <ClassOfService Status="R">K</ClassOfService>
                <ClassOfService Status="R">L</ClassOfService>
                <ClassOfService Status="R">M1</ClassOfService>
                <ClassOfService Status="R">N</ClassOfService>
                <ClassOfService Status="R">O</ClassOfService>
                <ClassOfService Status="R">Q</ClassOfService>
                <ClassOfService Status="R">S</ClassOfService>
                <ClassOfService Status="R">T</ClassOfService>
                <ClassOfService Status="R">U</ClassOfService>
                <ClassOfService Status="R">V1</ClassOfService>
                <ClassOfService Status="R">X</ClassOfService>
                <ClassOfService Status="R">Y</ClassOfService>
              </Classes>
            </Segment>
          </Flight>
          <Flight>
            <Segment>
              <Departure>
                <AirportCode>PEK</AirportCode>
                <AirportName>首都机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>20:30</Time>
                <Terminal>T3</Terminal>
              </Departure>
              <Arrival>
                <AirportCode>SHA</AirportCode>
                <AirportName>虹桥机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>22:40</Time>
                <Terminal>T2</Terminal>
              </Arrival>
              <Carrier>
                <AirlineCode>CA</AirlineCode>
                <AirlineName>CA</AirlineName>
                <FlightNumber>1589</FlightNumber>
              </Carrier>
              <Equipment>
                <Code>330</Code>
                <Name>330</Name>
              </Equipment>
              <NumberOfStops>0</NumberOfStops>
              <Meals>S</Meals>
              <Frequency />
              <ElectronicTicketing>Y</ElectronicTicketing>
              <LegMiles />
              <Classes>
                <ClassOfService Status="S">A</ClassOfService>
                <ClassOfService Status="S">B</ClassOfService>
                <ClassOfService Status="S">E</ClassOfService>
                <ClassOfService Status="A">F</ClassOfService>
                <ClassOfService Status="S">G</ClassOfService>
                <ClassOfService Status="S">H</ClassOfService>
                <ClassOfService Status="S">K</ClassOfService>
                <ClassOfService Status="S">L</ClassOfService>
                <ClassOfService Status="S">M1</ClassOfService>
                <ClassOfService Status="S">N</ClassOfService>
                <ClassOfService Status="S">O</ClassOfService>
                <ClassOfService Status="S">Q</ClassOfService>
                <ClassOfService Status="S">S</ClassOfService>
                <ClassOfService Status="S">T</ClassOfService>
                <ClassOfService Status="A">U</ClassOfService>
                <ClassOfService Status="S">V1</ClassOfService>
                <ClassOfService Status="4">X</ClassOfService>
                <ClassOfService Status="A">Y</ClassOfService>
              </Classes>
            </Segment>
          </Flight>
          <Flight>
            <Segment>
              <Departure>
                <AirportCode>PEK</AirportCode>
                <AirportName>首都机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>22:00</Time>
                <Terminal>T3</Terminal>
              </Departure>
              <Arrival>
                <AirportCode>SHA</AirportCode>
                <AirportName>虹桥机场</AirportName>
                <Date>2014-04-25</Date>
                <Time>23:00</Time>
                <Terminal>T2</Terminal>
              </Arrival>
              <Carrier>
                <AirlineCode>CA</AirlineCode>
                <AirlineName>CA</AirlineName>
                <FlightNumber>8001</FlightNumber>
              </Carrier>
              <Equipment>
                <Code>773</Code>
                <Name>773</Name>
              </Equipment>
              <NumberOfStops>0</NumberOfStops>
              <Meals>B</Meals>
              <Frequency />
              <ElectronicTicketing>Y</ElectronicTicketing>
              <LegMiles />
              <Classes>
                <ClassOfService Status="R">A</ClassOfService>
                <ClassOfService Status="R">B</ClassOfService>
                <ClassOfService Status="R">E</ClassOfService>
                <ClassOfService Status="R">F</ClassOfService>
                <ClassOfService Status="R">G</ClassOfService>
                <ClassOfService Status="R">H</ClassOfService>
                <ClassOfService Status="R">K</ClassOfService>
                <ClassOfService Status="R">L</ClassOfService>
                <ClassOfService Status="R">M1</ClassOfService>
                <ClassOfService Status="S">N</ClassOfService>
                <ClassOfService Status="R">O</ClassOfService>
                <ClassOfService Status="R">P</ClassOfService>
                <ClassOfService Status="R">Q</ClassOfService>
                <ClassOfService Status="R">S</ClassOfService>
                <ClassOfService Status="R">T</ClassOfService>
                <ClassOfService Status="R">U</ClassOfService>
                <ClassOfService Status="R">V1</ClassOfService>
                <ClassOfService Status="R">X</ClassOfService>
                <ClassOfService Status="R">Y</ClassOfService>
              </Classes>
            </Segment>
          </Flight>
        </OriginDestination>
      </AirAvailabilityRS>
    </RES>
  </Body>
</EBUILD>


#首先我查看xml文件,看到层级是
Flight:航班信息
-Segment:航节信息
–Departure:始发站信息
—AirportCode:机场代码
—AirportName:机场名
—Date:起飞日期
—Time:起飞时刻
—Terminal:航站楼
–Arrival:到达站信息
—AirportCode:机场代码
—AirportName:机场名
—Date:到达日期
—Time:到达时刻
—Terminal:航站楼
–Carrier:承运方(飞机)信息
—AirlineCode:航空公司代码
—FlightNumber:航班号
–ElectronicTicketing:电子客票标识
那就是Flight一个独立数据,那么我们数据库的表可设计为
利用dom4j解析xml文件导入MySql
#接着就是利用io流读取xml文件,再用dom4j取xml的父节点,通过迭代遍历每个数据

package test;

import java.io.File;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;

	 
public class MySqlTest {
		public static void main(String[] args) {
		StringBuffer s=new StringBuffer();
	    s.append("INSERT into fly")
	    .append("(AirportCode,AirportName,Date,Terminal,AirportCode1,AirportName1,Date1,Terminal1,AirlineCode,FlightNumber,ElectronicTicketing)")
	    .append("VALUES(?,?,?,?,?,?,?,?,?,?,?)");
	    String sql=s.toString();
			Connection conn = null;
			PreparedStatement ps = null;
			try {
				conn = DbUtil.getConnection();
				ps = conn.prepareStatement(sql);
				//读取xml文件,按路径读取,获得document对象
				Document doc = new SAXReader().read(new File("E:/1/1.XML"));
				//选择xml文件的节点 
			
	
				//遍历读出的xml中的节点 
				Iterator iter =doc.selectNodes("//Flight/Segment").iterator();
				while (iter.hasNext()) {
				   Element element = ((Element) iter.next());//拿出第一个父标签变量Segment
				   Element Departure=element.element("Departure");
				   Element AirportCode = Departure.element("AirportCode");
				   Element AirportName = Departure.element("AirportName");
				   Element Date = Departure.element("Date");
				   Element Time = Departure.element("Time");
				   Element Terminal = Departure.element("Terminal");
			
				   Element Arrival =element.element("Arrival");
				   
				   Element AirportCode1 = Arrival.element("AirportCode");
				   Element AirportName1 = Arrival.element("AirportName");
				   Element Date1 = Arrival.element("Date");
				   Element Time1= Arrival.element("Time");
				   Element Terminal1 = Arrival.element("Terminal");
				    
				   Element Carrier = element.element("Carrier");
				   Element AirlineCode = Carrier.element("AirlineCode");
				   Element FlightNumber = Carrier.element("FlightNumber");
				
				   Element ElectronicTicketing = element.element("ElectronicTicketing");
				   int i=1;
				  ps.setString(i++, AirportCode.getText());  
	              ps.setString(i++, AirportName.getText()); 
	              Date date=String2Date(Date.getText()+" "+Time.getText());
	              Date date1=String2Date(Date1.getText()+" "+Time1.getText());
	              ps.setTimestamp(i++,utilDate2sqlTimeStamp(date)); 	              
	              ps.setString(i++, Terminal.getText());
	              ps.setString(i++, AirportCode1.getText());  
	              ps.setString(i++, AirportName1.getText());
	             
	              ps.setTimestamp(i++,utilDate2sqlTimeStamp(date1));
	             // System.out.println("关键时间"+String2Date(Date.getText()+" "+Time.getText()));
	              
	              ps.setString(i++, Terminal1.getText());
	              ps.setString(i++, AirlineCode.getText());
	              ps.setString(i++, FlightNumber.getText());
	              ps.setString(i++, ElectronicTicketing.getText());
	           
	             //System.out.println("出发时间"+AirportCode.getText()+" "+AirportName.getText()+" "+Date.getText()+" "+Time.getText()+" "+Terminal.getText()+" "+AirlineCode.getText()+" "+ElectronicTicketing.getText());
	            // System.out.println("到达时间"+AirportCode1.getText()+" "+AirportName1.getText()+" "+Date1.getText()+" "+Time1.getText());
	               ps.addBatch(); 
				}
				    
				    
				
				
				ps.executeBatch();  
	            System.out.print("将XML导入数据库成功"); 			
			} catch (Exception e) {
				e.printStackTrace();
			}finally{  
		        DbUtil.close(ps);  
		        DbUtil.close(conn);  
			}  
		}
		public static  Date String2Date(String s) { 
		SimpleDateFormat sf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
		//System.out.println("关键时间"+s);
		Date date = null;
		try {
		    date = sf.parse(s);  // Thu Jan 18 00:00:00 CST 2007
		   
		    
		} catch (ParseException e) {
		   e.getMessage();
		}
		 return date;
		 }
		private static java.sql.Timestamp utilDate2sqlTimeStamp(java.util.Date date){
			if(date==null)return null;
			return new java.sql.Timestamp(date.getTime());
		}

	}

其中用到一个工具类
数据库连接DbUtil代码:

package test;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import org.slf4j.Logger;  
import org.slf4j.LoggerFactory; 








public class DbUtil {
	
	private static Logger LOGGER = LoggerFactory.getLogger(DbUtil.class);  
	{
		try {
			Class.forName("com.mysql.cj.jdbc.Driver");	
			
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} //2获取链接
	    catch(FlyException e) {
	     
		 throw new FlyException("数据库加载异常");}
        
    }
	
	
	
	
	public static  Connection getConnection() throws SQLException, ClassNotFoundException{ 
		 String url="jdbc:mysql://127.0.0.1:3306/student?useSSL=false";
		 Connection connection=DriverManager.getConnection(url,"root","root");//建立链接 
		 
		 return connection;//代表false	
	}




	public static void close(PreparedStatement pstmt) {
		try {
			pstmt.close();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}




	public static void close(Connection conn) {
		try {
			conn.close();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
	}
}	

#然后运行MySqlTest的main方法
就可以看到数据库数据
利用dom4j解析xml文件导入MySql
添加链接描述