dk.brics.xact.operations
Class NamespacePrefixTracker

java.lang.Object
  extended by dk.brics.xact.operations.NamespacePrefixTracker

 class NamespacePrefixTracker
extends Object

Manages namespace prefixes during construction of ordinary XML output from XML templates.


Constructor Summary
NamespacePrefixTracker()
          Constructs a new namespace prefix tracker.
 
Method Summary
 void addDecl(String prefix, String namespace)
          Adds a namespace declaration.
 void ensureDeclared(String namespace, Map<String,String> nsdecls)
          Ensures that the given namespace is declared.
 Stack<String> getPrefix(String n)
          Returns the prefix for the given namespace.
 void popNamespaceDeclarations(Map<String,String> nsdecls)
          Pops the given namespace declarations.
 Map<String,String> pushNamespaceDeclarations(Element n)
          Adds the list of namespaces declared by the element to the namespace tracker.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamespacePrefixTracker

public NamespacePrefixTracker()
Constructs a new namespace prefix tracker.

Method Detail

addDecl

public void addDecl(String prefix,
                    String namespace)
Adds a namespace declaration.


ensureDeclared

public void ensureDeclared(String namespace,
                           Map<String,String> nsdecls)
Ensures that the given namespace is declared.

Parameters:
nsdecls - if a new declaration is needed, it is also added here

getPrefix

public Stack<String> getPrefix(String n)
Returns the prefix for the given namespace.


popNamespaceDeclarations

public void popNamespaceDeclarations(Map<String,String> nsdecls)
Pops the given namespace declarations.


pushNamespaceDeclarations

public Map<String,String> pushNamespaceDeclarations(Element n)
Adds the list of namespaces declared by the element to the namespace tracker. Even if declared on this element, declarations will be ignored (not pushed) if a the same namespace has already been pushed with the same prefix in an ancestor and this declaration is still active.

Returns:
all the declarations that have been added


Copyright © 2005-2011 Aarhus University.