01: /*
02: * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
03: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04: *
05: * This code is free software; you can redistribute it and/or modify it
06: * under the terms of the GNU General Public License version 2 only, as
07: * published by the Free Software Foundation. Sun designates this
08: * particular file as subject to the "Classpath" exception as provided
09: * by Sun in the LICENSE file that accompanied this code.
10: *
11: * This code is distributed in the hope that it will be useful, but WITHOUT
12: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14: * version 2 for more details (a copy is included in the LICENSE file that
15: * accompanied this code).
16: *
17: * You should have received a copy of the GNU General Public License version
18: * 2 along with this work; if not, write to the Free Software Foundation,
19: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20: *
21: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22: * CA 95054 USA or visit www.sun.com if you need additional information or
23: * have any questions.
24: */
25:
26: package com.sun.xml.internal.xsom;
27:
28: import java.util.Iterator;
29: import java.util.Collection;
30:
31: import com.sun.xml.internal.xsom.visitor.XSWildcardFunction;
32: import com.sun.xml.internal.xsom.visitor.XSWildcardVisitor;
33:
34: /**
35: * Wildcard schema component (used for both attribute wildcard
36: * and element wildcard.)
37: *
38: * XSWildcard interface can always be downcasted to either
39: * Any, Other, or Union.
40: */
41: public interface XSWildcard extends XSComponent, XSTerm {
42: static final int LAX = 1;
43: static final int STRTICT = 2;
44: static final int SKIP = 3;
45:
46: /**
47: * Gets the processing mode.
48: *
49: * @return
50: * Either LAX, STRICT, or SKIP.
51: */
52: int getMode();
53:
54: /**
55: * Returns true if the specified namespace URI is valid
56: * wrt this wildcard.
57: *
58: * @param namespaceURI
59: * Use the empty string to test the default no-namespace.
60: */
61: boolean acceptsNamespace(String namespaceURI);
62:
63: /** Visitor support. */
64: void visit(XSWildcardVisitor visitor);
65:
66: <T> T apply(XSWildcardFunction<T> function);
67:
68: /**
69: * <code>##any</code> wildcard.
70: */
71: interface Any extends XSWildcard {
72: }
73:
74: /**
75: * <code>##other</code> wildcard.
76: */
77: interface Other extends XSWildcard {
78: /**
79: * Gets the namespace URI excluded from this wildcard.
80: */
81: String getOtherNamespace();
82: }
83:
84: /**
85: * Wildcard of a set of namespace URIs.
86: */
87: interface Union extends XSWildcard {
88: /**
89: * Short for <code>getNamespaces().iterator()</code>
90: */
91: Iterator<String> iterateNamespaces();
92:
93: /**
94: * Read-only list of namespace URIs.
95: */
96: Collection<String> getNamespaces();
97: }
98: }
|