RE: Derived types and the TypeInfo interface

Thank you. I'm sorry for my late acknowledgement to [1]. Your proposal looks
good to me.

Best regards,
Petteri Stenius

[1] http://www.w3.org/2003/06/09-dom-core-issues/issues.html#stenius-1

-----Original Message-----
From: Philippe Le Hegaret [mailto:plh@w3.org]
Sent: Thursday, August 28, 2003 6:50 PM
To: Petteri Stenius
Cc: WWW DOM
Subject: Re: Derived types and the TypeInfo interface


On Thu, 2003-06-12 at 01:33, Petteri Stenius wrote:
> Using DOM Level 3 Core, is it possible to find out if the type of an
Element
> or Attribute is derived from some specific type in the Schema?
>
> What I would like to see is something like the Xerces
> XSTypeDefinition.derivedFrom method in the TypeInfo interface.

Here is a proposed addition for TypeInfo:
[[
Definition group DerivationMethods
 The type of derivation, used by the method TypeInfo.isDerivedFrom().
 Defined Constants
  DERIVATION_EXTENSION
   If the document's schema is an XML Schema [XML Schema Part 1], this
   constant represents the derivation by extension if complex types are
   involved.
  DERIVATION_LIST
   If the document's schema is an XML Schema [XML Schema Part 1], this
   constant represents the list if simple types are involved.
  DERIVATION_RESTRICTION
   If the document's schema is an XML Schema [XML Schema Part 1], this
   constant represents the derivation by restriction if complex types
   are involved, or a restriction if simple types are involved.
  DERIVATION_UNION
   If the document's schema is an XML Schema [XML Schema Part 1], this
   constant represents the union if simple types are involved.

isDerivedFrom
 The method checks if this TypeInfo derives from the specified ancestor
 type.

 Parameters
  typeNamespaceArg of type DOMString
   the namespace of the ancestor type.
  typeNameArg of type DOMString
   the name of the ancestor type.
  derivationMethod of type unsigned long
   the type of derivation and conditions applied between two types, as
   described in the list of constants provided in this interface. Note
   that those constants:
   * are only defined if the document's schema is an XML Schema;
   * could be combined if XML Schema types are involved.
   * TypeInfo.DERIVATION_EXTENSION only applies to XML Schema complex
     types.
   The value 0x00000000 represents any kind of derivation method.
 Return Value
  boolean
   true if the specified type is an ancestor according to the derivation
        parameter, false otherwise. If the document's schema is a DTD or
        no schema is associated with the document, this method will
        always return false.
 No Exceptions
]]

Philippe

Received on Thursday, 9 October 2003 13:14:35 UTC