2011-05-11 146 views
0

我想使用HttpConnection解析XML文件,但我没有得到正确的结果。 问题是xml文件中有很多属性。 请告诉我如何解析具有SAX属性的XML文件。 在android中使用SAX的XML解析

<person> 



    <lastname>Idris</lastname> 
<information MobileNo="xyz" AccountNo ="1234"Address ="abcdef"PhoneNo="12345"/> 


    <firstname>Nazmul</firstname> 

    <company>The Bean Factory, LLC.</company> 

    <email>[email protected]</email> 



</person> 

<lastname>Idris</lastname> 
<information MobileNo="xyz" AccountNo ="1234"Address ="abcdef"PhoneNo="12345"/> 

    <firstname>Nazmul</firstname> 

    <company>The Bean Factory, LLC.</company> 

    <email>[email protected]</email> 



</person> 

+0

请勿使用SAX使用简单:https://massaioli.wordpress.com/2011/04/21/simple-xml-in-android-1-5-and-up/ – 2015-10-24 00:37:06

回答

0

在你的处理器级的,你有'的startElement() - 方法,其中有一个 'Attributes' -parameter。你可以使用'getValue()'方法从它读取属性值。