Algorithm for identifying the type of a given element

When given 

a) an XML Schema document S, and 
b) an XML document plus an element E therein (e.g., by an XPath
expression),

does anybody know an algorithm to determine the complex type of E as
defined by S? Or, if E does not have a "directly according" complex
type, to determine the complex type of the "nearest" ancestor of E that
has a directly according complex type? Or any algorithm that partly
deals with this problem?

I guess schema validators might implement such functionality, though I'm
not sure whether they provide an interface that can be used from
external programs. Any hints?

Martin

Received on Wednesday, 10 July 2002 14:40:05 UTC