[xsd-users] XSD Generate Extraction and Ordered Type

Southworth Damon (AA-AS/EOS32) damon.southworth at uk.bosch.com
Tue Sep 6 08:17:14 EDT 2016


Hello,

I have a schema that uses an ordered type (sequence of choice elements) and have been successfully utilising the compiler feature that was introduced in version 4.0.0. to allow the ordering information to be maintained.

I recently added the capability to stream the object model using a binary format with the -generate-insertion and  -generate-extraction options.

However I soon noticed that when the object model was serialised in this manner the receptor lost the ordered type information. A quick look around the generated code showed that the vector containing the ordering information Is not populated for the istream derived input serialisation:

The XML parsing code contains a push into the content order vector that is missing from the binary serialisation input parsing code:

      // stepByName
      //
      .
      .
      .
          this->stepByName_.push_back (::std::move (r));
          this->content_order_.push_back (
            content_order_type (stepByName_id, this->stepByName_.size () - 1));
          continue;

Whereas the binary istream serialisation code only contains...

      ::std::size_t n;
      ::xsd::cxx::tree::istream_common::as_size< ::std::size_t > as (n);
      s >> as;
      if (n > 0)
      {
        stepByName_sequence& c (this->stepByName_);
        .
        .
        .
          c.push_back (::std::move (r));
      }

Manually editing the generated code allowed the binary serialisation to work correctly.

So, I think the main question is what is my best way forward to fix this issue with the compiler as we always build from source and the schemas are part of the build pipeline?
Or, maybe it is a known bug for which there is already a fix?

Regards,

Damon Southworth




More information about the xsd-users mailing list