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 3432968
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:30:57+00:00 2026-05-18T07:30:57+00:00

I am working on an Android application that parses one or more XML feeds

  • 0

I am working on an Android application that parses one or more XML feeds based on user preferences. Is it possible to parse (using SAX Parser) more than one XML feed at once by providing the parser with an array of URLs of my XML feeds?

If no, what would be an alternative way of listing the parsed items from different XML feeds in one list? An intuitive approach is to use java.io.SequenceInputStream to merge the two input streams. However, this throws a NullPointerException:

try {
  URL urlOne = new URL("http://example.com/feedone.xml");
  URL urlTwo = new URL("http://example.com/feedtwo.xml");
  InputStream streamOne = urlOne.openStream();
  InputStream streamTwo = urlTwo.openStream();
  InputStream streamBoth = new SequenceInputStream(streamOne, streamTwo);
  InputSource sourceBoth = new InputSource(streamBoth);
  //Parsing
  stream = xmlHandler.getStream();
  }
catch (Exception error) {
  error.printStackTrace();
}
List<Item> content = stream.getList();
return content;
  • 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-18T07:30:57+00:00Added an answer on May 18, 2026 at 7:30 am

    The tactic of appending the streams before parsing is not likely to work well, as the appended XML will not be valid XML. As each XML input has its own root element, the appended XML will have multiple roots, which is not permitted in XML. Additionally it’s likely to have multiple XML headers like

    <?xml version="1.0" encoding="UTF-8"?>
    

    which is also invalid.

    While it’s possible to preprocess the input to work around these issues, you’re likely better off parsing them separately and dealing with getting the results combined later.

    It’s possible to make a SAX parser add the parsed elements to an existing list of elements. If you post code in your question showing how you’re parsing a single file, we might be able to help figure out how to adjust it to your need for multiple inputs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on an Android application that shows a map with the user's
I have an Android application that I've been working on, and it's implemented using
I am working on Android application that parses a website but I can't seem
I am working on an android application that determines user location in osm maps.
I'm working on a Android application that involves a lot of XML layout files.
I'm working on an Android application that will send MMS internally without using the
I am working on an Android application that requires a user to login before
I'm working on a android application that adds every view programmaticaly. When the user
I am working on an Android application that allows the user to speak into
I am working on an Android application that needs to determine the current tee

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.