Context(Context that, Context newParent) { if (that == null) { copyTables(); return;
return false; } else { currentContext.declarePrefix(prefix, uri); return true;
String parts[], boolean isAttribute) { String myParts[] = currentContext.processName(qName, isAttribute); if (myParts == null) { return null;
String parts[], boolean isAttribute) { String myParts[] = currentContext.processName(qName, isAttribute); if (myParts == null) { return null;
String parts[], boolean isAttribute) { String myParts[] = currentContext.processName(qName, isAttribute); if (myParts == null) { return null;
Context(Context that, Context newParent) { if (that == null) { copyTables(); return;
return false; } else { currentContext.declarePrefix(prefix, uri); return true;
Context(Context that, Context newParent) { if (that == null) { copyTables(); return;
return false; } else { currentContext.declarePrefix(prefix, uri); return true;
/** * Declare a Namespace prefix for this context. * * @param prefix The prefix to declare. * @param uri The associated Namespace URI. * @see org.xml.sax.helpers.NamespaceSupport#declarePrefix */ void declarePrefix(String prefix, String uri) { // Lazy processing... if (!tablesDirty) { copyTables(); } if (declarations == null) { declarations = new ArrayList(); } prefix = prefix.intern(); uri = uri.intern(); if ("".equals(prefix)) { if ("".equals(uri)) { defaultNS = null; } else { defaultNS = uri; } } else { prefixTable.put(prefix, uri); uriTable.put(uri, prefix); // may wipe out another prefix } declarations.add(prefix); }
/** * Declare a Namespace prefix for this context. * * @param prefix The prefix to declare. * @param uri The associated Namespace URI. * @see org.xml.sax.helpers.NamespaceSupport#declarePrefix */ void declarePrefix(String prefix, String uri) { // Lazy processing... if (!tablesDirty) { copyTables(); } if (declarations == null) { declarations = new ArrayList(); } prefix = prefix.intern(); uri = uri.intern(); if ("".equals(prefix)) { if ("".equals(uri)) { defaultNS = null; } else { defaultNS = uri; } } else { prefixTable.put(prefix, uri); uriTable.put(uri, prefix); // may wipe out another prefix } declarations.add(prefix); }
/** * Declare a Namespace prefix for this context. * * @param prefix The prefix to declare. * @param uri The associated Namespace URI. * @see org.xml.sax.helpers.NamespaceSupport#declarePrefix */ void declarePrefix(String prefix, String uri) { // Lazy processing... if (!tablesDirty) { copyTables(); } if (declarations == null) { declarations = new ArrayList(); } prefix = prefix.intern(); uri = uri.intern(); if ("".equals(prefix)) { if ("".equals(uri)) { defaultNS = null; } else { defaultNS = uri; } } else { prefixTable.put(prefix, uri); uriTable.put(uri, prefix); // may wipe out another prefix } declarations.add(prefix); }
/** * Return one of the prefixes mapped to a Namespace URI. * * <p>If more than one prefix is currently mapped to the same * URI, this method will make an arbitrary selection; if you * want all of the prefixes, use the {@link #getPrefixes} * method instead.</p> * * <p><strong>Note:</strong> this will never return the empty (default) prefix; * to check for a default prefix, use the {@link #getURI getURI} * method with an argument of "".</p> * * @param uri The Namespace URI. * @return One of the prefixes currently mapped to the URI supplied, * or null if none is mapped or if the URI is assigned to * the default Namespace. * @see #getPrefixes(java.lang.String) * @see #getURI */ public String getPrefix(String uri) { return currentContext.getPrefix(uri); }
/** * Return one of the prefixes mapped to a Namespace URI. * * <p>If more than one prefix is currently mapped to the same * URI, this method will make an arbitrary selection; if you * want all of the prefixes, use the {@link #getPrefixes} * method instead.</p> * * <p><strong>Note:</strong> this will never return the empty (default) prefix; * to check for a default prefix, use the {@link #getURI getURI} * method with an argument of "".</p> * * @param uri The Namespace URI. * @return One of the prefixes currently mapped to the URI supplied, * or null if none is mapped or if the URI is assigned to * the default Namespace. * @see #getPrefixes(java.lang.String) * @see #getURI */ public String getPrefix(String uri) { return currentContext.getPrefix(uri); }
public NamespaceSupport(NamespaceSupport that) { contexts = new Context[that.contexts.length]; currentContext = null; contextPos = that.contextPos; Context currentParent = null; for (int i = 0; i < that.contexts.length; i++) { Context thatContext = that.contexts[i]; if (thatContext == null) { contexts[i] = null; continue; } Context thisContext = new Context(thatContext, currentParent); contexts[i] = thisContext; if (that.currentContext == thatContext) { currentContext = thisContext; } currentParent = thisContext; } }
/** * Return one of the prefixes mapped to a Namespace URI. * * <p>If more than one prefix is currently mapped to the same * URI, this method will make an arbitrary selection; if you * want all of the prefixes, use the {@link #getPrefixes} * method instead.</p> * * <p><strong>Note:</strong> this will never return the empty (default) prefix; * to check for a default prefix, use the {@link #getURI getURI} * method with an argument of "".</p> * * @param uri The Namespace URI. * @return One of the prefixes currently mapped to the URI supplied, * or null if none is mapped or if the URI is assigned to * the default Namespace. * @see #getPrefixes(java.lang.String) * @see #getURI */ public String getPrefix(String uri) { return currentContext.getPrefix(uri); }
public NamespaceSupport(NamespaceSupport that) { contexts = new Context[that.contexts.length]; currentContext = null; contextPos = that.contextPos; Context currentParent = null; for (int i = 0; i < that.contexts.length; i++) { Context thatContext = that.contexts[i]; if (thatContext == null) { contexts[i] = null; continue; } Context thisContext = new Context(thatContext, currentParent); contexts[i] = thisContext; if (that.currentContext == thatContext) { currentContext = thisContext; } currentParent = thisContext; } }