Qizx/open API

net.axyana.qizxopen.util
Class NSPrefixMapping

java.lang.Object
  extended bynet.axyana.qizxopen.util.NSPrefixMapping
All Implemented Interfaces:
java.io.Serializable

public class NSPrefixMapping
extends java.lang.Object
implements java.io.Serializable

Mapping of Namespace prefixes. Maintains a stack of prefix/Namespace pairs and provides lookup methods.

See Also:
Serialized Form

Field Summary
static NSPrefixMapping std
          A predefined prefix/NS table for XQuery.
 
Constructor Summary
NSPrefixMapping()
           
 
Method Summary
 void addMapping(java.lang.String prefix, Namespace ns)
          Pushes a prefix/Namespace mapping.
 void addMapping(java.lang.String prefix, java.lang.String uri)
          Pushes a prefix/Namespace-URI mapping.
 Namespace convertToNamespace(java.lang.String prefix)
          Returns the most recent Namespace matching the prefix.
 java.lang.String convertToPrefix(Namespace ns)
          Returns the most recent prefix matching the Namespace.
 NSPrefixMapping copy()
           
 QName expandName(java.lang.String name)
          Converts a prefixed name into a QName, using the mappings defined here.
static java.lang.String extractLocalName(java.lang.String name)
          Extracts the local-name of a qualified name.
static java.lang.String extractPrefix(java.lang.String name)
          Extracts the prefix of a qualified name.
 Namespace getLastNamespace(int rankFromTop)
          Returns a declared namespace.
 java.lang.String getLastPrefix(int rankFromTop)
          Returns a declared prefix.
 int getMappingCount()
          returns the number of defined mappings.
 java.lang.String prefixedName(QName name)
          Converts a QName into a prefixed name.
 void removeMappings(int count)
          Pops N mappings.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

std

public static final NSPrefixMapping std
A predefined prefix/NS table for XQuery.

Constructor Detail

NSPrefixMapping

public NSPrefixMapping()
Method Detail

copy

public NSPrefixMapping copy()

addMapping

public void addMapping(java.lang.String prefix,
                       java.lang.String uri)
Pushes a prefix/Namespace-URI mapping.


addMapping

public void addMapping(java.lang.String prefix,
                       Namespace ns)
Pushes a prefix/Namespace mapping.


getMappingCount

public int getMappingCount()
returns the number of defined mappings.


removeMappings

public void removeMappings(int count)
Pops N mappings.


convertToNamespace

public Namespace convertToNamespace(java.lang.String prefix)
Returns the most recent Namespace matching the prefix.


convertToPrefix

public java.lang.String convertToPrefix(Namespace ns)
Returns the most recent prefix matching the Namespace.


extractPrefix

public static java.lang.String extractPrefix(java.lang.String name)
Extracts the prefix of a qualified name.


extractLocalName

public static java.lang.String extractLocalName(java.lang.String name)
Extracts the local-name of a qualified name.


expandName

public QName expandName(java.lang.String name)
Converts a prefixed name into a QName, using the mappings defined here.

Returns:
null if the prefix is not defined, the expanded QName otherwise.

prefixedName

public java.lang.String prefixedName(QName name)
Converts a QName into a prefixed name. If no suitable prefix is found, return the QName in the form {namespaceURI}localName.


getLastPrefix

public java.lang.String getLastPrefix(int rankFromTop)
Returns a declared prefix. The last declared prefix has rank 1, the previous 2 etc.


getLastNamespace

public Namespace getLastNamespace(int rankFromTop)
Returns a declared namespace. The last declared namespace has rank 1, the previous 2 etc.


© 2005 Axyana Software