[xsd-users] retrieving data from gml:featureMember
Jan Pauwels
Jan.Pauwels at graphicomp.com
Fri Nov 16 08:05:21 EST 2007
Hello,
I am not so familiar with C++.
I want to retreive data from hello9.xml. (Extract from file follows)
<gml:featureMember>
<BP_Plan gml:id="obj_0">
</BP_Plan>
</gml:featureMember>
I use the following code : (copied from example polymorphism)
auto_ptr<xplangml::XPlanAuszugType> Auszug (xplangml::XPlanAuszug
(argv[1]));
xplangml::XPlanAuszugType copy (*Auszug); // Dynamic types are
preserved in copies.
// Print what we've got.
//
for
(gml::AbstractFeatureCollectionType::featureMember_const_iterator i
(copy.featureMember().begin());
i != copy.featureMember ().end ();
++i)
{
if (const xplangml::BP_PlanType* s = dynamic_cast<const
xplangml::BP_PlanType*> (&*i))
cout << "BP_Plan" << endl;
else
cout << "no BP_Plan" << endl;
}
The output is always "no BP_Plan".
featureMember can be BP_Plan, BP_... (lots of possible elements).
How can I retrieve data for element BP_Plan ?
Do I have to use an if-statement for each BP_ element that I want to
retrieve ?
example :
if (const xplangml::BP_PlanType* s = dynamic_cast<const
xplangml::BP_PlanType*> (&*i))
else if (const xplangml::BP_BereichType* s = dynamic_cast<const
xplangml::BP_BereichType*> (&*i))
I attached the XML-files + schemas.
Thank you in advance.
Greetings.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hello9.zip
Type: application/x-zip-compressed
Size: 31809 bytes
Desc: hello9.zip
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20071116/c270857f/hello9.bin
More information about the xsd-users
mailing list