[xsd-users] Set Node Text via Iterator

Boris Kolpackov boris at codesynthesis.com
Wed Mar 16 11:56:56 EDT 2016


Hi Derrick,

Derrick Babb <d at op.st> writes:

> class myType: public ::xml_schema::string
> {
> ...
> }
> 
>  for (my_iterator itor = root.examples().begin(); itor !=
> root.examples().end(); itor++)
>      *itor = "Some Text";

XSD-generated classes don't define any assignment operators so the compiler-
generated ones must be hiding the ones from the string. You can do:

static_cast<xml_schema::string&> (*itor) = "Some Text";

Ok, knowing that xml_schema::string derives from std::string and that
std::string has assign(), you can do:

itor->assign ("Some Text");

Boris



More information about the xsd-users mailing list