[xsd-users] how to insert/remove elements?

Boris Kolpackov boris at codesynthesis.com
Mon Feb 18 09:08:08 EST 2008


Hi Gennady,

Gennady Khokhorin <gok at aerometric-ak.com> writes:

> 		IdinfoType idInfo = h->idinfo();
> 		CitationType citation = idInfo.citation();
> 		CiteinfoType citeInfo=citation.citeinfo();
> 		CiteinfoType::OriginSequence originator=citeInfo.origin();

You need to use references instead of making copies. If you are making
copies and modify them then your modifications have no effect on the
original tree:

IdinfoType& idInfo = h->idinfo();
CitationType& citation = idInfo.citation();
CiteinfoType& citeInfo = citation.citeinfo();
CiteinfoType::OriginSequence& originator = citeInfo.origin();

BTW, this exact point is covered in Section 4.3, "Modifying the Object
Model", in the C++/Tree Mapping Getting Started Guide:

http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/#4.3

Boris




More information about the xsd-users mailing list