- From: Philippe Le Hegaret <plh@w3.org>
- Date: 28 Aug 2003 11:50:11 -0400
- To: Petteri Stenius <Petteri.Stenius@ubisecure.com>
- Cc: WWW DOM <www-dom@w3.org>
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, 28 August 2003 11:50:19 UTC