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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:47:26+00:00 2026-06-13T09:47:26+00:00

So I found the ‘pretty printing’ trimming white space flag referenced here: boost::property_tree XML

  • 0

So I found the ‘pretty printing’ trimming white space flag referenced here: boost::property_tree XML pretty printing

And I found the documentation for Boost::Property_Tree 1.50’s read_xml() function:
http://www.boost.org/doc/libs/1_50_0/doc/html/boost/property_tree/xml_parser/read_xml_id1073248.html

But I can’t for the life of me figure out how to enable both the ignore comments and the trim whitespace flags when reading, then writing the XML! Any help would be appreciated.

I think my main issue is with the function prototype. How do the flags used translate to ints, like the function prototype seems to ask for?

  • 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-13T09:47:28+00:00Added an answer on June 13, 2026 at 9:47 am

    You have to connect the flags together with a bitwise OR (the vertical bar character |). It’s a fairly common way to specify multiple flags using a single argument. For example:

    #include <boost/property_tree/ptree.hpp>
    #include <boost/property_tree/xml_parser.hpp>
    
    int main(int argc, char* argv[])
    {
        ptree pt;
        using namespace boost::property_tree::xml_parser; // just to keep the flags nice and short
    
        read_xml("file.xml", pt, trim_whitespace | no_comments);
        return 0;
    }    
    

    As for your second question, the flags are declared as ints. When you do a bitwise or, the bits that represent the ints are combined to make a new int with a unique value. For example, the number 2 has a bit (binary) representation 00000010, and the number 4 has a bitwise representation 00000100 (assuming you’re using 8 bits to represent an integer). The bitwise or operation compares each bit, and if either is 1 or both are 1, the result is 1. Otherwise it’s zero. In our case:

      00000010
    | 00000100
    ----------
      00000110
    

    which is the number 6 in bit notation.

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

Sidebar

Related Questions

Found this while reading the Neo4j manual, specifically here , I found the sentence:
found the following xsl/xml question need assistance in answering it.take it as a challenge.
found this puzzle HERE ... I made a brute force solution and I would
Found a similar post here but I am running a Mac so the first
Found the answer here (last post): http://social.msdn.microsoft.com/Forums/eu/wcf/thread/f5c0ea22-1d45-484e-b2c0-e3bc9de20915 I'm having one last issue with the
Found a great snippet on here , so fiddled with it and it does
Found this one http://www.kite9.com/content/adl-new-visual-language-part-2 (presentation here http://www.kite9.com/content/muddle-uml ) not cheap :( Any others that
Found the same question here.. I am trying to use the code but for
I found this problem mentioned before here jQuery/Javascript to replace broken images and this
Found this here http://sla.ckers.org/forum/read.php?2,15812,page=2 If you copy the title of the question and run

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.