~ubuntu-branches/ubuntu/karmic/libxerces2-java/karmic

« back to all changes in this revision

Viewing changes to src/dom3/org/w3c/dom/TypeInfo.java

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Gybas
  • Date: 2004-06-06 18:00:26 UTC
  • Revision ID: james.westby@ubuntu.com-20040606180026-a3vh56uc95hjbyfh
Tags: upstream-2.6.2
ImportĀ upstreamĀ versionĀ 2.6.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2003 World Wide Web Consortium,
 
3
 *
 
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.
 
9
 *
 
10
 * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
 
11
 */
 
12
 
 
13
package org.w3c.dom;
 
14
 
 
15
/**
 
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: 
 
22
 * <ul>
 
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 
 
27
 * <code>null</code>. 
 
28
 * </li>
 
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>. 
 
32
 * </li>
 
33
 * </ul>
 
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): 
 
37
 * <ul>
 
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. 
 
43
 * </li>
 
44
 * <li> If the <b>[validity]</b> property exists and is <em>"valid"</em>: 
 
45
 * <ol>
 
46
 * <li> If <b>[member type definition]</b> exists: 
 
47
 * <ol>
 
48
 * <li>If {name} is not absent, then expose {name} and {target 
 
49
 * namespace} properties of the <b>[member type definition]</b> property;
 
50
 * </li>
 
51
 * <li>Otherwise, expose the namespace and local name of the 
 
52
 * corresponding anonymous type name.
 
53
 * </li>
 
54
 * </ol>
 
55
 * </li>
 
56
 * <li> If the <b>[type definition]</b> property exists: 
 
57
 * <ol>
 
58
 * <li>If {name} is not absent, then expose {name} and {target 
 
59
 * namespace} properties of the <b>[type definition]</b> property;
 
60
 * </li>
 
61
 * <li>Otherwise, expose the namespace and local name of the 
 
62
 * corresponding anonymous type name.
 
63
 * </li>
 
64
 * </ol> 
 
65
 * </li>
 
66
 * <li> If the <b>[member type definition anonymous]</b> exists: 
 
67
 * <ol>
 
68
 * <li>If it is false, then expose <b>[member type definition name]</b> and <b>[member type definition namespace]</b> properties;
 
69
 * </li>
 
70
 * <li>Otherwise, expose the namespace and local name of the 
 
71
 * corresponding anonymous type name.
 
72
 * </li>
 
73
 * </ol> 
 
74
 * </li>
 
75
 * <li> If the <b>[type definition anonymous]</b> exists: 
 
76
 * <ol>
 
77
 * <li>If it is false, then expose <b>[type definition name]</b> and <b>[type definition namespace]</b> properties;
 
78
 * </li>
 
79
 * <li>Otherwise, expose the namespace and local name of the 
 
80
 * corresponding anonymous type name.
 
81
 * </li>
 
82
 * </ol> 
 
83
 * </li>
 
84
 * </ol>
 
85
 * </li>
 
86
 * </ul>
 
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>.
 
91
 * @since DOM Level 3
 
92
 */
 
93
public interface TypeInfo {
 
94
    /**
 
95
     *  The name of a type declared for the associated element or attribute, 
 
96
     * or <code>null</code> if unknown. 
 
97
     */
 
98
    public String getTypeName();
 
99
 
 
100
    /**
 
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. 
 
104
     */
 
105
    public String getTypeNamespace();
 
106
 
 
107
    // DerivationMethods
 
108
    /**
 
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. 
 
113
     */
 
114
    public static final int DERIVATION_RESTRICTION    = 0x00000001;
 
115
    /**
 
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. 
 
119
     */
 
120
    public static final int DERIVATION_EXTENSION      = 0x00000002;
 
121
    /**
 
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. 
 
125
     */
 
126
    public static final int DERIVATION_UNION          = 0x00000004;
 
127
    /**
 
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. 
 
130
     */
 
131
    public static final int DERIVATION_LIST           = 0x00000008;
 
132
 
 
133
    /**
 
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: 
 
141
     * <ul>
 
142
     * <li> are only defined if 
 
143
     *   the document's schema is an XML Schema; 
 
144
     * </li>
 
145
     * <li> could be combined if XML 
 
146
     *   Schema types are involved. 
 
147
     * </li>
 
148
     * <li> 
 
149
     *   <code>TypeInfo.DERIVATION_EXTENSION</code> only applies to XML 
 
150
     *   Schema complex types. 
 
151
     * </li>
 
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>. 
 
159
     */
 
160
    public boolean isDerivedFrom(String typeNamespaceArg, 
 
161
                                 String typeNameArg, 
 
162
                                 int derivationMethod);
 
163
 
 
164
}