Re: [Boost-bugs] [Boost C++ Libraries] #5210: JSON writer does not allow attributes and children in the same node

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5210: JSON writer does not allow attributes and children in the same node
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-05-18 15:34:07


#5210: JSON writer does not allow attributes and children in the same node
------------------------------------------------------------+---------------
  Reporter: Christian Ceelen <christian.ceelen@…> | Owner: cornedbee
      Type: Bugs | Status: reopened
 Milestone: To Be Determined | Component: property_tree
   Version: Boost 1.46.0 | Severity: Problem
Resolution: | Keywords:
------------------------------------------------------------+---------------
Changes (by Christian Ceelen <christian.ceelen@…>):

  * status: closed => reopened
  * resolution: invalid =>

Comment:

 Thanks. I see this check is mandatory.
 I was poking into this function only for the sole reason that the error
 indicated it while i was playing a simple XML to JSON conversion. For
 instance:
 {{{
 <object>
         <type>Shop</type>
         <POC>
                 <name>Private Investigation</name>
                 <street>221B Baker Street</street>
                 <town>London</town>
                 <zip>NW1 6XE</zip>
                 <country>United Kingdom</country>
         </POC>
         <workingDays>
             <Monday/>
             <Saturday/>
             <Sunday/>
         </workingDays>
 </object>
 }}}
 This simple XML file is read in without any trouble. But if i walk through
 the resulting ptree and print all key and value contents, then it looks
 like this:
 {{{
 object: "



 "
     type: "Private Investigation"
     POC: "





         "
         name: "Cabbies United"
         street: "221B Baker Street"
         town: "London"
         zip: "NW1 6XE"
         country: "United Kingdom"
     workingDays: "



         "
         Monday: ""
         Saturday: ""
         Sunday: ""
 }}}
 The attempt to serialize in JSON this ptree fails, because of the empty
 strings stored in the value fields of the keys object, POC, and
 workingDays. As the original XML has no attributes for these tags i am
 quite puzzled where these are coming from.

 See the attached files for the small test i wrote. This fails for version
 1.46.0 and 1.46.1.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5210#comment:2>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:06 UTC