[xsd-users] ID/IDREF problem
Boris Kolpackov
boris at codesynthesis.com
Sat Mar 8 01:43:06 EST 2014
Hi Mathew,
Mathew Benson <mathew.benson at gmail.com> writes:
> I get a seg fault when I try to dereference the IDREF property.
>
> xml_schema::idref& paramRef(this->parameterRef());
> std::cout << typeid(*paramRef).name() << std::endl;
>
> It crashes on the second line. I'm not really sure how to continue
> debugging this since I just get a seg fault. Does anybody have any ideas
> of what to look at? Are there any known conditions that cause a seg fault
> when trying to dereference a ::xml_schema::idref variable?
xml_schema::idref is a smart pointer. What is a common condition that
causes a seg fault when trying to dereference a smart pointer? A NULL
pointer. Try printing the raw pointer to the object model node that
idref is supposed to reference:
std::cout << paramRef.get () << std::endl;
If it is NULL, then that means there is no corresponding ID in your
object model. Print the ID value like that the IDREF refers like
this:
std::cout << paramRef << std::endl;
Then try to figure out why there is no such ID in your object
model. One common cause of such problem is making a copy of
a fragment of the object model rather than using references.
Boris
More information about the xsd-users
mailing list