AW: [xsd-users] create object model with default values from schema?

Steffen Koepf S.Koepf at ergo-elektronik.de
Thu Apr 7 15:08:26 EDT 2011


Hello,

It is not so easy. When I do what you suggest, i
get the compiler error:

../ConfigCtrl.cpp: In member function âstd::auto_ptr<config> ConfigCtrl::getDefaultConfig()â:
../ConfigCtrl.cpp:117: error: no matching function for call to âconfig::config()â
../config.hxx:400: note: candidates are: config::config(const config&, xml_schema::flags, xml_schema::container*)
../config.hxx:396: note:                 config::config(const xercesc_2_7::DOMElement&, xml_schema::flags, xml_schema::container*)
../config.hxx:392: note:                 config::config(const xml_schema::string&, const xml_schema::double_&, const xml_schema::double_&, const xml_schema::double_&, const xml_schema::int_&, const xml_schema::string&, const xml_schema::string&, const xml_schema::int_&)

Sorry for the german error messages, i had only this box at the moment.

Steffen

-----Ursprüngliche Nachricht-----
Von: Boris Kolpackov [mailto:boris at codesynthesis.com]
Gesendet: Donnerstag, 7. April 2011 19:25
An: Steffen Koepf
Cc: 'xsd-users at codesynthesis.com'
Betreff: Re: [xsd-users] create object model with default values from schema?

Hi Steffen,

Steffen Koepf <S.Koepf at ergo-elektronik.de> writes:

> At the moment I parse a xml file with default values,
> change all elements with the values I want to save
> and then write this to a new xml file.
>
> Is it now possible to get a
> auto_ptr<config> configptr = ...
> without having a xml file first?

Yes, you can do:

auto_ptr<config> configptr = new config;

And all the attributes with default values will have their default
values.

Boris



More information about the xsd-users mailing list