001 package org.relaxng.datatype;
002
003 /**
004 * An interface that must be implemented by caller to
005 * provide context information that is necessary to
006 * perform validation of some Datatypes.
007 *
008 * @author <a href="mailto:jjc@jclark.com">James Clark</a>
009 * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
010 */
011 public interface ValidationContext {
012
013 /**
014 * Resolves a namespace prefix to the corresponding namespace URI.
015 *
016 * This method is used for validating the QName type, for example.
017 *
018 * <p>
019 * If the prefix is "" (empty string), it indicates
020 * an unprefixed value. The callee
021 * should resolve it as for an unprefixed
022 * element, rather than for an unprefixed attribute.
023 *
024 * <p>
025 * If the prefix is "xml", then the callee must resolve
026 * this prefix into "http://www.w3.org/XML/1998/namespace",
027 * as defined in the XML Namespaces Recommendation.
028 *
029 * @return
030 * namespace URI of this prefix.
031 * If the specified prefix is not declared,
032 * the implementation must return null.
033 */
034 String resolveNamespacePrefix( String prefix );
035
036 /**
037 * Returns the base URI of the context. The null string may be returned
038 * if no base URI is known.
039 */
040 String getBaseUri();
041
042 /**
043 * Checks if an unparsed entity is declared with the
044 * specified name.
045 *
046 * @return
047 * true
048 * if the DTD has an unparsed entity declaration for
049 * the specified name.
050 * false
051 * otherwise.
052 */
053 boolean isUnparsedEntity( String entityName );
054
055 /**
056 * Checks if a notation is declared with the
057 * specified name.
058 *
059 * @return
060 * true
061 * if the DTD has a notation declaration for the specified name.
062 * false
063 * otherwise.
064 */
065 boolean isNotation( String notationName );
066 }