Skip to content

Write AbstractConfiguration to String #3501

@KevDi

Description

@KevDi

Is it possible to write an AbstractConfiguration to a String?
I use a Poco::Util::ServerApplication and load a configuration file on startup.
I then create some AbstractConfigurations via the createView(...) Function of the Config.

The Configuration is a XML File. What i now want to archive is to wrote a Subpart of the Configuration back to a String.

This is what i have done:

Poco::AutoPtr<Poco::Util::AbstractConfiguration> pSubConfig(app.config().createView("Sub.Config"));
Poco::Util::XMLConfiguration* xmlconfig = reinterpret_cast<Poco::Util::XMLConfiguration*>(pSubConfig.get());
std::stringstream ss;

xmlconfig->save(ss); // This crashes

Calling save on the xmlconfig leads to an crash because the _pDocument member of the XMLConfiguration is not set.
Is there a way to store parts of an XML Config in an String?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions