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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:47:27+00:00 2026-06-11T19:47:27+00:00

I was trying to get the XML output with some Unicode characters. I couldn’t

  • 0

I was trying to get the XML output with some Unicode characters. I couldn’t read the complete string inside the tag but just one.

here is my XML output

 <item>
    <id>1</id>    
    <name>&#x0DBD;&#x0DDC;&#x0DBD;&#x0DCA;</name>
    <cost>155</cost>
    <description>&#x0DBD;&#x0DDC;</description>
</item> 

This is my java code which I use to parse XML string.

    public Document getDomElement(String xml) {
Document doc = null;
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try {

    DocumentBuilder db = dbf.newDocumentBuilder();

    InputSource is = new InputSource();
    is.setEncoding("UTF-16");
    is.setCharacterStream(new StringReader(xml));
    doc = db.parse(is);

} catch (ParserConfigurationException e) {
    Log.e("Error: ", e.getMessage());
    return null;
} catch (SAXException e) {
    Log.e("Error: ", e.getMessage());
    return null;
} catch (IOException e) {
    Log.e("Error: ", e.getMessage());
    return null;
}
// return DOM
return doc;
}

When I use normal English characters it gives the complete string.

  • 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-06-11T19:47:28+00:00Added an answer on June 11, 2026 at 7:47 pm

    This is the code I used to solve my problem.

       NodeList idlist = doc.getElementsByTagName(KEY_ID);
        NodeList namelist = doc.getElementsByTagName(KEY_NAME);
        NodeList costlist = doc.getElementsByTagName(KEY_COST);
        NodeList desclist = doc.getElementsByTagName(KEY_DESC);
        for (int i=0; i<idlist.getLength(); i++)
        {
            Item item = new Item();
            item.setCost(costlist.item(i).getTextContent());
            item.setDescription(desclist.item(i).getTextContent());
            item.setName(namelist.item(i).getTextContent());
            itemarray.add(item);
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I am trying to get my mind around XSDs, XML and namespaces but
I'm new to powershell, but I'm trying to output some simple logging in a
I'm new to powershell, but I'm trying to output some simple logging in a
I am trying to match some XML output in a SQL Server 2008 TSQL
I'm trying to transform some XML output to a rating table (hydrology related) which
I am experimenting with to parse an XML file, and get some output in
I am currently trying to get multiple xml files into my xsl file to
I'm trying to get a result of FOR XML query as a text. I've
I am trying to get setup to use Maven and pom.xml files in Eclipse
I'm trying to get an html page to display an XML file formatted with

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.