[xsd-users] GML 3.1.1 basicTypes.hxx class doubleList

Boris Kolpackov boris at codesynthesis.com
Sat Oct 27 13:17:56 EDT 2007


Hi Gail,

Nagle, Gail A (US SSA) <gail.nagle at baesystems.com> writes:

> Can anyone provide an example of how to traverse an object of type
> doubleList produced when the xsd cxx-tree generates code for the
> basicTypes.xsd file?

Here is the definition of doubleList taken from basicTypes.xsd:

  <simpleType name="doubleList">
    <list itemType="double"/>
  </simpleType>

The generated doubleList C++ class has an interface of a standard
sequence. Practically, this means that you can treat it like
std::vector<double>:

doubleList& dl = ...

for (doubleList::iterator i = dl.begin (); i != dl.end (); ++i)
{
  double v = *i;
  cout << v << endl;
}

dl.push_back (1.1);
dl.push_back (1.2);

Generally, if you don't know how to use C++ mapping for a
particular XML Schema construct, the fastest way to find out
is to look this Schema construct up in the C++/Tree Mapping
User Manual. For example, mapping for simple type derivation
by list is covered in Section 2.6.3, "Mapping for Derivation
by List":

http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.6.3


Boris




More information about the xsd-users mailing list