This is off the top of my head but... I have been looking into XML pipeline processing and I think you could handle the problem with a pipeline configuration.
Essentially you would create a SAX event handler sitting between the parser and the Validator which would track the KeyField information as it passes the events through.
This is hard to describe without a lot of handwaving and whiteboard diagrams ;) - fortunately,
Elliotte Rusty Harold's chapter on the sort of thing is available online with many examples.
Please let us know what you come up with!
Bill