congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
NamespaceMappings
Code IndexAdd Tabnine to your IDE (free)

How to use
NamespaceMappings
in
org.apache.xml.serializer

Best Java code snippets using org.apache.xml.serializer.NamespaceMappings (Showing top 20 results out of 315)

Refine searchRefine arrow

  • Hashtable
  • ContentHandler
origin: robovm/robovm

/**
 * This method makes a clone of this object.
 *
 */
public Object clone() throws CloneNotSupportedException {
  NamespaceMappings clone = new NamespaceMappings();
  clone.m_nodeStack = (NamespaceMappings.Stack) m_nodeStack.clone();        
  clone.count = this.count;
  clone.m_namespaces = (Hashtable) m_namespaces.clone();
  
  clone.count = count;
  return clone;
  
}

origin: robovm/robovm

String uri = m_prefixMap.lookupNamespace(prefixFromRawName);
if (uri != null && uri.equals(ns))
String prefix = m_prefixMap.lookupPrefix(ns);
if (prefix == null)
  prefix = m_prefixMap.generateNextPrefix();
  this.startPrefixMapping(prefix, ns, false);
  this.addAttribute(
origin: robovm/robovm

MappingRecord getMappingFromURI(String uri)
{
  MappingRecord foundMap = null;
  Enumeration prefixes = m_namespaces.keys();
  while (prefixes.hasMoreElements())
  {
    String prefix = (String) prefixes.nextElement();
    MappingRecord map2 = getMappingFromPrefix(prefix);
    if (map2 != null && (map2.m_uri).equals(uri))
    {
      foundMap = map2;
      break;
    }
  }
  return foundMap;
}
origin: robovm/robovm

final void reset()
{
  this.count = 0;
  this.m_namespaces.clear();
  this.m_nodeStack.clear();        
  
  initNamespaces();
}

origin: robovm/robovm

/**
 * Given a namespace uri, and the namespaces mappings for the 
 * current element, return the current prefix for that uri.
 * 
 * @param uri the namespace URI to be search for
 * @return an existing prefix that maps to the given URI, null if no prefix
 * maps to the given namespace URI.
 */
public String lookupPrefix(String uri)
{
  String foundPrefix = null;
  Enumeration prefixes = m_namespaces.keys();
  while (prefixes.hasMoreElements())
  {
    String prefix = (String) prefixes.nextElement();
    String uri2 = lookupNamespace(prefix);
    if (uri2 != null && uri2.equals(uri))
    {
      foundPrefix = prefix;
      break;
    }
  }
  return foundPrefix;
}

origin: robovm/robovm

/**
 * Undeclare the namespace that is currently pointed to by a given
 * prefix. Inform SAX handler if prefix was previously mapped.
 */
protected boolean popNamespace(String prefix)
{
  try
  {
    if (m_prefixMap.popNamespace(prefix))
    {
      m_saxHandler.endPrefixMapping(prefix);
      return true;
    }
  }
  catch (SAXException e)
  {
    // falls through
  }
  return false;
}
origin: plutext/docx4j

pushed = m_prefixMap.pushNamespace(prefix, uri, pushDepth);
  m_saxHandler.startPrefixMapping(prefix,uri);
origin: robovm/robovm

Stack prefixStack = getPrefixStack(prefix);
MappingRecord nm2 = (MappingRecord) prefixStack.peek();
if (nm1 == nm2)
      saxHandler.endPrefixMapping(prefix);
origin: xalan/xalan

  NamespaceMappings nm = new NamespaceMappings();
for (int i = 0; i < length; i++) {
final Node attr = map.item(i);
        String newPrefix = nm.lookupPrefix(uriAttr);
        if (newPrefix == null) 
          newPrefix = nm.generateNextPrefix();
  prefix = (colon > 0) ? qnameAttr.substring(0, colon) 
    : newPrefix;
origin: robovm/robovm

NamespaceMappings.MappingRecord existing_mapping = m_prefixMap.getMappingFromPrefix(prefix);
  prefix = m_prefixMap.lookupPrefix(uri);
  if (prefix == null)
    prefix = m_prefixMap.generateNextPrefix();
origin: robovm/robovm

/**
 * Returns the URI of prefix (if any)
 * 
 * @param prefix the prefix whose URI is searched for
 * @return the namespace URI currently associated with the
 * prefix, null if the prefix is undefined.
 */
public String getNamespaceURIFromPrefix(String prefix)
{
  String uri = null;
  if (m_prefixMap != null)
    uri = m_prefixMap.lookupNamespace(prefix);
  return uri;
}
origin: plutext/docx4j

prefix = m_prefixMap.lookupPrefix(uri);
if (prefix == null)
  prefix = m_prefixMap.generateNextPrefix();
origin: robovm/robovm

/**
 * Default constructor.
 */
public ToHTMLStream()
{
  super();
  // we are just constructing this thing, no output properties
  // have been used, so we will set the right default for
  // indenting anyways
  m_doIndent = true; 
  m_charInfo = m_htmlcharInfo;
  // initialize namespaces
  m_prefixMap = new NamespaceMappings();
}
origin: robovm/robovm

/**
 * From XSLTC
 * Declare a prefix to point to a namespace URI. Inform SAX handler
 * if this is a new prefix mapping.
 */
protected boolean pushNamespace(String prefix, String uri)
{
  try
  {
    if (m_prefixMap.pushNamespace(
      prefix, uri, m_elemContext.m_currentElemDepth))
    {
      startPrefixMapping(prefix, uri);
      return true;
    }
  }
  catch (SAXException e)
  {
    // falls through
  }
  return false;
}
/**
origin: robovm/robovm

/**
 * This method initializes the namespace object with appropriate stacks
 * and predefines a few prefix/uri pairs which always exist.
 */
private void initNamespaces()
{
  // The initial prefix mappings will never be deleted because they are at element depth -1 
  // (a kludge)
  
  // Define the default namespace (initially maps to "" uri)
  Stack stack;
  MappingRecord nn;
  nn = new MappingRecord(EMPTYSTRING, EMPTYSTRING, -1);
  stack = createPrefixStack(EMPTYSTRING);
  stack.push(nn);
  // define "xml" namespace
  nn = new MappingRecord(XML_PREFIX, "http://www.w3.org/XML/1998/namespace", -1);
  stack = createPrefixStack(XML_PREFIX);
  stack.push(nn);
}
origin: robovm/robovm

/**
 * Returns the prefix currently pointing to the given URI (if any).
 * @param namespaceURI the uri of the namespace in question
 * @return a prefix pointing to the given URI (if any).
 * @see ExtendedContentHandler#getPrefix(String)
 */
public String getPrefix(String namespaceURI)
{
  String prefix = m_prefixMap.lookupPrefix(namespaceURI);
  return prefix;
}
origin: robovm/robovm

prefix = prefixMapping.generateNextPrefix();
origin: robovm/robovm

/**
 * Undeclare the namespace that is currently pointed to by a given prefix
 */
boolean popNamespace(String prefix)
{
  // Prefixes "xml" and "xmlns" cannot be redefined
  if (prefix.startsWith(XML_PREFIX))
  {
    return false;
  }
  Stack stack;
  if ((stack = getPrefixStack(prefix)) != null)
  {
    stack.pop();
    return true;
  }
  return false;
}
origin: robovm/robovm

/**
 * Default constructor
 * @see java.lang.Object#Object()
 */
public NamespaceMappings()
{
  initNamespaces();
}
origin: plutext/docx4j

public Docx4jMappingRecord(NamespaceMappings namespaceMappings, String prefix) {
  
  MappingRecord mappingRecord = namespaceMappings.getMappingFromPrefix(prefix);
  m_prefix = mappingRecord.m_prefix;
  m_uri = mappingRecord.m_uri;
  m_declarationDepth = mappingRecord.m_declarationDepth;
}
org.apache.xml.serializerNamespaceMappings

Javadoc

This class keeps track of the currently defined namespaces. Conceptually the prefix/uri/depth triplets are pushed on a stack pushed on a stack. The depth indicates the nesting depth of the element for which the mapping was made.

For example:

 
 
 
 
 
 
 
 
 
When the element is encounted the prefix "p1" associated with uri "def" is pushed on the stack with depth 1. When the first is encountered "p2" and "ghi" are pushed with depth 2. When the is encountered "p3" and "jkl" are pushed with depth 3. When occurs the popNamespaces(3) will pop "p3"/"jkl" off the stack. Of course popNamespaces(2) would pop anything with depth 2 or greater. So prefix/uri pairs are pushed and poped off the stack as elements are processed. At any given moment of processing the currently visible prefixes are on the stack and a prefix can be found given a uri, or a uri can be found given a prefix. This class is intended for internal use only. However, it is made public because other packages require it.

Most used methods

  • <init>
    Default constructor
  • generateNextPrefix
    Generate a new namespace prefix ( ns0, ns1 ...) not used before
  • lookupNamespace
    Use a namespace prefix to lookup a namespace URI.
  • lookupPrefix
    Given a namespace uri, and the namespaces mappings for the current element, return the current prefi
  • getMappingFromPrefix
  • pushNamespace
    Declare a mapping of a prefix to namespace URI at the given element depth.
  • createPrefixStack
    A more type-safe way of saving stacks under the m_namespaces Hashtable.
  • getPrefixStack
    A more type-safe way to get a stack of prefix mappings from the Hashtable m_namespaces (this is the
  • initNamespaces
    This method initializes the namespace object with appropriate stacks and predefines a few prefix/uri
  • popNamespace
    Undeclare the namespace that is currently pointed to by a given prefix
  • popNamespaces
    Pop, or undeclare all namespace definitions that are currently declared at the given element depth,
  • reset
  • popNamespaces,
  • reset,
  • clone

Popular in Java

  • Finding current android device location
  • setRequestProperty (URLConnection)
  • startActivity (Activity)
  • findViewById (Activity)
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now