[xsd-users] Need help !!!

Boris Kolpackov boris at codesynthesis.com
Mon Jun 25 08:48:57 EDT 2007


Hi,

Picsou en Bretagne <breizh_picsou at yahoo.fr> writes:

> sorry for the reply and thanks for your solution but is it possible to
> have the parent object to have attributes for exemple because I'm not
> sur but this solution bring the name of the element only , No ?

You will need to cast the returned (generic) pointer to a concrete
type before you can do anything useful with it. For example if we are
iterating over authors of a book in the library example (using 2.3.1
syntax):


catalog& cat = ...

for (catalog::book::iterator bi (cat.book ().begin ());
     bi != cat.book ().end ();
     ++bi)
{

  for (book::author::iterator ai (bi->author ().begin ());
       ai != bi->author ().end ();
       ++ai)
  {
    author& a = *ai;

    book* b = static_cast<book*> (a._container ());
    catalog* c = static_cast<catalog*> (b->_container ());
  }
}

hth,
-boris




More information about the xsd-users mailing list