Opened 9 years ago

Closed 8 years ago

#9448 closed Bugs (duplicate)

Invalid XML produced when key contains '/'

Reported by: smr@… Owned by: Sebastian Redl
Milestone: To Be Determined Component: property_tree
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc:

Description

boost ptree creates invalid XML when key contains a '/'.

Steps:

$ cat pt.cxx
#include <boost/property_tree/xml_parser.hpp>
#include <fstream>

int main()
{
  using boost::property_tree::ptree;
  ptree pt;
  pt.put("MY/KEY", 42 );

  std::ofstream os( "invalid.xml" );
  boost::property_tree::write_xml(os, pt);
  os.close();

  return 0;
}

$ g++ pt.cxx && ./a.out
$ cat invalid.xml
<?xml version="1.0" encoding="utf-8"?>
<MY/KEY>42</MY/KEY>%
$ xmllint --format invalid.xml
invalid.xml:2: parser error : error parsing attribute name
<MY/KEY>42</MY/KEY>
   ^
invalid.xml:2: parser error : attributes construct error
<MY/KEY>42</MY/KEY>
   ^
invalid.xml:2: parser error : Couldn't find end of Start Tag MY line 2
<MY/KEY>42</MY/KEY>
   ^
invalid.xml:2: parser error : Extra content at the end of the document
<MY/KEY>42</MY/KEY>
   ^

Reported as Debian bug #729579

Change History (1)

comment:1 by Sebastian Redl, 8 years ago

Resolution: duplicate
Status: newclosed

Duplicate of bug 8095.

Note: See TracTickets for help on using tickets.