org.apache.xerces.util

Class NamespaceSupport

public class NamespaceSupport extends Object implements NamespaceContext

Namespace support for XML document handlers. This class doesn't perform any error checking and assumes that all strings passed as arguments to methods are unique symbols. The SymbolTable class can be used for this purpose.

Version: $Id: NamespaceSupport.java,v 1.20 2005/06/23 05:39:17 mrglavas Exp $

Author: Andy Clark, IBM

Nested Class Summary
protected classNamespaceSupport.Prefixes
Field Summary
protected int[]fContext
Context indexes.
protected intfCurrentContext
The current context.
protected String[]fNamespace
Namespace binding information.
protected intfNamespaceSize
The top of the namespace information array.
protected String[]fPrefixes
Constructor Summary
NamespaceSupport()
Default constructor.
NamespaceSupport(NamespaceContext context)
Constructs a namespace context object and initializes it with the prefixes declared in the specified context.
Method Summary
booleancontainsPrefix(String prefix)
Checks whether a binding or unbinding for the given prefix exists in the context.
booleandeclarePrefix(String prefix, String uri)
EnumerationgetAllPrefixes()
StringgetDeclaredPrefixAt(int index)
intgetDeclaredPrefixCount()
StringgetPrefix(String uri)
StringgetURI(String prefix)
voidpopContext()
voidpushContext()
voidreset()

Field Detail

fContext

protected int[] fContext
Context indexes. This array contains indexes into the namespace information array. The index at the current context is the start index of declared namespace bindings and runs to the size of the namespace information array.

See Also: fNamespaceSize

fCurrentContext

protected int fCurrentContext
The current context.

fNamespace

protected String[] fNamespace
Namespace binding information. This array is composed of a series of tuples containing the namespace binding information: <prefix, uri>. The default size can be set to anything as long as it is a power of 2 greater than 1.

See Also: fNamespaceSize fContext

fNamespaceSize

protected int fNamespaceSize
The top of the namespace information array.

fPrefixes

protected String[] fPrefixes

Constructor Detail

NamespaceSupport

public NamespaceSupport()
Default constructor.

NamespaceSupport

public NamespaceSupport(NamespaceContext context)
Constructs a namespace context object and initializes it with the prefixes declared in the specified context.

Method Detail

containsPrefix

public boolean containsPrefix(String prefix)
Checks whether a binding or unbinding for the given prefix exists in the context.

Parameters: prefix The prefix to look up.

Returns: true if the given prefix exists in the context

declarePrefix

public boolean declarePrefix(String prefix, String uri)

See Also: org.apache.xerces.xni.NamespaceContext#declarePrefix(String, String)

getAllPrefixes

public Enumeration getAllPrefixes()

See Also: org.apache.xerces.xni.NamespaceContext#getAllPrefixes()

getDeclaredPrefixAt

public String getDeclaredPrefixAt(int index)

See Also: org.apache.xerces.xni.NamespaceContext#getDeclaredPrefixAt(int)

getDeclaredPrefixCount

public int getDeclaredPrefixCount()

See Also: org.apache.xerces.xni.NamespaceContext#getDeclaredPrefixCount()

getPrefix

public String getPrefix(String uri)

See Also: org.apache.xerces.xni.NamespaceContext#getPrefix(String)

getURI

public String getURI(String prefix)

See Also: org.apache.xerces.xni.NamespaceContext#getURI(String)

popContext

public void popContext()

See Also: org.apache.xerces.xni.NamespaceContext#popContext()

pushContext

public void pushContext()

See Also: org.apache.xerces.xni.NamespaceContext#pushContext()

reset

public void reset()

See Also: org.apache.xerces.xni.NamespaceContext#reset()

Copyright © 1999-2005 Apache XML Project. All Rights Reserved.