org.apache.xerces.xinclude

Class MultipleScopeNamespaceSupport

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,v 1.8 2005/02/17 06:08:16 mrglavas Exp $

Author: Peter McCracken, IBM

Field Summary
protected intfCurrentScope
protected int[]fScope
Constructor Summary
MultipleScopeNamespaceSupport()
MultipleScopeNamespaceSupport(NamespaceContext context)
Method Summary
EnumerationgetAllPrefixes()
StringgetPrefix(String uri)
StringgetPrefix(String uri, int context)
StringgetPrefix(String uri, int start, int end)
intgetScopeForContext(int context)
StringgetURI(String prefix)
StringgetURI(String prefix, int context)
StringgetURI(String prefix, int start, int end)
voidpopScope()
Pops the current scope.
voidpushScope()
Begins a new scope.
voidreset()
Only resets the current scope -- all namespaces defined in lower scopes remain valid after a call to reset.

Field Detail

fCurrentScope

protected int fCurrentScope

fScope

protected int[] fScope

Constructor Detail

MultipleScopeNamespaceSupport

public MultipleScopeNamespaceSupport()

MultipleScopeNamespaceSupport

public MultipleScopeNamespaceSupport(NamespaceContext context)

Parameters: context

Method Detail

getAllPrefixes

public Enumeration getAllPrefixes()

getPrefix

public String getPrefix(String uri)

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)

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.
Copyright © 1999-2005 Apache XML Project. All Rights Reserved.