2013-06-27 42 views

回答

0

因爲XML文件是大不如說使用SAX解析器。對於從SAX解析器使用你應該使用DeafaultHandler類並重寫它的方法和在其startElement方法中,您應該爲獲取值編寫以下相同的東西:

public void startElement(String arg0, String localName, String arg2, 
     Attributes attributes) throws SAXException { 
    currentElement = true; 

if (localName.equals("marker")) { 

     String currency = attributes.getValue("currency "); 

     String rat= attributes.getValue("rat"); 



     //and ... 

    } 
} 

    }