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

  • Home
  • SEARCH
  • 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 46263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T15:56:19+00:00 2026-05-10T15:56:19+00:00

In my environment here I use Java to serialize the result set to XML.

  • 0

In my environment here I use Java to serialize the result set to XML. It happens basically like this:

//foreach column of each row xmlHandler.startElement(uri, lname, 'column', attributes); String chars = rs.getString(i); xmlHandler.characters(chars.toCharArray(), 0, chars.length()); xmlHandler.endElement(uri, lname, 'column'); 

The XML looks like this in Firefox:

<row num='69004'>     <column num='1'>10069</column>     <column num='2'>sd&#26;</column>     <column num='3'>FCVolume                      </column> </row> 

But when I parse the XML I get the a

org.xml.sax.SAXParseException: Character reference ‘&#26‘ is an invalid XML character.

My question now is: Which charactes do I have to replace or how do I have to encode my characters, that they will be valid XML?

  • 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. 2026-05-10T15:56:19+00:00Added an answer on May 10, 2026 at 3:56 pm

    I found an interesting list in the Xml Spec: According to that List its discouraged to use the Character #26 (Hex: #x1A).

    The characters defined in the following ranges are also discouraged. They are either control characters or permanently undefined Unicode characters

    See the complete ranges.

    This code replaces all non-valid Xml Utf8 from a String:

    public String stripNonValidXMLCharacters(String in) {     StringBuffer out = new StringBuffer(); // Used to hold the output.     char current; // Used to reference the current character.      if (in == null || (''.equals(in))) return ''; // vacancy test.     for (int i = 0; i < in.length(); i++) {         current = in.charAt(i);         if ((current == 0x9) ||             (current == 0xA) ||             (current == 0xD) ||             ((current >= 0x20) && (current <= 0xD7FF)) ||             ((current >= 0xE000) && (current <= 0xFFFD)) ||             ((current >= 0x10000) && (current <= 0x10FFFF)))             out.append(current);     }     return out.toString(); }     

    its taken from Invalid XML Characters: when valid UTF8 does not mean valid XML

    But with that I had the still UTF-8 compatility issue:

    org.xml.sax.SAXParseException: Invalid byte 1 of 1-byte UTF-8 sequence 

    After reading XML – returning XML as UTF-8 from a servlet I just tried out what happens if I set the Contenttype like this:

    response.setContentType('text/xml;charset=utf-8'); 

    And it worked ….

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

Sidebar

Ask A Question

Stats

  • Questions 104k
  • Answers 104k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer To answer that question, I'd like to describe member's accessors… May 11, 2026 at 8:37 pm
  • Editorial Team
    Editorial Team added an answer You can check AC_TRY_COMPILE with something like that: LIBNAME=boost_date_time AC_MSG_CHECKING([for… May 11, 2026 at 8:37 pm
  • Editorial Team
    Editorial Team added an answer You might try CGLayer or CALayer. May 11, 2026 at 8:37 pm

Related Questions

This is a followup question of How to encode characters from Oracle to Xml?
I'm looking for recommendations of a good, free tool for generating sample data for
I'm familiar with the LAMP stack and over the years have successfully deployed a
I am trying to get my development environment up and running, and I am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.