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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:00:46+00:00 2026-06-05T12:00:46+00:00

I have an XML document, part of which has the following in it: <math

  • 0

I have an XML document, part of which has the following in it:

<math display='block'><mtext>&#x2009;</mtext></math>

If this is loaded into Qt (specifically the Qt MathML widget where I found this problem), the QDomDocument object loses the unicode thin space character (U+2009). This Python example code demonstrates the problem:

from PyQt4.QtXml import *

d = QDomDocument()
d.setContent("<math display='block'><mtext>&#x2009;</mtext></math>")
print repr(unicode(d.toString()))

The output from this code is:

u'<math display="block">\n <mtext/>\n</math>\n'

Inserting an extra non-space character after the thin space stops the thin space being lost.

Is this my mistake, an XML feature, or does Qt have a bug?

  • 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-05T12:00:48+00:00Added an answer on June 5, 2026 at 12:00 pm

    From QDomDocument’s documentation:

    Text nodes consisting only of whitespace are stripped and won’t appear
    in the QDomDocument. If this behavior is not desired, one can use the
    setContent() overload that allows a QXmlReader to be supplied.

    So this way you do not lose the white space only data (example is in C++):

    QXmlSimpleReader reader;
    QXmlInputSource source;
    QDomDocument dom;
    
    source.setData(QString("<mtext>&#x2009;</mtext>"));
    dom.setContent(&source, &reader);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an xml document which consists of a number of the following: -
I'm writing an XML document based on a stream of data. This part has
I have a XML Document (LessonData.xml) with lesson data in it, with the following
I have an XML document with a section similar to the following: <release_list> <release>
I have a questions.xml file which has a list of questions for my quiz,
I have an XML document that has a collection of objects. Each object has
I'm writing a clojure program which parses XML. As a part of this, I
Lets say I have the following XML document: <response> <businessEntity> <ABN> <identifierValue></identifierValue> <isCurrentIndicator></isCurrentIndicator> <replacedIdentifierValue
I got a XML-document with several values, this is part of it: <result> <element>
I have an xml document that goes like this: <Menu> <Category name=Comida Rapida> <Food

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.