[xsd-users] Expecting Sequence, Getting Optional

andrew.king2 at barclays.com andrew.king2 at barclays.com
Tue Oct 16 09:02:52 EDT 2012


Hi Boris,

Please can you help me with a problem that I am seeing in the code that has been generated by CodeSynthesis?

We have just received the new schemas for FpML 5.4, and have created a new version of the library based upon the XSD files.

I'm seeing something unusual with the code that was generated for the TradeIdentifier class. If you take a look at the two PNG files, you will see the XSD and the graphic for the TradeIdentifier as shown, which both seem to show that tradeId is a sequence. However, when you take a look at the code that was generated by CodeSynthesis in the attached header file, you will see that tradeId is an optional field, and not a sequence at all.

Please can you advise as what the problem might be?

Many thanks
Andrew


_______________________________________________

This e-mail may contain information that is confidential, privileged or otherwise protected from 
disclosure. If you are not an intended recipient of this e-mail, do not duplicate or redistribute 
it by any means. Please delete it and any attachments and notify the sender that you have received 
it in error. Unless specifically indicated, this e-mail is not an offer to buy or sell or a 
solicitation to buy or sell any securities, investment products or other financial product or 
service, an official confirmation of any transaction, or an official statement of Barclays. Any 
views or opinions presented are solely those of the author and do not necessarily represent those 
of Barclays. This e-mail is subject to terms available at the following link: www.barclays.com/emaildisclaimer. 
By messaging with Barclays you consent to the foregoing.  Barclays offers premier investment banking 
products and services to its clients through Barclays Bank PLC, a company registered in England 
(number 1026167) with its registered office at 1 Churchill Place, London, E14 5HP.  This email may 
relate to or be sent from other members of the Barclays Group.

_______________________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TradeIdentifier.PNG
Type: image/png
Size: 102332 bytes
Desc: TradeIdentifier.PNG
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20121016/9a3e42e2/TradeIdentifier-0001.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TradeIdentifier_Schema.PNG
Type: image/png
Size: 87933 bytes
Desc: TradeIdentifier_Schema.PNG
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20121016/9a3e42e2/TradeIdentifier_Schema-0001.png
-------------- next part --------------
// Copyright (C) 2005-2010 Code Synthesis Tools CC
//
// This program was generated by CodeSynthesis XSD, an XML Schema to
// C++ data binding compiler.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
// In addition, as a special exception, Code Synthesis Tools CC gives
// permission to link this program with the Xerces-C++ library (or with
// modified versions of Xerces-C++ that use the same license as Xerces-C++),
// and distribute linked combinations including the two. You must obey
// the GNU General Public License version 2 in all respects for all of
// the code used other than Xerces-C++. If you modify this copy of the
// program, you may extend this exception to your version of the program,
// but you are not obligated to do so. If you do not wish to do so, delete
// this exception statement from your version.
//
// Furthermore, Code Synthesis Tools CC makes a special exception for
// the Free/Libre and Open Source Software (FLOSS) which is described
// in the accompanying FLOSSE file.
//

#ifndef FPML_CONFIRMATION_TRADE_IDENTIFIER_HXX
#define FPML_CONFIRMATION_TRADE_IDENTIFIER_HXX

// Begin prologue.
//
//
// End prologue.

#include <xsd/cxx/config.hxx>

#if (XSD_INT_VERSION != 3030000L)
#error XSD runtime version mismatch
#endif

#include <xsd/cxx/pre.hxx>

#ifndef XSD_USE_CHAR
#define XSD_USE_CHAR
#endif

#ifndef XSD_CXX_TREE_USE_CHAR
#define XSD_CXX_TREE_USE_CHAR
#endif

#include "../xml-schema.hxx"

// Forward declarations.
//
namespace confirmation
{
  class TradeIdentifier;
}


#include <memory>    // std::auto_ptr
#include <limits>    // std::numeric_limits
#include <algorithm> // std::binary_search

#include <xsd/cxx/xml/char-utf8.hxx>

#include <xsd/cxx/tree/exceptions.hxx>
#include <xsd/cxx/tree/elements.hxx>
#include <xsd/cxx/tree/containers.hxx>
#include <xsd/cxx/tree/list.hxx>

#include <xsd/cxx/xml/dom/parsing-header.hxx>

#ifndef XSD_DONT_INCLUDE_INLINE
#define XSD_DONT_INCLUDE_INLINE

namespace confirmation
{
  class IssuerId;
}

namespace confirmation
{
  class TradeId;
}

namespace confirmation
{
  class PartyReference;
}

namespace confirmation
{
  class AccountReference;
}

namespace confirmation
{
  class VersionedTradeId;
}

#undef XSD_DONT_INCLUDE_INLINE
#else

namespace confirmation
{
  class IssuerId;
}

namespace confirmation
{
  class TradeId;
}

namespace confirmation
{
  class PartyReference;
}

namespace confirmation
{
  class AccountReference;
}

namespace confirmation
{
  class VersionedTradeId;
}

#endif // XSD_DONT_INCLUDE_INLINE

namespace confirmation
{
  class TradeIdentifier: public ::xml_schema::type
  {
    public:
    // issuer
    // 
    typedef ::confirmation::IssuerId issuer_type;
    typedef ::xsd::cxx::tree::optional< issuer_type > issuer_optional;
    typedef ::xsd::cxx::tree::traits< issuer_type, char > issuer_traits;

