Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: XML InputSource class and the retrieval/browser type

  1. #1
    Junior Member
    Join Date
    Dec 2010
    Thanked 0 Times in 0 Posts

    Default XML InputSource class and the retrieval/browser type

    Hi all,
    I hope this is the right forum subsection..
    I'm trying to make an application which gets data in the form of XML using a URL but I don't think I'm getting the right data that I'm expecting returned to me.
    The thing is, when I "view source" for the URL (which has search parameters encoded into it), using Firefox I get xml and using Chrome, I get something completely different so how can I choose which I want to use?

    I'm currently using the InputSource class in org.xml.sax to access the URL but I think I'll probably have to use another class as well to achieve what I want if it's even possible.

    Sorry if anything I've said doesn't make sense,

    I appreciate any help, thanks

  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    United Kingdom
    My Mood
    Thanked 294 Times in 227 Posts
    Blog Entries

    Default Re: XML InputSource class and the retrieval/browser type

    Hello dave0110, welcome to the forums.

    What URL are you attempting to get the XML from?
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  3. The Following User Says Thank You to JavaPF For This Useful Post:

    dave0110 (December 3rd, 2010)

  4. #3
    Junior Member
    Join Date
    Dec 2010
    Thanked 0 Times in 0 Posts

    Default Re: XML InputSource class and the retrieval/browser type



    So that I don't waste any more of your time, I thought I'd just change this so that you know using another forum, I was able to find my answer, (for anyone else looking to do something similar) I'll use the resource here:
    How to use java.net.URLConnection to fire and handle HTTP requests? - Stack Overflow
    and instead of using an InputSource object as a parameter of the SAXParsers .parse() method, I'll use an InputStream which is returned from URLConnection.

    Thank you for your time

    Edit: Actually, another resource I was shown off these very same forums (and written by JavaPF too!) which I think is much much cleaner for me to use than create myself is probably what I will end up using:
    http://www.javaprogrammingforums.com...bsite-url.html - and instead of using the System.outs, just directly use that InputStream for the .parse() method instead of an InputSource. Sorry if all of this is terribly basic and obvious!
    Last edited by dave0110; December 3rd, 2010 at 10:18 AM.

Similar Threads

  1. Xml-Node Retrieval
    By prasb in forum File I/O & Other I/O Streams
    Replies: 0
    Last Post: December 4th, 2009, 12:44 PM
  2. how to load a class and type cast to that class?
    By chinni in forum Object Oriented Programming
    Replies: 2
    Last Post: November 9th, 2009, 10:18 AM
  3. how to get url, from browser in the socket class?
    By chinni in forum Java Networking
    Replies: 0
    Last Post: November 6th, 2009, 10:34 AM
  4. Replies: 2
    Last Post: November 5th, 2009, 10:15 PM
  5. MP3 Player: ID3 Tag Image Retrieval Problem for the Applet from internet
    By JavaJames in forum What's Wrong With My Code?
    Replies: 5
    Last Post: May 20th, 2009, 07:11 AM