org.apache.xerces.xinclude

Class MultipleScopeNamespaceSupport

Implemented Interfaces:
org.apache.xerces.xni.NamespaceContext
Known Direct Subclasses:
XIncludeNamespaceSupport

public class MultipleScopeNamespaceSupport
extends NamespaceSupport

This implementation of NamespaceContext has the ability to maintain multiple scopes of namespace/prefix bindings. This is useful in situations when it is not always appropriate for elements to inherit the namespace bindings of their ancestors (such as included elements in XInclude). When searching for a URI to match a prefix, or a prefix to match a URI, it is searched for in the current context, then the ancestors of the current context, up to the beginning of the current scope. Other scopes are not searched.
Version:
$Id: MultipleScopeNamespaceSupport.java 320226 2005-02-17 06:08:16Z mrglavas $
Author:
Peter McCracken, IBM

Nested Class Summary

Nested classes/interfaces inherited from class org.apache.xerces.util.NamespaceSupport

NamespaceSupport.Prefixes

Field Summary

protected int
fCurrentScope
protected int[]
fScope

Fields inherited from class org.apache.xerces.util.NamespaceSupport

fContext, fCurrentContext, fNamespace, fNamespaceSize, fPrefixes

Fields inherited from interface org.apache.xerces.xni.NamespaceContext

XMLNS_URI, XML_URI

Constructor Summary

MultipleScopeNamespaceSupport()
MultipleScopeNamespaceSupport(org.apache.xerces.xni.NamespaceContext context)

Method Summary

Enumeration
getAllPrefixes()
String
getPrefix(String uri)
String
getPrefix(String uri, int context)
String
getPrefix(String uri, int start, int end)
int
getScopeForContext(int context)
String
getURI(String prefix)
String
getURI(String prefix, int context)
String
getURI(String prefix, int start, int end)
void
popScope()
Pops the current scope.
void
pushScope()
Begins a new scope.
void
reset()
Only resets the current scope -- all namespaces defined in lower scopes remain valid after a call to reset.

Methods inherited from class org.apache.xerces.util.NamespaceSupport

containsPrefix, declarePrefix, getAllPrefixes, getDeclaredPrefixAt, getDeclaredPrefixCount, getPrefix, getURI, popContext, pushContext, reset

Field Details

fCurrentScope

protected int fCurrentScope

fScope

protected int[] fScope

Constructor Details

MultipleScopeNamespaceSupport

public MultipleScopeNamespaceSupport()

MultipleScopeNamespaceSupport

public MultipleScopeNamespaceSupport(org.apache.xerces.xni.NamespaceContext context)
Parameters:
context -

Method Details

getAllPrefixes

public Enumeration getAllPrefixes()
Specified by:
getAllPrefixes in interface org.apache.xerces.xni.NamespaceContext
Overrides:
getAllPrefixes in interface NamespaceSupport

getPrefix

public String getPrefix(String uri)
Specified by:
getPrefix in interface org.apache.xerces.xni.NamespaceContext
Overrides:
getPrefix in interface NamespaceSupport

getPrefix

public String getPrefix(String uri,
                        int context)

getPrefix

public String getPrefix(String uri,
                        int start,
                        int end)

getScopeForContext

public int getScopeForContext(int context)

getURI

public String getURI(String prefix)
Specified by:
getURI in interface org.apache.xerces.xni.NamespaceContext
Overrides:
getURI in interface NamespaceSupport

getURI

public String getURI(String prefix,
                     int context)

getURI

public String getURI(String prefix,
                     int start,
                     int end)

popScope

public void popScope()
Pops the current scope. The namespace bindings from the new current scope are then used for searching for namespaces and prefixes.

pushScope

public void pushScope()
Begins a new scope. None of the previous namespace bindings will be used, until the new scope is popped with popScope()

reset

public void reset()
Only resets the current scope -- all namespaces defined in lower scopes remain valid after a call to reset.
Specified by:
reset in interface org.apache.xerces.xni.NamespaceContext
Overrides:
reset in interface NamespaceSupport

Copyright B) 1999-2006 The Apache Software Foundation. All Rights Reserved.