Parse XML String to Sax parser android
<p>I have a string containing an xml file data</p>

<p>such as</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;data&gt;

&lt;type&gt;
&lt;lory&gt;vroom&lt;/lory&gt;
&lt;car&gt;crack&lt;/car&gt;
&lt;/type&gt;

&lt;type&gt;
&lt;lory&gt;doom&lt;/lory&gt;
&lt;car&gt;chack&lt;/car&gt;
&lt;/type&gt;

&lt;/data&gt;
</code></pre>

<p>this is kept in a String named label;</p>

<p>I use sax parser to retrieve the data as follows </p>

<pre><code>SAXHelper sh = null;

            try {
                sh = new SAXHelper(newxml);
            } catch (MalformedURLException e) {
                e.printStackTrace();
            }

            sh.parseContent("");
</code></pre>

<p>Part of saxhelper class</p>

<pre><code>class SAXHelper {


        public HashMap&lt;String, String&gt; userList = new HashMap&lt;String, String&gt;();
        private String data;

        public SAXHelper(String url1) throws MalformedURLException {
            this.data = new String(url1);
        }

        public RSSHandler parseContent(String parseContent) {
            RSSHandler df = new RSSHandler();
            try {

                SAXParserFactory spf = SAXParserFactory.newInstance();
                SAXParser sp = spf.newSAXParser();
                XMLReader xr = sp.getXMLReader();
                xr.setContentHandler(df);
                xr.parse(data);

            } catch (Exception e) {
                e.printStackTrace();
            }
            return df;
        }
    }
</code></pre>

<p>but i end with this error showing malformation error. for short i want to pass a xml string to a sax parser to set and get the result.</p>

<pre><code>04-05 11:25:18.390: W/System.err(2646):     at org.apache.harmony.xml.ExpatParser.openUrl(ExpatParser.java:760)
04-05 11:25:18.398: W/System.err(2646):     at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:289)
04-05 11:25:18.398: W/System.err(2646):     at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:322)
04-05 11:25:18.398: W/System.err(2646):     at .CompteDetails$SAXHelper.parseContent(CompteDetails.java:228)
04-05 11:25:18.398: W/System.err(2646):     at .CompteDetails$loadingTask.doInBackground(CompteDetails.java:202)
04-05 11:25:18.398: W/System.err(2646):     at .details.CompteDetails$loadingTask.doInBackground(CompteDetails.java:1)
04-05 11:25:18.398: W/System.err(2646):     at android.os.AsyncTask$2.call(AsyncTask.java:185)
04-05 11:25:18.398: W/System.err(2646):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
04-05 11:25:18.398: W/System.err(2646):     at java.util.concurrent.FutureTask.run(FutureTask.java:138)
04-05 11:25:18.398: W/System.err(2646):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
04-05 11:25:18.398: W/System.err(2646):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
04-05 11:25:18.398: W/System.err(2646):     at java.lang.Thread.run(Thread.java:1019)
04-05 11:25:18.402: W/System.err(2646): Caused by: java.net.MalformedURLException: Protocol not found: &lt;?xml version="1.0" encoding="UTF-8"?&gt;..
</code></pre>
