Hi John,
If you enable validation you should get a SAXException which wraps a root ValidationException which many further contain a linked set of exceptions, one for each unresolved IDREF.
If you look at UnmarshalHandler line 858, you should see the following:
<code>
//-- if we are at root....just validate and we are done
if (_stateInfo.empty()) {
if (_validate) {
ValidationException first = null;
ValidationException last = null;//-- check unresolved references
if (_resolveTable != null) {
Enumeration enumeration = _resolveTable.keys();
while (enumeration.hasMoreElements()) {
String msg = "unable to resolve reference: " + enumeration.nextElement();
if (first == null) {
first = new ValidationException(msg);
last = first;
}
else {
last.setNext(new ValidationException(msg));
last = last.getNext();
}
}
}
</code>
--Keith
John Weir wrote:
All,
I wondered if there was any way that I can ask a Marshaller after I have marshalled an XML Document into Java classes generated by the sourceGenerator if there remain any 'unresolved' IDREF's? These can lead to NPE's if someone traverses the relationship to the Object with the ID where the match up hasn't occurred (and they haven't written very defensive code)
I have played with the IDResolver, but since the docs are not guaranteed to be parsed in any order the output it gives does not suffice. The resolve method is called, but the UnmarshallerHandler#idresolver also has a local bind() method which is not in the interface. AFAIK its impossible to tell if the ID was found Later and resolved correctly
Have I missed something [(usually the case:-)] or should I look at raising a 'feature bugzilla' and implementing the code
Thanks
J
BTW: Happy New Year All
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
