设法让文件变得规范啊:
给它加个根元素,还有<!--            ----------------------          -->这样的注释也是不规范的。

解决方案 »

  1.   

    如果不规范,是不是就不能用DOM来读取?
      

  2.   

    The XML is not bad :)
    If you can give me the DTD or shema, it will be very helpful to solve the problem. Two approaches towards the data you need:1. Use DOM and hard code your qualification into Java code. 
    2. Use XPath to retrieve the qualified data.imo, the second may be the better. Just according to the XML snippet you posted, the XPath expression that matchs your demand is:/ROOT/List[Name='FSMount']/List[Name='myrmdesc']/Var/@MountPointNote that in the expression ROOT is only a placeholder which indicates the root element in your XML file, which you didn't post now. There are still something else to retrieve the data you want, but the XPath expression is the key step. More things will be left to you. Don't claim that you know nothing about XML:)
      

  3.   

    同意   patrickwang 的做法!!
      

  4.   

    /ROOT/List[Name='FSMount']/List[Name='myrmdesc']/Var/@MountPoint
      

  5.   

    /ROOT/List[Name='FSMount']/List[Name='myrmdesc']/Var/@MountPoint
      

  6.   

    patrickwang() :你那Root哪来的?
    没有根节点,怎样用DOM来解析?