Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.xerces.dom3
Interface TypeInfo

public interface TypeInfo

The `TypeInfo` interface represent a type referenced from `Element` or `Attr` nodes, specified in the schemas associated with the document. The type is a pair of a namespace URI and name properties, and depends on the document's schema.

If the document's schema is an XML DTD [XML 1.0], the values are computed as follows:

- If this type is referenced from an `Attr` node, `typeNamespace` is `null` and `typeName` represents the [attribute type] property in the [XML Information Set] . If there is no declaration for the attribute, `typeName` is `null`.
- If this type is referenced from an `Element` node, the `typeNamespace` and `typeName` are `null`.

If the document's schema is an XML Schema [XML Schema Part 1] , the values are computed as follows using the post-schema-validation infoset contributions (also called PSVI contributions):

- If the [validity] property exists AND is "invalid" or "notKnown": the {target namespace} and {name} properties of the declared type if available, otherwise `null`.

  Note: At the time of writing, the XML Schema specification does not require exposing the declared type. Thus, DOM implementations might choose not to provide type information if validity is not valid.

- If the [validity] property exists and is "valid":
  1. If [member type definition] exists:
     1. If {name} is not absent, then expose {name} and {target namespace} properties of the [member type definition] property;
     2. Otherwise, expose the namespace and local name of the corresponding anonymous type name.
  2. If the [type definition] property exists:
     1. If {name} is not absent, then expose {name} and {target namespace} properties of the [type definition] property;
     2. Otherwise, expose the namespace and local name of the corresponding anonymous type name.
  3. If the [member type definition anonymous] exists:
     1. If it is false, then expose [member type definition name] and [member type definition namespace] properties;
     2. Otherwise, expose the namespace and local name of the corresponding anonymous type name.
  4. If the [type definition anonymous] exists:
     1. If it is false, then expose [type definition name] and [type definition namespace] properties;
     2. Otherwise, expose the namespace and local name of the corresponding anonymous type name.

Note: Other schema languages are outside the scope of the W3C and therefore should define how to represent their type systems using `TypeInfo`.

See also the Document Object Model (DOM) Level 3 Core Specification.

Since:
  DOM Level 3

Field Summary
`static int` | `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.
`static int` | `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.
`static int` | `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.
`static int` | `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.

Method Summary
`java.lang.String` | `getTypeName()` The name of a type declared for the associated element or attribute, or `null` if unknown.
`java.lang.String` | `getTypeNamespace()` The namespace of the type declared for the associated element or attribute or `null` if the element does not have declaration or if no namespace information is available.
`boolean` | `isDerivedFrom(java.lang.String typeNamespaceArg, java.lang.String typeNameArg, int derivationMethod)` The method checks if this `TypeInfo` derives from the specified ancestor type.

Field Detail

### DERIVATION_RESTRICTION

    public static final int 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_EXTENSION

    public static final int 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_UNION

    public static final int 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.

### DERIVATION_LIST

    public static final int 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.

Method Detail

### getTypeName

    public java.lang.String getTypeName()

  The name of a type declared for the associated element or attribute, or `null` if unknown.

### getTypeNamespace

    public java.lang.String getTypeNamespace()

  The namespace of the type declared for the associated element or attribute or `null` if the element does not have declaration or if no namespace information is available.

### isDerivedFrom

    public boolean isDerivedFrom(java.lang.String typeNamespaceArg,
                                 java.lang.String typeNameArg,
                                 int derivationMethod)

  The method checks if this `TypeInfo` derives from the specified ancestor type.
  Parameters:
    `typeNamespaceArg` - the namespace of the ancestor type.
    `typeNameArg` - the name of the ancestor type.
    `derivationMethod` - 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.
  Returns:
    `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`.

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1999-2004 Apache XML Project. All Rights Reserved.