Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6905313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:10:07+00:00 2026-05-27T08:10:07+00:00

I have an error when parsing an xml document with sax parser in android.

  • 0

I have an error when parsing an xml document with sax parser in android. Can someone help me fix this error?
The error looks like this:

org.apache.harmony.xml.ExpatParser$ParseException: At line 5, column 9: not well-formed (invalid token)

The xml document encoding is windows-1256. Here is a sample from the xml code:

<?xml version="1.0" encoding="windows-1256"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>منتديات عالم المرأة</title>
        <link>http://forum.mn66.com/</link>
        <description>مكياج,فساتين سهرة,ازياء,ملابس,العناية,بالبشرة,بالشعر,بالجسم,وظائف,تسريحات,fashion</description>
        <language>ar</language>
        <lastBuildDate>Wed, 23 Nov 2011 08:38:36 GMT</lastBuildDate>
        <generator>vBulletin</generator>
        <ttl>60</ttl>
        <image>
            <url>http://forum.mn66.com/images/Ops_fayez/misc/rss.jpg</url>
            <title>منتديات عالم المرأة</title>
            <link>http://forum.mn66.com/</link>
        </image>
        <item>
            <title>ودها تتعلم تسوق</title>
            <link>http://forum.mn66.com/t312645.html</link>
            <pubDate>Wed, 23 Nov 2011 08:31:20 GMT</pubDate>
            <description><![CDATA[‏&#8203;‏&#8203;قالت لـ زوجھا : [ علمني قيادھ السيارھ &#58974; ] !&#8233;فقال لہـا : انتـي گالملگھ . .  &#8233;والملكھ لا تقود يا حبيبتـي&#8233;فقالت لھ : حسنــاً ..&#8233;لن &#1649;قود .. لن أغسـل .. لن أطبـخ !&#8233;لن أربـي الأطفـال !&#8233;لأننـي ” ملگھ “ والملگھ لا تقوم بہذھ المہام &#8233;اضافھ الى اني احتـاج عشرات الخادمـات&#8233;حتى اتفرغ للاهتمام بـ جمالي ;;)...]]></description>
            <content:encoded><![CDATA[<div><div style="margin:auto;text-align:center;"></div><br /><div style="margin:auto;text-align:center;">ودها تتعلم تسوق<br /><br /></div><!-- google_ad_section_start -->‏&#8203;‏&#8203;قالت لـ زوجھا : [ علمني قيادھ السيارھ &#58974; ] !&#8233;فقال لہـا : انتـي گالملگھ . .  &#8233;والملكھ لا تقود يا حبيبتـي&#8233;فقالت لھ : حسنــاً ..&#8233;لن &#1649;قود .. لن أغسـل .. لن أطبـخ !&#8233;لن أربـي الأطفـال !&#8233;لأننـي ” ملگھ “ والملگھ لا تقوم بہذھ المہام &#8233;اضافھ الى اني احتـاج عشرات الخادمـات&#8233;حتى اتفرغ للاهتمام بـ جمالي ;;) &#8233;فقـال لہـا : أمزح معك فديتك =D:s&#8203;&#8203;&#8233;اضغطي الكلتش وعشقي بواحد وارفعي رجلك شوي شوي . . &#8233;&#8233;&#8233;ههههههههههههههههههههههههههههههههههههههههه<!-- google_ad_section_end --></div>



]]></content:encoded>
            <category domain="http://forum.mn66.com/f16/">نكت - jokes - ضحك و الصرقعه</category>
            <dc:creator>*ام ماهر*</dc:creator>
            <guid isPermaLink="true">http://forum.mn66.com/t312645.html</guid>
        </item>

I’ve been looking the past two days for an answer online. Any help would be greatly appreciated.

logcat:

11-29 12:48:32.649: E/AndroidRuntime(26821): FATAL EXCEPTION: main
11-29 12:48:32.649: E/AndroidRuntime(26821):
java.lang.NullPointerException 11-29 12:48:32.649:
E/AndroidRuntime(26821): at
com.lascivio.womenworld.RSSSection$EfficientAdapter.getCount(RSSSection.java:161)
11-29 12:48:32.649: E/AndroidRuntime(26821): at
android.widget.ListView.setAdapter(ListView.java:502) 11-29
12:48:32.649: E/AndroidRuntime(26821): at
com.lascivio.womenworld.RSSSection$GetData.onPostExecute(RSSSection.java:90)
11-29 12:48:32.649: E/AndroidRuntime(26821): at
com.lascivio.womenworld.RSSSection$GetData.onPostExecute(RSSSection.java:1)
11-29 12:48:32.649: E/AndroidRuntime(26821): at
android.os.AsyncTask.finish(AsyncTask.java:417) 11-29 12:48:32.649:
E/AndroidRuntime(26821): at
android.os.AsyncTask.access$300(AsyncTask.java:127) 11-29
12:48:32.649: E/AndroidRuntime(26821): at
android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
11-29 12:48:32.649: E/AndroidRuntime(26821): at
android.os.Handler.dispatchMessage(Handler.java:99) 11-29
12:48:32.649: E/AndroidRuntime(26821): at
android.os.Looper.loop(Looper.java:123) 11-29 12:48:32.649:
E/AndroidRuntime(26821): at
android.app.ActivityThread.main(ActivityThread.java:3687) 11-29
12:48:32.649: E/AndroidRuntime(26821): at
java.lang.reflect.Method.invokeNative(Native Method) 11-29
12:48:32.649: E/AndroidRuntime(26821): at
java.lang.reflect.Method.invoke(Method.java:507) 11-29 12:48:32.649:
E/AndroidRuntime(26821): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
11-29 12:48:32.649: E/AndroidRuntime(26821): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625) 11-29
12:48:32.649: E/AndroidRuntime(26821): at
dalvik.system.NativeStart.main(Native Method)

Here is the code where the parsing is happening.

private RSSFeed getFeed(String urlToRssFeed)
{
    try
    {
        // setup the url
        URL url = new URL(urlToRssFeed);

        // create the factory
        SAXParserFactory factory = SAXParserFactory.newInstance();
        // create a parser
        SAXParser parser = factory.newSAXParser();

        // create the reader (scanner)
        XMLReader xmlreader = parser.getXMLReader();
        // instantiate our handler
        RSSHandler theRssHandler = new RSSHandler();
        // assign our handler
        xmlreader.setContentHandler(theRssHandler);
        // get our data via the url class
        InputSource is = new InputSource(url.openStream());




        // perform the synchronous parse           
        xmlreader.parse(is);


        // get the results - should be a fully populated RSSFeed instance, or null on error
        return theRssHandler.getFeed();
    }
    catch (Exception ee)
    {
        // if we have a problem, simply return null
        return null;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:10:07+00:00Added an answer on May 27, 2026 at 8:10 am

    try this:

    Reader r = new InputStreamReader(url.openStream(), "windows-1256");
    InputSource is = new InputSource(r);
    xmlreader.parse(is);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting this error when parsing an incorrectly-generated XML document: org.xml.sax.SAXParseException: The value
I have an XML document with some sample content like this: <someTag> <![CDATA[Hello World]]>
I have error when I was parsing xml data. when we are converting xml
I'm downloading and parsing a XML document. During this, I want to update my
I have a problem parsing an xml, actually transforming it. The error I get
We have an error that we can't seem to find and don't have the
I have this error message: Msg 8134, Level 16, State 1, Line 1 Divide
I have this error that is keeping me from moving forward. I basically have
This time I have an error which I have been trying again to figure
I have this query and I have an error: images = Image.find_by_sql('PREPARE stmt FROM

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.