A quesiton on XPath-datamodel (Mapping PSVI addition to Node Properties)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

A quesiton on XPath-datamodel (Mapping PSVI addition to Node Properties)

Zhiqiang Yu-2
Hi, All
 
I am a software engineer and encounter some problem when reading the spec of XQuery 1.0 and XPath 2.0 Data Model (XDM).

<a title="http://www.w3.org/TR/xpath-datamodel/#PSVI2Types" onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.w3.org/TR/xpath-datamodel/#PSVI2Types" target="_blank"> http://www.w3.org/TR/xpath-datamodel/#PSVI2Types

In the Chapter 3.3.1 ( Mapping PSVI addition to Node Propterties), it says:

  • The [validity] and [validation attempted] properties exist and have the values "valid " and "full", respectively, the schema type of an element or attribute information item is represented by an <a title="http://www.w3.org/TR/xpath-datamodel/#dt-expanded-qname#dt-expanded-qname expanded-QName" onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.w3.org/TR/xpath-datamodel/#dt-expanded-qname%23dt-expanded-qname" target="_blank">expanded-QName whose namespace and local name correspond to the first applicable items in the following list:
    • If the declared type exists and is a union and the actual type is …..
    • If there is no declared type, and the actual type is a union, then: ……
    • Otherwise: ….

  Regarding the second bullet, I can NOT understand in which cases there will be no declared type?  I think it is impossible. Since the declared type reference the [type definition] associated with the declaration,  if an element/attribute is validated, it should be already associated with a element/attribute declaration, which should have the type definition.

could anyone   give me some clarification on this?  Thanks a lot in advance!

Reply | Threaded
Open this post in threaded view
|

Re: A quesiton on XPath-datamodel (Mapping PSVI addition to Node Properties)

C. M. Sperberg-McQueen

On 21 Jan 2007, at 09:24 , Zhiqiang Yu wrote:

 > I am a software engineer and encounter some problem when reading the
 > spec of XQuery 1.0 and XPath 2.0 Data Model (XDM).

 > http://www.w3.org/TR/xpath-datamodel/#PSVI2Types

 > In the Chapter 3.3.1 ( Mapping PSVI addition to Node Propterties),
 > it says:

 >  - The *[validity]* and *[validation attempted]* properties exist
 >  and have the values "*valid* " and "*full*", respectively, the
 >  schema type of an element or attribute information item is
 >  represented by an
 >  expanded-QName
 >  <http://www.w3.org/TR/xpath-datamodel/#dt-expanded-qname%23dt- 
expanded-qname>
 >  whose namespace and local name correspond to the first applicable
 >  items in the following list:

 >      - If the declared type exists and is a union and the actual
 >        type is …..
 >      - If there is no declared type, and the actual type is a union,
 >        then: ……
 >      - Otherwise: ….

 > Regarding the second bullet, I can NOT understand in which cases
 > there will be no declared type?  I think it is impossible. Since the
 > declared type reference the *[type definition] *associated with the
 > declaration, if an element/attribute is validated, it should be
 > already associated with a element/attribute declaration, which
 > should have the type definition.

 > could anyone give me some clarification on this?  Thanks a lot in
 > advance!

Thanks for your question.  It's a good one that caused the Working
Groups a few moments of head-scratching before we remembered why this
clause is present.

Elements may be validated against type definitions without having been
validated against an element declaration in at least two cases:

   1) Validation was initiated by a request to validate a
      particular element against a particular type.
      (In section 5.2 of XML Schema 1.0: Structures, this
      is item 1 in the list of ways validation can start.
      In 1.1, the term 'type-driven validation' is introduced
      to describe this way of starting validation.)

   2) An element with no governing element declaration, being
      validated in lax validation mode, has an xsi:type attribute
      which identifies a type present in the schema.

According to section 3.3.5 of XML Schema 1.0, the properties
[validity] and [validation attempted] are present if "the
schema-validity of an element information item has been assessed as
per Schema-Validity Assessment (Element) (sec. 3.3.4)".  In the
absence of an element declaration and the presence of the type
definition, clause 1.1 of Validation Rule: Schema-Validity Assessment
(Element) does not apply, and clause 1.2 does.  So it's possible to
have [validity] = valid and [validation attempted] = full even when
there is no governing element declaration and thus no declared type.

I hope this helps.  If you have further questions, please ask. If this
answer doesn't seem satisfactory, please let us know; in that case,
you might wish to open a bug report against the spec in the public
instance of Bugzilla on the W3C site, at http://www.w3.org/Bugs/Public

--C. M. Sperberg-McQueen
   on behalf of the XML Query and XSL Working Groups