01: /*
02: * Copyright 2005 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 org.relaxng.datatype;
27:
28: /**
29: * An interface that must be implemented by caller to
30: * provide context information that is necessary to
31: * perform validation of some Datatypes.
32: *
33: * @author <a href="mailto:jjc@jclark.com">James Clark</a>
34: * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
35: */
36: public interface ValidationContext {
37:
38: /**
39: * Resolves a namespace prefix to the corresponding namespace URI.
40: *
41: * This method is used for validating the QName type, for example.
42: *
43: * <p>
44: * If the prefix is "" (empty string), it indicates
45: * an unprefixed value. The callee
46: * should resolve it as for an unprefixed
47: * element, rather than for an unprefixed attribute.
48: *
49: * <p>
50: * If the prefix is "xml", then the callee must resolve
51: * this prefix into "http://www.w3.org/XML/1998/namespace",
52: * as defined in the XML Namespaces Recommendation.
53: *
54: * @return
55: * namespace URI of this prefix.
56: * If the specified prefix is not declared,
57: * the implementation must return null.
58: */
59: String resolveNamespacePrefix(String prefix);
60:
61: /**
62: * Returns the base URI of the context. The null string may be returned
63: * if no base URI is known.
64: */
65: String getBaseUri();
66:
67: /**
68: * Checks if an unparsed entity is declared with the
69: * specified name.
70: *
71: * @return
72: * true
73: * if the DTD has an unparsed entity declaration for
74: * the specified name.
75: * false
76: * otherwise.
77: */
78: boolean isUnparsedEntity(String entityName);
79:
80: /**
81: * Checks if a notation is declared with the
82: * specified name.
83: *
84: * @return
85: * true
86: * if the DTD has a notation declaration for the specified name.
87: * false
88: * otherwise.
89: */
90: boolean isNotation(String notationName);
91: }
|