2
* Copyright (c) 2003 World Wide Web Consortium,
4
* (Massachusetts Institute of Technology, European Research Consortium for
5
* Informatics and Mathematics, Keio University). All Rights Reserved. This
6
* work is distributed under the W3C(r) Software License [1] in the hope that
7
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
8
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
* [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
16
* The <code>TypeInfo</code> interface represent a type referenced from
17
* <code>Element</code> or <code>Attr</code> nodes, specified in the schemas
18
* associated with the document. The type is a pair of a namespace URI and
19
* name properties, and depends on the document's schema.
20
* <p> If the document's schema is an XML DTD [<a href='http://www.w3.org/TR/2000/REC-xml-20001006'>XML 1.0</a>], the values
21
* are computed as follows:
23
* <li> If this type is referenced from an
24
* <code>Attr</code> node, <code>typeNamespace</code> is <code>null</code>
25
* and <code>typeName</code> represents the <b>[attribute type]</b> property in the [<a href='http://www.w3.org/TR/2001/REC-xml-infoset-20011024/'>XML Information Set</a>]
26
* . If there is no declaration for the attribute, <code>typeName</code> is
29
* <li> If this type is referenced from an
30
* <code>Element</code> node, the <code>typeNamespace</code> and
31
* <code>typeName</code> are <code>null</code>.
34
* <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>]
35
* , the values are computed as follows using the post-schema-validation
36
* infoset contributions (also called PSVI contributions):
38
* <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
39
* available, otherwise <code>null</code>.
40
* <p ><b>Note:</b> At the time of writing, the XML Schema specification does
41
* not require exposing the declared type. Thus, DOM implementations might
42
* choose not to provide type information if validity is not valid.
44
* <li> If the <b>[validity]</b> property exists and is <em>"valid"</em>:
46
* <li> If <b>[member type definition]</b> exists:
48
* <li>If {name} is not absent, then expose {name} and {target
49
* namespace} properties of the <b>[member type definition]</b> property;
51
* <li>Otherwise, expose the namespace and local name of the
52
* corresponding anonymous type name.
56
* <li> If the <b>[type definition]</b> property exists:
58
* <li>If {name} is not absent, then expose {name} and {target
59
* namespace} properties of the <b>[type definition]</b> property;
61
* <li>Otherwise, expose the namespace and local name of the
62
* corresponding anonymous type name.
66
* <li> If the <b>[member type definition anonymous]</b> exists:
68
* <li>If it is false, then expose <b>[member type definition name]</b> and <b>[member type definition namespace]</b> properties;
70
* <li>Otherwise, expose the namespace and local name of the
71
* corresponding anonymous type name.
75
* <li> If the <b>[type definition anonymous]</b> exists:
77
* <li>If it is false, then expose <b>[type definition name]</b> and <b>[type definition namespace]</b> properties;
79
* <li>Otherwise, expose the namespace and local name of the
80
* corresponding anonymous type name.
87
* <p ><b>Note:</b> Other schema languages are outside the scope of the W3C
88
* and therefore should define how to represent their type systems using
89
* <code>TypeInfo</code>.
90
* <p>See also the <a href='http://www.w3.org/TR/2003/CR-DOM-Level-3-Core-20031107'>Document Object Model (DOM) Level 3 Core Specification</a>.
93
public interface TypeInfo {
95
* The name of a type declared for the associated element or attribute,
96
* or <code>null</code> if unknown.
98
public String getTypeName();
101
* The namespace of the type declared for the associated element or
102
* attribute or <code>null</code> if the element does not have
103
* declaration or if no namespace information is available.
105
public String getTypeNamespace();
109
* 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>]
110
* , this constant represents the derivation by <a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#key-typeRestriction'>
111
* restriction</a> if complex types are involved, or a <a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-restriction'>
112
* restriction</a> if simple types are involved.
114
public static final int DERIVATION_RESTRICTION = 0x00000001;
116
* 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>]
117
* , this constant represents the derivation by <a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#key-typeExtension'>
118
* extension</a> if complex types are involved.
120
public static final int DERIVATION_EXTENSION = 0x00000002;
122
* 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>]
123
* , this constant represents the <a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-union'>
124
* union</a> if simple types are involved.
126
public static final int DERIVATION_UNION = 0x00000004;
128
* 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>]
129
* , this constant represents the <a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-list'>list</a> if simple types are involved.
131
public static final int DERIVATION_LIST = 0x00000008;
134
* The method checks if this <code>TypeInfo</code> derives from the
135
* specified ancestor type.
136
* @param typeNamespaceArg the namespace of the ancestor type.
137
* @param typeNameArg the name of the ancestor type.
138
* @param derivationMethod the type of derivation and conditions applied
139
* between two types, as described in the list of constants provided
140
* in this interface. Note that those constants:
142
* <li> are only defined if
143
* the document's schema is an XML Schema;
145
* <li> could be combined if XML
146
* Schema types are involved.
149
* <code>TypeInfo.DERIVATION_EXTENSION</code> only applies to XML
150
* Schema complex types.
152
* </ul> The value <code>0x00000000</code> represents
153
* any kind of derivation method.
154
* @return <code>true</code> if the specified type is an ancestor
155
* according to the derivation parameter, <code>false</code>
156
* otherwise. If the document's schema is a DTD or no schema is
157
* associated with the document, this method will always return
158
* <code>false</code>.
160
public boolean isDerivedFrom(String typeNamespaceArg,
162
int derivationMethod);