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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:09:35+00:00 2026-05-16T11:09:35+00:00

i use follows code to get a XML Document (by JDOM in java): SAXBuilder

  • 0

i use follows code to get a XML Document (by JDOM in java):

SAXBuilder builder = new SAXBuilder();
Document doc= builder.build(new URL("http://www.sasatuan.com/api/api.php"));

and i get a Exception:

org.jdom.input.JDOMParseException: Error in building:
 http://www.sasatuan.com/api/api.php:1: <?xml ... ?> occurs after content.  The
<?xml ... ?> prolog must be at the document start.: http://www.sasatuan.com/api/
api.php:1: <?xml ... ?> occurs after content.  The <?xml ... ?> prolog must be a
t the document start.
        at org.jdom.input.SAXBuilder.build(SAXBuilder.java:473)
        ...

i type this URL http://www.sasatuan.com/api/api.php in IE,it’s be ok,but in firefox or chrome,it’s same error.

this xml header not at the document start,so jdom can’t read it.

i think trim() the xml content before build can revise this problem, i want know how to do this.

thanks for help 🙂

  • 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-16T11:09:35+00:00Added an answer on May 16, 2026 at 11:09 am

    Do you have other XML files which are similarly broken that you need to read? If not, I would personally try to get in touch with the owner of the website. That XML is simply invalid – and it would probably be an easy job to fix it, which would help everyone rather than just you.

    If that doesn’t appeal, it would probably be easiest to download the content as a string, trim it in memory, and then load it. You could mess around trying to skip the relevant bits of the input stream, but that’s more likely to be fiddly.

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

Sidebar

Related Questions

I need to build some client side code which follows this use case: An
As for me, what I use is as follows recently yasnippets -- http://code.google.com/p/yasnippet/ If
When I attempt to use SWI-Prolog's http_post/4 , as follows: :- use_module(library(http/http_client). update(URL, Arg)
I'm trying to use Nokogiri::XML::Builder.new to create a structure whose root element is called
All the code examples always use base() as follows class A { public A()
I am new developer in java application. I would like to modify an XML
I'm trying to get a collection of values from an XML document: <root> <string
I have got my main.xml as follows: <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:orientation=vertical android:layout_width=fill_parent
I am trying to use JDOM to load the source code of a remote
My config.ru is as follows: use Rack::Static, :urls => [/images], :root => public run

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.