Free Trial - Stylus Studio, The World's Best XML IDE!


com.saxonica.importer
Class SchemaNamespaceContext

java.lang.Object
  |
  +--com.saxonica.importer.SchemaNamespaceContext
All Implemented Interfaces:
NamespaceResolver

public final class SchemaNamespaceContext
extends java.lang.Object
implements NamespaceResolver

A class for handling Namespace declaration and scoping


Constructor Summary
SchemaNamespaceContext()
          Creates a new NamespaceContext instance
SchemaNamespaceContext(SchemaNamespaceContext parent)
           
 
Method Summary
 void addNamespace(java.lang.String prefix, java.lang.String uri)
          Adds the given namespace declaration to this Namespaces
 SchemaNamespaceContext createNamespaceContext()
          Creates a new NamespaceContext instance with this context as the parent
 int getFingerprint(java.lang.String qname, boolean useDefault, NamePool pool)
          Use this NamespaceContext to resolve a lexical QName
 java.lang.String getNamespaceURI(java.lang.String prefix)
          Returns the Namespace URI associated with the given prefix
 SchemaNamespaceContext getParent()
          Returns the parent Namespaces for this Namespaces instance.
 java.lang.String getURIForPrefix(java.lang.String prefix, boolean useDefault)
          Get the namespace URI corresponding to a given prefix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemaNamespaceContext

public SchemaNamespaceContext()
Creates a new NamespaceContext instance


SchemaNamespaceContext

public SchemaNamespaceContext(SchemaNamespaceContext parent)
Method Detail

addNamespace

public void addNamespace(java.lang.String prefix,
                         java.lang.String uri)
Adds the given namespace declaration to this Namespaces

Parameters:
prefix - the namespace prefix
uri - the namespace URI to be associated with the given prefix

createNamespaceContext

public SchemaNamespaceContext createNamespaceContext()
Creates a new NamespaceContext instance with this context as the parent


getNamespaceURI

public java.lang.String getNamespaceURI(java.lang.String prefix)
Returns the Namespace URI associated with the given prefix

Parameters:
prefix - the namespace prefix to lookup
Returns:
the namespace URI associated with the given prefix

getParent

public SchemaNamespaceContext getParent()
Returns the parent Namespaces for this Namespaces instance.

Returns:
the parent Namespaces for this Namespaces instance.

getURIForPrefix

public java.lang.String getURIForPrefix(java.lang.String prefix,
                                        boolean useDefault)
Get the namespace URI corresponding to a given prefix. Return null if the prefix is not in scope.

Specified by:
getURIForPrefix in interface NamespaceResolver
Parameters:
prefix - the namespace prefix
useDefault - true if the default namespace is to be used when the prefix is ""
Returns:
the uri for the namespace, or null if the prefix is not in scope

getFingerprint

public int getFingerprint(java.lang.String qname,
                          boolean useDefault,
                          NamePool pool)
                   throws XPathException
Use this NamespaceContext to resolve a lexical QName

Specified by:
getFingerprint in interface NamespaceResolver
Parameters:
qname - the lexical QName; this must have already been lexically validated
useDefault - true if the default namespace is to be used to resolve an unprefixed QName
pool - the NamePool to be used
Returns:
the integer fingerprint that uniquely identifies this name
Throws:
XPathException.Dynamic - if the string is not a valid lexical QName or if the namespace prefix has not been declared
XPathException


Stylus Studio features integrated development and debugging support for Saxon in the XQuery editor and XSLT editor.