/** * Reset this Namespace support object for reuse. * * <p>It is necessary to invoke this method before reusing the * Namespace support object for a new session.</p> */ public void reset () { // Discarding the whole stack doesn't save us a lot versus // creating a new NamespaceSupport. Do we care, or should we // change this to just reset the root context? currentContext = new Context2(null); currentContext.declarePrefix("xml", XMLNS); }
/** * Look up a prefix and get the currently-mapped Namespace URI. * * <p>This method looks up the prefix in the current context. * Use the empty string ("") for the default Namespace.</p> * * @param prefix The prefix to look up. * @return The associated Namespace URI, or null if the prefix * is undeclared in this context. * @see #getPrefix * @see #getPrefixes */ public String getURI (String prefix) { return currentContext.getURI(prefix); }
/** * Return an enumeration of all prefixes declared in this context. * * <p>The empty (default) prefix will be included in this * enumeration; note that this behaviour differs from that of * {@link #getPrefix} and {@link #getPrefixes}.</p> * * @return An enumeration of all prefixes declared in this * context. * @see #getPrefixes * @see #getURI */ public Enumeration getDeclaredPrefixes () { return currentContext.getDeclaredPrefixes(); }
/** * Return an enumeration of all prefixes currently declared. * * <p><strong>Note:</strong> if there is a default prefix, it will not be * returned in this enumeration; check for the default prefix * using the {@link #getURI getURI} with an argument of "".</p> * * @return An enumeration of all prefixes declared in the * current context except for the empty (default) * prefix. * @see #getDeclaredPrefixes * @see #getURI */ public Enumeration getPrefixes () { return currentContext.getPrefixes(); }
/** * Revert to the previous Namespace context. * * <p>Normally, you should pop the context at the end of each * XML element. After popping the context, all Namespace prefix * mappings that were previously in force are restored.</p> * * <p>You must not attempt to declare additional Namespace * prefixes after popping a context, unless you push another * context first.</p> * * @see #pushContext */ public void popContext () { Context2 parentContext=currentContext.getParent(); if(parentContext==null) throw new EmptyStackException(); else currentContext = parentContext; }
/** * 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); }
boolean isAttribute) String[] name=currentContext.processName(qName, isAttribute); if(name==null) return null;
return false; } else { currentContext.declarePrefix(prefix, uri); return true;
/** * Look up a prefix and get the currently-mapped Namespace URI. * * <p>This method looks up the prefix in the current context. * Use the empty string ("") for the default Namespace.</p> * * @param prefix The prefix to look up. * @return The associated Namespace URI, or null if the prefix * is undeclared in this context. * @see #getPrefix * @see #getPrefixes */ public String getURI (String prefix) { return currentContext.getURI(prefix); }
/** * Return an enumeration of all prefixes declared in this context. * * <p>The empty (default) prefix will be included in this * enumeration; note that this behaviour differs from that of * {@link #getPrefix} and {@link #getPrefixes}.</p> * * @return An enumeration of all prefixes declared in this * context. * @see #getPrefixes * @see #getURI */ public Enumeration getDeclaredPrefixes () { return currentContext.getDeclaredPrefixes(); }
/** * Return an enumeration of all prefixes currently declared. * * <p><strong>Note:</strong> if there is a default prefix, it will not be * returned in this enumeration; check for the default prefix * using the {@link #getURI getURI} with an argument of "".</p> * * @return An enumeration of all prefixes declared in the * current context except for the empty (default) * prefix. * @see #getDeclaredPrefixes * @see #getURI */ public Enumeration getPrefixes () { return currentContext.getPrefixes(); }
/** * Revert to the previous Namespace context. * * <p>Normally, you should pop the context at the end of each * XML element. After popping the context, all Namespace prefix * mappings that were previously in force are restored.</p> * * <p>You must not attempt to declare additional Namespace * prefixes after popping a context, unless you push another * context first.</p> * * @see #pushContext */ public void popContext () { Context2 parentContext=currentContext.getParent(); if(parentContext==null) throw new EmptyStackException(); else currentContext = parentContext; }
/** * 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); }
boolean isAttribute) String[] name=currentContext.processName(qName, isAttribute); if(name==null) return null;
return false; } else { currentContext.declarePrefix(prefix, uri); return true;
/** * Reset this Namespace support object for reuse. * * <p>It is necessary to invoke this method before reusing the * Namespace support object for a new session.</p> */ public void reset () { // Discarding the whole stack doesn't save us a lot versus // creating a new NamespaceSupport. Do we care, or should we // change this to just reset the root context? currentContext = new Context2(null); currentContext.declarePrefix("xml", XMLNS); }
/** * Look up a prefix and get the currently-mapped Namespace URI. * * <p>This method looks up the prefix in the current context. * Use the empty string ("") for the default Namespace.</p> * * @param prefix The prefix to look up. * @return The associated Namespace URI, or null if the prefix * is undeclared in this context. * @see #getPrefix * @see #getPrefixes */ public String getURI (String prefix) { return currentContext.getURI(prefix); }