    const issuer_optional&
    issuer () const;

    issuer_optional&
    issuer ();

    void
    issuer (const issuer_type& x);

    void
    issuer (const issuer_optional& x);

    void
    issuer (::std::auto_ptr< issuer_type > p);

    // tradeId
    // 
    typedef ::confirmation::TradeId tradeId_type;
    typedef ::xsd::cxx::tree::optional< tradeId_type > tradeId_optional;
    typedef ::xsd::cxx::tree::traits< tradeId_type, char > tradeId_traits;

    const tradeId_optional&
    tradeId () const;

    tradeId_optional&
    tradeId ();

    void
    tradeId (const tradeId_type& x);

    void
    tradeId (const tradeId_optional& x);

    void
    tradeId (::std::auto_ptr< tradeId_type > p);

    // partyReference
    // 
    typedef ::confirmation::PartyReference partyReference_type;
    typedef ::xsd::cxx::tree::optional< partyReference_type > partyReference_optional;
    typedef ::xsd::cxx::tree::traits< partyReference_type, char > partyReference_traits;

    const partyReference_optional&
    partyReference () const;

    partyReference_optional&
    partyReference ();

    void
    partyReference (const partyReference_type& x);

    void
    partyReference (const partyReference_optional& x);

    void
    partyReference (::std::auto_ptr< partyReference_type > p);

    // accountReference
    // 
    typedef ::confirmation::AccountReference accountReference_type;
    typedef ::xsd::cxx::tree::optional< accountReference_type > accountReference_optional;
    typedef ::xsd::cxx::tree::traits< accountReference_type, char > accountReference_traits;

    const accountReference_optional&
    accountReference () const;

    accountReference_optional&
    accountReference ();

    void
    accountReference (const accountReference_type& x);

    void
    accountReference (const accountReference_optional& x);

    void
    accountReference (::std::auto_ptr< accountReference_type > p);

    // versionedTradeId
    // 
    typedef ::confirmation::VersionedTradeId versionedTradeId_type;
    typedef ::xsd::cxx::tree::sequence< versionedTradeId_type > versionedTradeId_sequence;
    typedef versionedTradeId_sequence::iterator versionedTradeId_iterator;
    typedef versionedTradeId_sequence::const_iterator versionedTradeId_const_iterator;
    typedef ::xsd::cxx::tree::traits< versionedTradeId_type, char > versionedTradeId_traits;

    const versionedTradeId_sequence&
    versionedTradeId () const;

    versionedTradeId_sequence&
    versionedTradeId ();

    void
    versionedTradeId (const versionedTradeId_sequence& s);

    // id
    // 
    typedef ::xml_schema::id 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);

    // Constructors.
    //
    TradeIdentifier ();

    TradeIdentifier (const ::xercesc::DOMElement& e,
                     ::xml_schema::flags f = 0,
                     ::xml_schema::container* c = 0);

    TradeIdentifier (const TradeIdentifier& x,
                     ::xml_schema::flags f = 0,
                     ::xml_schema::container* c = 0);

    virtual TradeIdentifier*
    _clone (::xml_schema::flags f = 0,
            ::xml_schema::container* c = 0) const;

    virtual 
    ~TradeIdentifier ();

    // Implementation.
    //
    protected:
    void
    parse (::xsd::cxx::xml::dom::parser< char >&,
           ::xml_schema::flags);

    protected:
    issuer_optional issuer_;
    tradeId_optional tradeId_;
    partyReference_optional partyReference_;
    accountReference_optional accountReference_;
    versionedTradeId_sequence versionedTradeId_;
    id_optional id_;
  };
}

#ifndef XSD_DONT_INCLUDE_INLINE

#include "IssuerId.hxx"
#include "IssuerId.ixx"

#include "TradeId.hxx"
#include "TradeId.ixx"

#include "PartyReference.hxx"
#include "PartyReference.ixx"

#include "AccountReference.hxx"
#include "AccountReference.ixx"

#include "VersionedTradeId.hxx"
#include "VersionedTradeId.ixx"

#endif // XSD_DONT_INCLUDE_INLINE

#include <iosfwd>

namespace confirmation
{
  ::std::ostream&
  operator<< (::std::ostream&, const TradeIdentifier&);
}

#include <iosfwd>

#include <xercesc/sax/InputSource.hpp>
#include <xercesc/dom/DOMDocument.hpp>
#include <xercesc/dom/DOMErrorHandler.hpp>

namespace confirmation
{
}

#include <iosfwd>

#include <xercesc/dom/DOMDocument.hpp>
#include <xercesc/dom/DOMErrorHandler.hpp>
#include <xercesc/framework/XMLFormatter.hpp>

#include <xsd/cxx/xml/dom/auto-ptr.hxx>

namespace confirmation
{
  void
  operator<< (::xercesc::DOMElement&, const TradeIdentifier&);
}

#ifndef XSD_DONT_INCLUDE_INLINE
#include "TradeIdentifier.ixx"
#endif // XSD_DONT_INCLUDE_INLINE

#include <xsd/cxx/post.hxx>

// Begin epilogue.
//
//
// End epilogue.

#endif // FPML_CONFIRMATION_TRADE_IDENTIFIER_HXX


More information about the xsd-users mailing list