private static Map turnIntoMap(NamespaceContext ctx) { HashMap/*<String, String>*/ m = new HashMap(); for (Iterator i = ctx.getPrefixes(); i.hasNext(); ) { String prefix = (String) i.next(); String uri = ctx.getNamespaceURI(prefix); // according to the Javadocs only the constants defined in // XMLConstants are allowed as prefixes for the following // two URIs if (!XMLConstants.XML_NS_URI.equals(uri) && !XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(uri)) { m.put(prefix, uri); } } m.put(XMLConstants.XML_NS_PREFIX, XMLConstants.XML_NS_URI); m.put(XMLConstants.XMLNS_ATTRIBUTE, XMLConstants.XMLNS_ATTRIBUTE_NS_URI); return m; } }
/** * Returns the namespace uri for the given prefix. * * @param prefix the namespace prefix * @return the namespace uri, or null if an unknown prefix was supplied. */ @Override public String getNamespaceURI(final String prefix) { if ("ui".equals(prefix)) { return "https://github.com/bordertech/wcomponents/namespace/ui/v1.0"; } else if ("html".equals(prefix)) { return "http://www.w3.org/1999/xhtml"; } else if (backing != null) { return backing.getNamespaceURI(prefix); } return null; }
/** * @return an iteration of the namespace prefixes in this contex.t */ @Override public Iterator<String> getPrefixes() { Set<String> prefixes = new HashSet<>(2); prefixes.add("ui"); prefixes.add("html"); if (backing != null) { for (Iterator<?> i = backing.getPrefixes(); i.hasNext();) { prefixes.add((String) i.next()); } } return prefixes.iterator(); } }
private static QualifiedName parsePrefixFormat(String value, int colon, NamespaceContext ctx) { if (colon + 1 == value.length()) { throw new IllegalArgumentException("localName must not be empty in " + value); } if (ctx == null) { throw new IllegalArgumentException("Cannot parse " + value + " without a NamespaceContext"); } String prefix = value.substring(0, colon); String nsUri = ctx.getNamespaceURI(prefix); if (nsUri == null) { throw new IllegalArgumentException(prefix + " is unknown to " + "NamespaceContext"); } return new QualifiedName(nsUri, value.substring(colon + 1)); } }
/** * {@inheritDoc} */ @Override public Iterator<String> getPrefixes() { Set<String> prefixes = new HashSet<>(2); prefixes.add("ui"); prefixes.add("html"); if (backing != null) { for (Iterator i = backing.getPrefixes(); i.hasNext();) { prefixes.add((String) i.next()); } } return prefixes.iterator(); } }
static Map<String, String> turnIntoMap(NamespaceContext ctx) { Map<String, String> m = new HashMap<String, String>(); for (Iterator i = ctx.getPrefixes(); i.hasNext(); ) { String prefix = (String) i.next(); String uri = ctx.getNamespaceURI(prefix); // according to the Javadocs only the constants defined in // XMLConstants are allowed as prefixes for the following // two URIs if (!XMLConstants.XML_NS_URI.equals(uri) && !XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(uri)) { m.put(prefix, uri); } } m.put(XMLConstants.XML_NS_PREFIX, XMLConstants.XML_NS_URI); m.put(XMLConstants.XMLNS_ATTRIBUTE, XMLConstants.XMLNS_ATTRIBUTE_NS_URI); return m; } }
/** * {@inheritDoc} */ @Override public String getNamespaceURI(final String prefix) { if ("ui".equals(prefix)) { return getThemeURI(); } else if ("html".equals(prefix)) { return XMLUtil.XHTML_URI; } else if (backing != null) { return backing.getNamespaceURI(prefix); } return null; }
StringBuilder nsDecls = new StringBuilder(); String quoteStyle = "'"; for (Iterator keys = ctx.getPrefixes(); keys.hasNext(); ) { String prefix = (String) keys.next(); String uri = ctx.getNamespaceURI(prefix); if (uri == null) { continue;
StringBuffer nsDecls = new StringBuffer(); String quoteStyle = "'"; for (Iterator keys = ctx.getPrefixes(); keys.hasNext(); ) { String prefix = (String) keys.next(); String uri = ctx.getNamespaceURI(prefix); if (uri == null) { continue;