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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:35:18+00:00 2026-05-26T15:35:18+00:00

I am using JSOUP (java tool for XML files) and I am using following

  • 0

I am using JSOUP (java tool for XML files) and I am using following code to read an URL that is saved in a XML file. here are my codes:

Document d = Jsoup.parse(new File("feed.xml"), null);
Element elementCat = d.getElementsByTag("cat").get(0);
String stringUrl = elementCat.ownText();
System.out.println(stringUrl);

the XML input file is like this:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<root>
<cat>http://www.isna.ir/ISNA/FullNews.aspx?SrvID=Event&Lang=P</cat>
</root>

my problem is that the output of program is this:
http://www.isna.ir/ISNA/FullNews.aspx?SrvID=Event⟪=P
instead of this:
http://www.isna.ir/ISNA/FullNews.aspx?SrvID=Event&Lang=P

In other words, it converts “&Lang” to “⟪” automatically.
Please pay attention that it is not “⟪”, it’s just “&Lang” without semicolon.
I want to disable encoding or escaping and I want the raw data.

How can I solve this problem?

  • 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-26T15:35:18+00:00Added an answer on May 26, 2026 at 3:35 pm

    You’ve got a piece of XML. In XML, there’s a manner of escaping markup, since sometimes you just need a piece of text containing < or an attribute with " in its value. Escaping is done using a character entity reference, which starts with an ampersand, followed by a code, followed by a semi-colon. Like so: &lt;. That can represent <.

    Of course, that leaves us with the problem of the ampsersand itself. If it’s actually an ampersand you need, rather than some different character entity, you’ll have to encode it thus: &amp;.

    What you’ve got there is XML that isn’t well-formed. The & indicates you’re starting a character entity reference, but then it gets Lang. Now, maybe jsoup doesn’t make much of a problem of this. But that’s because it’s for HTML parsing and not XML. Since HTML is a bit more lenient than XML, I suppose jsoup simply subtitutes what it takes to be an unknown character reference with something else. Likely a nul character.

    So make sure the XML is well-formed. If that can’t be done, don’t treat it as XML but as HTML. If XML processing is what you’re after, look into SAX, StAX, DOM or JAXB.

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

Sidebar

Related Questions

Using the guide on JSoup's website I wrote the following code: @Override public void
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
how can i parse only text from a web page using jsoup using java?
I am using a HTML parser called Jsoup, to load and parse HTML files.
i am using java with jsoup to parse a website, trouble is , alot
I'm using JSoup in an attempt to built valid XML from a couple of
hi all i am using jsoup in a java-ee app to parse html i
I wrote a Java scheduler, every hour using: new SAXBuilder().build(new URL(xxx)); or HttpConnection.connect(new URL(xxx));
I am using Jsoup to extract URL of an webpage. The href attribute of
I am trying to pick, using Jsoup, the paragraph inside the following HTML snippet:

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.