Parsing xml

General topics about the Android-Platform itself.
Coding issues please to the subforum right below.

Parsing xml

Postby gsmith53 » Mon Dec 17, 2007 10:36 pm

Looking to receive an xml stream in an SMS message. I know how to use xerces to parse xml streams. How do I get xerces into my app activity? Or is there a smaller parser that is available in android already. I couldn't find one.
gsmith53
Freshman
Freshman
 
Posts: 9
Joined: Sat Dec 01, 2007 5:40 am
Location: Dallas, TX

Top

Postby plusminus » Mon Dec 17, 2007 11:13 pm

Hello gsmith53,

you want to read xml-code from out of a SMS :?:
Are 160 7-bit-'chars' enough ?

I would suggest choosing a less data-expensive format :!:

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby TokenUser » Mon Dec 17, 2007 11:34 pm

XML in an SMS stream? Hope its short.

Perhaps a better approach might be capturing the SMS, reading it (using a bar delimited string in a set format to save space), and using its contents to request a standard HTTP POST/GET type data stream from an existing server using a unique request code from the SMS message.

Just be careful on your SMS handling. If the content is not intended for your app, then it needs to be handed off to an appropriate SMS app/handler.
TokenUser
Freshman
Freshman
 
Posts: 5
Joined: Thu Dec 13, 2007 3:02 pm
Location: Lost in States [NC, USA]

Postby kiran » Fri Mar 14, 2008 9:38 am

request a standard HTTP POST/GET type data stream from an existing server
How do you perform parsing on XML data obtained as a stream in response to a HTTP POST request. I need to parse some XML data that i get as the response from an HTTP POST.

Thanks in advance
:) smile it is the key that fits the lock of everybody's heart
User avatar
kiran
Experienced Developer
Experienced Developer
 
Posts: 78
Joined: Thu Nov 22, 2007 11:36 am
Location: India

Postby Jesmiatka » Fri Mar 14, 2008 12:54 pm

Hi,

this works for me :roll:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. myContentHandler myContentHandler = new myContentHandler ();
  3.  
  4.  
  5.  
  6. try{
  7.  
  8. SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
  9.  
  10. parser.parse(postMethod.getResponseBodyAsStream(), myContentHandler);
  11.  
  12. }
  13.  
  14. catch(Exception e)
  15.  
  16. {
  17.  
  18. }
  19.  
  20.  
Parsed in 0.058 seconds, using GeSHi 1.0.8.4
Jesmiatka
Senior Developer
Senior Developer
 
Posts: 164
Joined: Mon Feb 04, 2008 3:37 pm
Location: Netherlands

Top

Return to General

Who is online

Users browsing this forum: No registered users and 2 guests