Opened 12 years ago
Closed 11 years ago
#5413 closed Bugs (duplicate)
(read_xml + write_xml) do not restitute escape sequences in tag's attribute stri
| Reported by: | Owned by: | Sebastian Redl | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | property_tree | 
| Version: | Boost 1.47.0 | Severity: | Problem | 
| Keywords: | Cc: | 
Description
Description
Use the following program to read/write to/from a ptree an XML file containing XML escape sequences in tag's attribute string.
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
using boost::property_tree::ptree;
int main()
{
  ptree pt;
  read_xml("xml-esc-in.xml", pt);
  write_xml("xml-esc-out.xml", pt);
  return 0;
}
- With the following XML input file
 
xml-esc-in.xml
<?xml version="1.0" encoding="UTF-8"?> <html> <head> <title>Title</title> <link title="<>"'&" href="" /> </head> <body> <p> <>"'& </p> </body> </html>
- It will give you the following XML output file
 
xml-esc-out.xml
<?xml version="1.0" encoding="utf-8"?>
<html>
  <head>
    <title>Title</title>
    <link title="<>"'&" href=""/>
  </head>
  <body>
    <p>
      <>"'&
    </p>
  </body>
</html>
- Escape sequences in the [title] attribute of the <link> tag have been translated into their ascii equivalent resulting in an invalid XML.
 
Attachments (3)
Change History (5)
by , 12 years ago
| Attachment: | write-xml.cpp added | 
|---|
by , 12 years ago
| Attachment: | xml-esc-in.xml added | 
|---|
by , 12 years ago
| Attachment: | xml-esc-out.xml added | 
|---|
comment:1 by , 12 years ago
| Component: | None → property_tree | 
|---|---|
| Owner: | set to | 
comment:2 by , 11 years ago
| Resolution: | → duplicate | 
|---|---|
| Status: | new → closed | 
  Note:
 See   TracTickets
 for help on using tickets.
    
Dupe of bug 4840.