日期:2014-05-20  浏览次数:20744 次

XML 的问题
我有一个XML   的文件当我用JAVA   SAX   把它的资料拿出的时候遇到 <MANAGER/> 这个是代表什么意思呢?我应该怎么把是不是MANAGER这个元素拿出来呢   拿出来呢?
--------------------------
xml   文件
<?xml   version   = "1.0 "   standalone   =   "yes "?>
<!DOCTYPE   COMPANY   [
<!ELEMENT   COMPANY   (DEPARTMENT+)>
<!ELEMENT   DEPARTMENT   (STAFFLIST)>
<!ATTLIST   DEPARTMENT  
NAME   CDATA   #REQUIRED
>
<!ELEMENT   STAFFLIST   (FULLTIMESTAFF|PARTTIMESTAFF)+>
<!ELEMENT   FULLTIMESTAFF   (NAME,   ID,   SALARY,   MANAGER?)>
<!ELEMENT   PARTTIMESTAFF   (NAME,   ID,   HOURLYSALARY)>
<!ELEMENT   SALARY   (#PCDATA)>
<!ELEMENT   ID   (#PCDATA)>
<!ELEMENT   NAME   (#PCDATA)>
<!ELEMENT   MANAGER   EMPTY>
<!ELEMENT   HOURLYSALARY   (#PCDATA)>
]>
<COMPANY>
<DEPARTMENT   NAME   =   "Product   Development ">
<STAFFLIST>
<FULLTIMESTAFF>
<NAME>   John   Tan   Seng   Huat </NAME>
<ID>   S6512345J   </ID>
<SALARY> 4500.00 </SALARY>
<MANAGER/>
</FULLTIMESTAFF>
<FULLTIMESTAFF   >
<NAME>   Peter   Chua   Sim   Lai </NAME>
<ID>   S6934345C   </ID>
<SALARY> 2800.00 </SALARY>
</FULLTIMESTAFF>
<PARTTIMESTAFF>
<NAME>   Cindy   Lam   Lian   Choo </NAME>
<ID>   S6734322K   </ID>
<HOURLYSALARY> 35.00 </HOURLYSALARY>
</PARTTIMESTAFF>
<FULLTIMESTAFF   >
<NAME>   Anisah   Bte   Ismail   </NAME>
<ID>   S6922339B   </ID>
<SALARY> 3100.00 </SALARY>
</FULLTIMESTAFF>
</STAFFLIST>
</DEPARTMENT>
<DEPARTMENT   NAME   =   "Customer   Service ">
<STAFFLIST>
<FULLTIMESTAFF>
<NAME>   Noor   Ali   Bin   Mohamed   </NAME>
<ID>   S6412388J   </ID>
<SALARY> 4200.00 </SALARY>
<MANAGER/>
</FULLTIMESTAFF>
<FULLTIMESTAFF>
<NAME>   Hanisah   Bte   Salleh   </NAME>
<ID>   S6934311F   </ID>
<SALARY> 1800.00 </SALARY>
</FULLTIMESTAFF>
</STAFFLIST>
</DEPARTMENT>
<DEPARTMENT   NAME   =   "Sales   and   Publicity ">
<STAFFLIST>
<FULLTIMESTAFF>
<NAME>   Linda   Peh   Xue   Li </NAME>
<ID>   S6423451J   </ID>
<SALARY> 3500.00 </SALARY>
<MANAGER/>
</FULLTIMESTAFF>
<FULLTIMESTAFF>
<NAME>   Thomas   Lye   Meng   Poh </NAME>
<ID>   S7234344F   </ID>
<SALARY> 1800.00 </SALARY>
</FULLTIMESTAFF>
<PARTTIMESTAFF>
<NAME>   Eugene   Oliver   John </NAME>
<ID>   S7533213F   </ID>
<HOURLYSALARY> 12.00 </HOURLYSALARY>
</PARTTIMESTAFF>