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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:03:03+00:00 2026-05-28T05:03:03+00:00

I’m using JAXB to generate XML that is uploaded to our Google feed. While

  • 0

I’m using JAXB to generate XML that is uploaded to our Google feed. While testing and comparing this new method’s output to the output from the old way that we were doing it (Using JSPs), I noticed that single quote characters aren’t being handled correctly.

Field Content:

& ' " > <

Old Correct output:

<title> &amp; &#39; &quot; &gt; &lt; </title>

New Incorrect output:

<title> &amp; ' &quot; &gt; &lt; </title>

I tried replacing all single quote characters in the field with

&#39

before I marshall the XML, but this ends up replacing the ampersand with its character code as well as leaving me with a useless #39 sitting there after marshalling.

At which point should I try to remedy this problem? Can I get the correct behavior by altering the string in some way before passing it into the JAXB class, or is there something I must do to change how the marshalling handles single quotes?

Thanks for reading!

EDIT:
Sorry I wasn’t more clear before, Google’s documentation requires that those 5 characters are represented either by their Entity or Character Codes.

From their documentation:

Data values that are not in CDATA sections, including URLs, must use escape codes for the characters listed in the
following table. You can use either the entity code or the character code to represent these special characters.

Ampersand & &amp; &#38;
Single Quote ' &apos; &#39;
Double Quote " &quot; &#34;
Greater Than > &gt; &#62;
Less Than < &lt; &#60;

I would like to avoid the CDATA route if possible.

  • 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-28T05:03:03+00:00Added an answer on May 28, 2026 at 5:03 am

    Single quotes don’t have to be escaped. The second output is correct with regards to XML format and more concise, which is even better.

    If you want fine-grained control over which characters are escaped (and how), you might try to implement your own CharacterEscapeHandle. Never tried it, but it is documented as a feature of JSXB RI.

    See also:

    • StAX XML Parser not escaping single quote (&apos;)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
this is what i have right now Drawing an RSS feed into the php,
We're building an app, our first using Rails 3, and we're having to build
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm making a simple page using Google Maps API 3. My first. One marker
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.