1

I've been having a great deal of trouble in getting boost::property_tree::xml_parser to play nicely with boost::filesystem::path objects.

IN the project I'm currently working on, I'm attempting to gather a set of xml files from a particular directory, and then run them through boost's xml parser, and deliver them to a vector of property trees, to be read and dealt with later in the thread's run cycle.

This is attempted in the following code:

    BOOST_FOREACH(boost::filesystem::path const &p, std::make_pair(sub_iterator, eod))
{
    if (boost::filesystem::is_regular_file(p))
    {
        //boost::filesystem::path sampleFile("LicenseIds.xml");
        TRACE("\n *** FOUND GOOD FILE  *** \n");
        //boost::property_tree::read_xml(sampleFile.generic_string(), m_SingleFeatureLicenseTree);
        //std::string fileName = p.filename().c_str();
        boost::property_tree::read_xml(p.generic_string(), m_SingleFeatureLicenseTree);
        m_FeatureLicenseTrees.push_back(*m_SingleFeatureLicenseTree);
    }
}

I've attempted to use multiple different file formats, and access p's filename using p.filename(), p.filename().string(), p.filename().generic_string(), and others. All attempts have resulted in a number of compiler errors stemming from the read_xml call. I'm assuming that the path objects (p) are not generating a compatible string type for the xml_parser to read, but after trying every permutation of string() and related calls on p, I'm out of ideas.

Thank you for any possible help.

0 Answers0