I have like this XML in String
<?xml version='1.0' encoding='UTF-8'?><errors><error><domain>yt:quota</domain><code>too_many_recent_calls</code></error></errors>
This XML is not in file. It is in String
then how i can parse it?
Regards,
Girish
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use the SAXParser of Android to parse this String. The InputSource you need for the XMLReader of the Parser expects an input stream, so you have to convert your String into an input stream. You can use a ByteArrayInputStream for this:
See also:
How do I turn a String into a InputStreamReader in java?
http://developer.android.com/reference/javax/xml/parsers/SAXParser.html