boostorg / boostorg/property_tree

Feature request: char16_t/char_32_t support for read_xml

Open
#34 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
65
Forks
97
PR merge metrics
No merged PRs in 30d

Description

Similar to [this issue](https://svn.boost.org/trac10/ticket/9919) but less ambitious, I would like to suggest to provide minimum support for `char16_t` and` char32_t` to read XML, basically an extension of [a previous BOM support issue](https://svn.boost.org/trac10/ticket/1678). For example, the following code snippet does currently not compile:
```
#include
#include

int main()
{
boost::property_tree::basic_ptree pt;
std::string filename("utf16.xml");
read_xml(filename, pt);
}
```
producing the following compile error:
```
1>c:\projects\thirdparty\boost_1_68_0\boost\property_tree\detail\rapidxml.hpp(1374): error C2664: 'void boost::property_tree::detail::rapidxml::xml_document::parse_bom<3072>(wchar_t *&)': cannot convert argument 1 from 'Ch *' to 'char *&'
1> with
1> [
1> Ch=Ch
1> ]
1>c:\projects\thirdparty\boost_1_68_0\boost\property_tree\detail\xml_parser_read_rapidxml.hpp(116): note: see reference to function template instantiation 'void boost::property_tree::detail::rapidxml::xml_document::parse<3072>(Ch *)' being compiled
1> with
1> [
1> Ch=Ch
1> ]
1>c:\projects\thirdparty\boost_1_68_0\boost\property_tree\detail\xml_parser_read_rapidxml.hpp(116): note: see reference to function template instantiation 'void boost::property_tree::detail::rapidxml::xml_document::parse<3072>(Ch *)' being compiled
1> with
1> [
1> Ch=Ch
1> ]
1>c:\projects\thirdparty\boost_1_68_0\boost\property_tree\xml_parser.hpp(85): note: see reference to function template instantiation 'void boost::property_tree::xml_parser::read_xml_internal(std::basic_istream> &,Ptree &,int,const std::string &)' being compiled
1> with
1> [
1> Ptree=boost::property_tree::basic_ptree>
1> ]
[...]
1>Done building project "bdal-playground.vcxproj" -- FAILED.
```
First inspection indicates that there are only missing specializations of the `parse_bom` member template for types `char16_t` and `char_32_t`.

I'm willing to make a corresponding pull request, but opened this issue first to get feedback on this idea.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with boost/property_tree/detail/rapidxml.hpp, then trace the XML reading path through boost/property_tree/detail/xml_parser_read_rapidxml.hpp and boost/property_tree/xml_parser.hpp. Use the provided std::u16string example as the first check; done means the char16_t and char32_t read_xml case compiles and supports the requested BOM handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
data
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.