286N/A/*
286N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
286N/A *
286N/A * This code is free software; you can redistribute it and/or modify it
286N/A * under the terms of the GNU General Public License version 2 only, as
286N/A * published by the Free Software Foundation. Oracle designates this
286N/A * particular file as subject to the "Classpath" exception as provided
286N/A * by Oracle in the LICENSE file that accompanied this code.
286N/A *
286N/A * This code is distributed in the hope that it will be useful, but WITHOUT
286N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
286N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
286N/A * version 2 for more details (a copy is included in the LICENSE file that
286N/A * accompanied this code).
286N/A *
286N/A * You should have received a copy of the GNU General Public License version
286N/A * 2 along with this work; if not, write to the Free Software Foundation,
286N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
286N/A *
286N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
286N/A * or visit www.oracle.com if you need additional information or have any
286N/A * questions.
286N/A */
286N/A
286N/A/*
286N/A * This file is available under and governed by the GNU General Public
286N/A * License version 2 only, as published by the Free Software Foundation.
286N/A * However, the following notice accompanied the original version of this
286N/A * file and, per its terms, should not be removed:
286N/A *
286N/A * Copyright (c) 2004 World Wide Web Consortium,
286N/A *
286N/A * (Massachusetts Institute of Technology, European Research Consortium for
286N/A * Informatics and Mathematics, Keio University). All Rights Reserved. This
286N/A * work is distributed under the W3C(r) Software License [1] in the hope that
286N/A * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
286N/A * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
286N/A *
286N/A * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
286N/A */
286N/A
286N/Apackage org.w3c.dom;
286N/A
286N/A/**
286N/A * The <code>TypeInfo</code> interface represents a type referenced from
286N/A * <code>Element</code> or <code>Attr</code> nodes, specified in the schemas
286N/A * associated with the document. The type is a pair of a namespace URI and
286N/A * name properties, and depends on the document's schema.
286N/A * <p> If the document's schema is an XML DTD [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>], the values
286N/A * are computed as follows:
286N/A * <ul>
286N/A * <li> If this type is referenced from an
286N/A * <code>Attr</code> node, <code>typeNamespace</code> is
286N/A * <code>"http://www.w3.org/TR/REC-xml"</code> and <code>typeName</code>
286N/A * represents the <b>[attribute type]</b> property in the [<a href='http://www.w3.org/TR/2004/REC-xml-infoset-20040204/'>XML Information Set</a>]
286N/A * . If there is no declaration for the attribute, <code>typeNamespace</code>
286N/A * and <code>typeName</code> are <code>null</code>.
286N/A * </li>
286N/A * <li> If this type is
286N/A * referenced from an <code>Element</code> node, <code>typeNamespace</code>
286N/A * and <code>typeName</code> are <code>null</code>.
286N/A * </li>
286N/A * </ul>
286N/A * <p> If the document's schema is an XML Schema [<a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/'>XML Schema Part 1</a>]
286N/A * , the values are computed as follows using the post-schema-validation
286N/A * infoset contributions (also called PSVI contributions):
286N/A * <ul>
286N/A * <li> If the <b>[validity]</b> property exists AND is <em>"invalid"</em> or <em>"notKnown"</em>: the {target namespace} and {name} properties of the declared type if
286N/A * available, otherwise <code>null</code>.
286N/A * <p ><b>Note:</b> At the time of writing, the XML Schema specification does
286N/A * not require exposing the declared type. Thus, DOM implementations might
286N/A * choose not to provide type information if validity is not valid.
286N/A * </li>
286N/A * <li> If the <b>[validity]</b> property exists and is <em>"valid"</em>:
286N/A * <ol>
286N/A * <li> If <b>[member type definition]</b> exists:
286N/A * <ol>
286N/A * <li>If {name} is not absent, then expose {name} and {target
286N/A * namespace} properties of the <b>[member type definition]</b> property;
286N/A * </li>
286N/A * <li>Otherwise, expose the namespace and local name of the
286N/A * corresponding anonymous type name.
286N/A * </li>
286N/A * </ol>
286N/A * </li>
286N/A * <li> If the <b>[type definition]</b> property exists:
286N/A * <ol>
286N/A * <li>If {name} is not absent, then expose {name} and {target
286N/A * namespace} properties of the <b>[type definition]</b> property;
286N/A * </li>
286N/A * <li>Otherwise, expose the namespace and local name of the
286N/A * corresponding anonymous type name.
286N/A * </li>
286N/A * </ol>
286N/A * </li>
286N/A * <li> If the <b>[member type definition anonymous]</b> exists:
286N/A * <ol>
286N/A * <li>If it is false, then expose <b>[member type definition name]</b> and <b>[member type definition namespace]</b> properties;
286N/A * </li>
286N/A * <li>Otherwise, expose the namespace and local name of the
286N/A * corresponding anonymous type name.
286N/A * </li>
286N/A * </ol>
286N/A * </li>
286N/A * <li> If the <b>[type definition anonymous]</b> exists:
286N/A * <ol>
286N/A * <li>If it is false, then expose <b>[type definition name]</b> and <b>[type definition namespace]</b> properties;
286N/A * </li>
286N/A * <li>Otherwise, expose the namespace and local name of the
286N/A * corresponding anonymous type name.
286N/A * </li>
286N/A * </ol>
286N/A * </li>
286N/A * </ol>
286N/A * </li>
286N/A * </ul>
286N/A * <p ><b>Note:</b> Other schema languages are outside the scope of the W3C
286N/A * and therefore should define how to represent their type systems using
286N/A * <code>TypeInfo</code>.
286N/A * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
286N/A * @since DOM Level 3
286N/A */
286N/Apublic interface TypeInfo {
286N/A /**
286N/A * The name of a type declared for the associated element or attribute,
286N/A * or <code>null</code> if unknown.
286N/A */
286N/A public String getTypeName();
286N/A
286N/A /**
286N/A * The namespace of the type declared for the associated element or
286N/A * attribute or <code>null</code> if the element does not have
286N/A * declaration or if no namespace information is available.
286N/A */
286N/A public String getTypeNamespace();
286N/A
286N/A // DerivationMethods
286N/A /**
286N/A * If the document's schema is an XML Schema [<a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/'>XML Schema Part 1</a>]
286N/A * , this constant represents the derivation by <a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#key-typeRestriction'>
286N/A * restriction</a> if complex types are involved, or a <a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-restriction'>
286N/A * restriction</a> if simple types are involved.
286N/A * <br> The reference type definition is derived by restriction from the
286N/A * other type definition if the other type definition is the same as the
286N/A * reference type definition, or if the other type definition can be
286N/A * reached recursively following the {base type definition} property
286N/A * from the reference type definition, and all the <em>derivation methods</em> involved are restriction.
286N/A */
286N/A public static final int DERIVATION_RESTRICTION = 0x00000001;
286N/A /**
286N/A * If the document's schema is an XML Schema [<a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/'>XML Schema Part 1</a>]
286N/A * , this constant represents the derivation by <a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#key-typeExtension'>
286N/A * extension</a>.
286N/A * <br> The reference type definition is derived by extension from the
286N/A * other type definition if the other type definition can be reached
286N/A * recursively following the {base type definition} property from the
286N/A * reference type definition, and at least one of the <em>derivation methods</em> involved is an extension.
286N/A */
286N/A public static final int DERIVATION_EXTENSION = 0x00000002;
286N/A /**
286N/A * If the document's schema is an XML Schema [<a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/'>XML Schema Part 1</a>]
286N/A * , this constant represents the <a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-union'>
286N/A * union</a> if simple types are involved.
286N/A * <br> The reference type definition is derived by union from the other
286N/A * type definition if there exists two type definitions T1 and T2 such
286N/A * as the reference type definition is derived from T1 by
286N/A * <code>DERIVATION_RESTRICTION</code> or
286N/A * <code>DERIVATION_EXTENSION</code>, T2 is derived from the other type
286N/A * definition by <code>DERIVATION_RESTRICTION</code>, T1 has {variety} <em>union</em>, and one of the {member type definitions} is T2. Note that T1 could be
286N/A * the same as the reference type definition, and T2 could be the same
286N/A * as the other type definition.
286N/A */
286N/A public static final int DERIVATION_UNION = 0x00000004;
286N/A /**
286N/A * If the document's schema is an XML Schema [<a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/'>XML Schema Part 1</a>]
286N/A * , this constant represents the <a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-list'>list</a>.
286N/A * <br> The reference type definition is derived by list from the other
286N/A * type definition if there exists two type definitions T1 and T2 such
286N/A * as the reference type definition is derived from T1 by
286N/A * <code>DERIVATION_RESTRICTION</code> or
286N/A * <code>DERIVATION_EXTENSION</code>, T2 is derived from the other type
286N/A * definition by <code>DERIVATION_RESTRICTION</code>, T1 has {variety} <em>list</em>, and T2 is the {item type definition}. Note that T1 could be the same as
286N/A * the reference type definition, and T2 could be the same as the other
286N/A * type definition.
286N/A */
286N/A public static final int DERIVATION_LIST = 0x00000008;
286N/A
286N/A /**
286N/A * This method returns if there is a derivation between the reference
286N/A * type definition, i.e. the <code>TypeInfo</code> on which the method
286N/A * is being called, and the other type definition, i.e. the one passed
286N/A * as parameters.
286N/A * @param typeNamespaceArg the namespace of the other type definition.
286N/A * @param typeNameArg the name of the other type definition.
286N/A * @param derivationMethod the type of derivation and conditions applied
286N/A * between two types, as described in the list of constants provided
286N/A * in this interface.
286N/A * @return If the document's schema is a DTD or no schema is associated
286N/A * with the document, this method will always return <code>false</code>
286N/A * . If the document's schema is an XML Schema, the method will return
286N/A * <code>true</code> if the reference type definition is derived from
286N/A * the other type definition according to the derivation parameter. If
286N/A * the value of the parameter is <code>0</code> (no bit is set to
286N/A * <code>1</code> for the <code>derivationMethod</code> parameter),
286N/A * the method will return <code>true</code> if the other type
286N/A * definition can be reached by recursing any combination of {base
286N/A * type definition}, {item type definition}, or {member type
286N/A * definitions} from the reference type definition.
286N/A */
286N/A public boolean isDerivedFrom(String typeNamespaceArg,
286N/A String typeNameArg,
286N/A int derivationMethod);
286N/A
286N/A}