[xsd-users] question on optional elements/attributes syntax

Boris Kolpackov boris at codesynthesis.com
Mon Nov 16 05:00:56 EST 2015


Hi Casey,

Ballentine, Casey <crballentine at essvote.com> writes:

> So basically an optional element/attribute didn't have the 
> ThisIsMyElement() direct access method.
> 
> Did this really change from XSD 3.1.0 [...]

No, I don't think that changed. Here is the mapping for the lang
attribute (optional) from the 'library' example:

    // lang
    //
    typedef xml_schema::language lang_type;
    typedef xsd::cxx::tree::optional< lang_type > lang_optional;
    typedef xsd::cxx::tree::traits< lang_type, char > lang_traits;

    const lang_optional&
    lang () const;

    lang_optional&
    lang ();

    void
    lang (const lang_type&);

    void
    lang (const lang_optional&);

    void
    lang (std::auto_ptr< lang_type >);

While there are direct accessors (the first two), they don't return
the element value but rather the optional container.

Boris



More information about the xsd-users mailing list