[oXygen-user] C++ XML Data Binding
Wendell Piez
wapiez at wendellpiez.com
Tue Jan 8 10:58:12 CST 2013
Hi Olumide,
I'm no C++ programmer, but if it's as straightforward as plugging
values into boilerplate, this is simply done with XSLT.
What's not so simple is to avoid the temptation to do more. Entire
domain-specific languages have been implemented with XSLT used as a
"compiler".
Cheers,
Wendell
On Mon, Jan 7, 2013 at 2:20 PM, Olumide <videohead at mail.com> wrote:
> Hello -
>
> Given an XML "config" file
>
> <?xml version="1.0" encoding="UTF-8"?>
> <Device manufacturer="ACME" model="Gizmo">
> <Frequencies>3200 6400 12800</Frequencies>
> <ImageSupport value='false'/>
> <Memory size="128"/>
> </Device>
>
> defining the attributes of an object, what would be the best way to
> create C++ header and implementation files
>
> /* C++ Header File */
> namespace ACME
> {
> class Gizmo
> {
> public:
> typedef std::vector<unsigned> Frequency;
> Frequency initializeFrequency(); // ideally, private
> static const Frequency m_frequency;
>
> static const bool m_supportsImages = false;
> static const unsigned m_deviceMemory = 128;
>
> static const std::string name();
> };
> }
>
>
> /* C++ implementation file */
> namespace ACME
> {
> const Gizmo::m_frequency = Gizmo::initializeFrequency();
>
> Frequency Gizmo::initializeFrequency()
> {
> Frequency freq;
>
> freq.push_back( 3200 );
> freq.push_back( 6400 );
> freq.push_back( 12800 );
>
> return freq;
> }
>
> const std::string Gizmo::name()
> {
> return "ACME::Gizmo";
> }
> }
>
> I've googled and found some utilities (mostly) commercial but I'm not
> sure which is the best or if this task can be easily accomplished with XSLT.
>
> Regards,
>
> - Olumide
>
> _______________________________________________
> oXygen-user mailing list
> oXygen-user at oxygenxml.com
> http://www.oxygenxml.com/mailman/listinfo/oxygen-user
--
Wendell Piez | http://www.wendellpiez.com
XML | XSLT | electronic publishing
Eat Your Vegetables
_____oo_________o_o___ooooo____ooooooo_^
More information about the oXygen-user
mailing list