[xsd-users] Obtaining a referenced element via IDREF

Marco Fischer marco.fischer at chipvision.com
Mon Feb 20 05:21:06 EST 2006


Hello,

I have problems to obtain a referenced element from an IDREF attribute.
My schema looks like the following:

<complexType name="A">
  <attribute name="name" type="ID"/>
</complexType>

<complexType name="B">
  <attribute name="ref" type="IDREF"/>
</complexType>

I work on an in-memory representation with the following code:

A *a;
B *b;
...
b->ref(xml_schema::idref(a->name()));
...
xsd::cxx::tree::type *t = b->ref().get().get();
// t is null here


As I understood, ref is a container, ref() returns the optional
representing the attribute, ref().get() returns the idref instance and
ref().get().get() should resolve to the referenced element.

For some reason, I can't get back a pointer to 'a'.
Surprisingly, using the same code to get a pointer to a referenced
element on the in-memory representation of a just de-serialized XML file
works.

I think I did not correctly initialize the idref instance that I want to
add to the in-memory representation. What am I doing wrong?


Thanks for your help,

Marco Fischer
ChipVision Design Systems AG
Fritz-Bock-Strasse 5 - 26121 Oldenburg - Germany





More information about the xsd-users mailing list