日期:2014-05-19  浏览次数:20705 次

请问Java解析服务器端的XML文件时遇到的问题??
<?xml version="1.0" encoding="GB2312" ?> 
<OTResponse>
  <ErrorInfo>
  <Code>20000</Code> 
  <Description /> 
  </ErrorInfo>
  <TransactionName /> 
  <PropertyList>
  <PropertyLineItem>
  <PropertyID>BZ2FJ</PropertyID> 
  <Address>北京 东城区 建国门内大街9号</Address> 
  <Promotion>110</Promotion> 
  <Currency>CNY</Currency> 
  <CityCode>PEK</CityCode> 
  <Rank>5</Rank> 
  <Name>北京国际饭店</Name> 
  <SplID>1E</SplID> 
  <SplName>中国航信</SplName> 
  <HotelFeatures>
  <BasicInfo>北京国际饭店位于首都长安街中心繁华地段。</BasicInfo> 
  <TrafficInfo>距离市中心(公里</TrafficInfo> 
  </HotelFeatures>
  <RoomRateDetail>
  <RoomType>DB001</RoomType> 
  <RoomName>商务豪华间</RoomName> 
  <Description>加床25美金+15%</Description> 
  <DisplayRate>2330.0</DisplayRate> 
  <SaleRate>980.0</SaleRate> 
  <Availability>0</Availability> 
  <RateChanged>N</RateChanged> 
  <PaymentType>T</PaymentType> 
  <MealPlan>0</MealPlan> 
  <PassengerType>A</PassengerType> 
  <Guarantee /> 
  </RoomRateDetail>
 
  <RoomRateDetail>
  <RoomType>DB003</RoomType> 
  <RoomName>商务间(外宾)</RoomName> 
  <Description>H</Description> 
  <DisplayRate>2160.0</DisplayRate> 
  <SaleRate>758.0</SaleRate> 
  <Availability>0</Availability> 
  <RateChanged>N</RateChanged> 
  <PaymentType>T</PaymentType> 
  <MealPlan>0</MealPlan> 
  <PassengerType>F</PassengerType> 
  <Guarantee /> 
  </RoomRateDetail>

  </PropertyLineItem>
  </PropertyList>
 </OTResponse>


哪位高手能把上边的XML文件用JDOM简单解析一下.....
另外当碰到双标签例如:<Description>H</Description>
和单标签时例如:<Description/>时怎么解决
谢谢大家了!!!!!


------解决方案--------------------
jdom和dom4j都可以的,楼主说的两种情况对它们来说是无区别的
------解决方案--------------------
up