[xsd-users] Receiving error using xsd on W3 PROV schema

Mohammad Khatami mdkhatami at gmail.com
Mon Apr 27 06:07:16 EDT 2015


Thanks Boris,

Now it's works fine and have access to function for serialization . The
only problem the prov:id which is used in Entity type is defined as follow
in XML schema:


<xs:complexType name="Entity">
    <xs:sequence>
        <!-- prov attributes -->
        <xs:element ref="prov:label" minOccurs="0" maxOccurs="unbounded"/>
        <xs:element ref="prov:location" minOccurs="0"
maxOccurs="unbounded"/>
        <xs:element ref="prov:type" minOccurs="0" maxOccurs="unbounded"/>
        <xs:element ref="prov:value" minOccurs="0"/>
        <xs:any namespace="##other" processContents="lax" minOccurs="0"
maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
    <xs:anyAttribute namespace="##other" processContents="lax"/>
  </xs:complexType>

<xs:attribute name="id" type="xs:QName"/>

and the produced code for <xs:attribute ref="prov:id"/> in Entity name
space is:

// id
    //
    typedef ::xml_schema::qname id_type;
    typedef ::xsd::cxx::tree::optional< id_type > id_optional;
    typedef ::xsd::cxx::tree::traits< id_type, char > id_traits;

    const id_optional&
    id () const;

    id_optional&
    id ();

    void
    id (const id_type& x);

    void
    id (const id_optional& x);

    void
    id (::std::auto_ptr< id_type > p);

but the problem is I can't set the value for this attribute according to
manual page.

void
f (object& o)
{
  using xml_schema::string;

  if (o.member ().present ())       // test
  {
    string& s (o.member ().get ()); // get
    o.member ("hello");             // set, deep copy
    o.member ().set ("hello");      // set, deep copy
    o.member ().reset ();           // reset
  }

  // Same as above but using pointer notation:
  //
  if (o.member ())                  // test
  {
    string& s (*o.member ());       // get
    o.member ("hello");             // set, deep copy
    *o.member () = "hello";         // set, deep copy
    o.member ().reset ();           // reset
  }

would you please help me how to set id attribute (generally optional value)
?

Best Regards,
Mohammad

On 22 April 2015 at 18:21, Boris Kolpackov <boris at codesynthesis.com> wrote:

> Hi Mohammad,
>
> Mohammad Khatami <mdkhatami at gmail.com> writes:
>
> > prov-core.xsd:6:307: error: unable to map XML Schema namespace '
> > http://www.w3.org/ns/prov#' to C++ namespace
> > prov-core.xsd:6:307: info: use the --namespace-map or --namespace-regex
> > option to provide custom mapping
>
> See the documentation for the --namespace-map option, as suggested
> in the diagnostics:
>
> http://codesynthesis.com/projects/xsd/documentation/xsd.xhtml
>
> Boris
>


More information about the xsd-users mailing list