2013-10-30 55 views
0

我在從我的Blackberry本地Java應用程序調用dotnet Web服務時在inputstream中獲取XML。這個XML包含帶有一些屬性 - 值對的標籤。解析Blackberry Java應用程序中的XML輸入流

如何解析這個XML(我認爲與SAX解析器)來獲得每一件事(即標籤名稱,它們的屬性值對和所有)?

我的XML響應的InputStream:

<?xml version="1.0" encoding="utf-8"?> 
<SeatLayout> 
    <objArea colRows="Bigtree.colRows" intSeatsOrdered="0" strAreaCode="0000000003"> 
    <colRows colSeats="Bigtree.colSeats" intGridRowID="1"> 
     <colSeats Key="S1" strGridSeatNum="1" /> 
     <colSeats Key="S2" strGridSeatNum="2" /> 
    </colRows> 
    </objArea> 
    <objArea colRows="Bigtree.colRows" intSeatsOrdered="0" strAreaCode="0000000002"> 
    <colRows colSeats="Bigtree.colSeats" intGridRowID="1"> 
     <colSeats Key="S1" strGridSeatNum="1" /> 
     <colSeats Key="S2" strGridSeatNum="2" /> 
    </colRows> 
    <colRows colSeats="Bigtree.colSeats" intGridRowID="4"> 
     <colSeats Key="S1" strGridSeatNum="1" /> 
    </colRows> 
    <colRows colSeats="Bigtree.colSeats" intGridRowID="5"> 
     <colSeats Key="" strGridSeatNum="0" /> 
     <colSeats Key="S6" strGridSeatNum="6" /> 
    </colRows> 
    </objArea> 
</SeatLayout> 
+1

您可以通過查看示例[在blackberry.com上的示例](http://supportforums.blackberry.com/t5/Java-Development/Use-the-XML-Parser/ta-p/) 445210)。 – Nate

+0

請參閱http://rincethomas.blogspot.in/2012/04/xml-parsing-in-bb.html – Signare

+0

BB論壇上也有不少樣本,包括:http://supportforums.blackberry.com/t5/Java-Development/XML-parsing-using-SAX-Parser/mp/1940857#M209570和http://supportforums.blackberry.com/t5/Java-Development/Xml-parsing-using-sax-parser/mp/ 1651051#M195583 –

回答