[xquery-talk] What exactly does schema-element

Jens T Teubner teubner at us.ibm.com
Thu Nov 8 17:51:59 PST 2007


talk-bounces at x-query.com wrote on 11/08/2007 04:29:51 PM:

> i have a question concerning the difference between element and 
> schema-element test? I've read the xsd spec at w3c's but still didn't 
> get behind the meaning of it.

Timothy,

the test

  element(n,t)

tests whether an element has the name n and the type annotation t.

By contrast, the test

  schema-element(n)

looks up the global element declaration for n in your imported XML
Schema document.  Then, it tests, whether the name of your node under
investigation is compatible with that element declaration (substitution
groups are respected here) and whether it matches the type that is
required in the global element declaration for n.

So schema-element() does a bit more in the sense that it does the
lookup in the XML Schema document.  In the presence of substitution
groups, the schema-element() test can also be a bit more permissive
than element() (which strictly looks at the element's name).

Jens

-- 
Jens Teubner
IBM T.J. Watson Research Center
19 Skyline Drive, Hawthorne, NY 10532
+1 914 784 7179


More information about the talk mailing list