/** * Adds the given namespace to the export. A unique prefix based on * the given prefix hint is mapped to the given namespace URI. If the * namespace is already mapped, then the existing prefix is returned. * * @param hint prefix hint * @param uri namespace URI * @return registered prefix */ protected String addNamespace(String hint, String uri) { String prefix = getPrefix(uri); if (prefix == null) { prefix = getUniquePrefix(hint); ((Map) stack.getFirst()).put(uri, prefix); } return prefix; }
/** * Adds the given namespace to the export. A unique prefix based on * the given prefix hint is mapped to the given namespace URI. If the * namespace is already mapped, then the existing prefix is returned. * * @param hint prefix hint * @param uri namespace URI * @return registered prefix */ protected String addNamespace(String hint, String uri) { String prefix = getPrefix(uri); if (prefix == null) { prefix = getUniquePrefix(hint); ((Map) stack.getFirst()).put(uri, prefix); } return prefix; }
/** * Adds the given namespace to the export. A unique prefix based on * the given prefix hint is mapped to the given namespace URI. If the * namespace is already mapped, then the existing prefix is returned. * * @param hint prefix hint * @param uri namespace URI * @return registered prefix */ protected String addNamespace(String hint, String uri) { String prefix = getPrefix(uri); if (prefix == null) { prefix = getUniquePrefix(hint); ((Map) stack.getFirst()).put(uri, prefix); } return prefix; }
/** * Returns a prefixed XML name for the given namespace URI and local * name. If a prefix mapping for the namespace URI is not yet available, * it is created based on the namespace mappings of the current JCR * session. * * @param uri namespace URI * @param local local name * @return prefixed XML name * @throws RepositoryException if a JCR namespace mapping is not available */ protected String getXMLName(String uri, String local) throws RepositoryException { if (uri.length() == 0) { return local; } else { String prefix = getPrefix(uri); if (prefix == null) { prefix = getUniquePrefix(session.getNamespacePrefix(uri)); ((Map) stack.getFirst()).put(uri, prefix); } return prefix + ":" + local; } }
/** * Returns a prefixed XML name for the given namespace URI and local * name. If a prefix mapping for the namespace URI is not yet available, * it is created based on the namespace mappings of the current JCR * session. * * @param uri namespace URI * @param local local name * @return prefixed XML name * @throws RepositoryException if a JCR namespace mapping is not available */ protected String getXMLName(String uri, String local) throws RepositoryException { if (uri.length() == 0) { return local; } else { String prefix = getPrefix(uri); if (prefix == null) { prefix = getUniquePrefix(session.getNamespacePrefix(uri)); ((Map) stack.getFirst()).put(uri, prefix); } return prefix + ":" + local; } }
/** * Returns a prefixed XML name for the given namespace URI and local * name. If a prefix mapping for the namespace URI is not yet available, * it is created based on the namespace mappings of the current JCR * session. * * @param uri namespace URI * @param local local name * @return prefixed XML name * @throws RepositoryException if a JCR namespace mapping is not available */ protected String getXMLName(String uri, String local) throws RepositoryException { if (uri.length() == 0) { return local; } else { String prefix = getPrefix(uri); if (prefix == null) { prefix = getUniquePrefix(session.getNamespacePrefix(uri)); ((Map) stack.getFirst()).put(uri, prefix); } return prefix + ":" + local; } }