/** Unwraps the original context and forwards the call. */ @Override public void setNamespaceContext(NamespaceContext context) throws XMLStreamException { if (context instanceof FilteredNamespaces) { context = ((FilteredNamespaces) context).inverse(version); } else { context = new FilteredNamespaces(context, version, true); } out.setNamespaceContext(context); }
/** * Returns the namespace for the given prefix. */ @Override public String getNamespaceURI(final String prefix) { return toView(context.getNamespaceURI(prefix)); }
/** * Wraps this {@code FilteredNamespaces} in a new instance performing the inverse of the replacements * specified by the given version. */ NamespaceContext inverse(final FilterVersion version) { if (toView == version.toView && toImpl == version.toImpl) { return this; } return new FilteredNamespaces(this, version, true); }
/** * Returns the prefix for the given namespace. */ @Override public String getPrefix(final String namespaceURI) { return context.getPrefix(toImpl(namespaceURI)); }
/** Returns the context of the underlying writer wrapped in a filter that convert the namespaces on the fly. */ @Override public NamespaceContext getNamespaceContext() { return new FilteredNamespaces(out.getNamespaceContext(), version, false); } }
/** * Returns all prefixes for the given namespace. */ @Override @SuppressWarnings("unchecked") public Iterator<String> getPrefixes(final String namespaceURI) { return context.getPrefixes(toImpl(namespaceURI)); } }
/** Returns the context of the underlying reader wrapped in a filter that convert the namespaces on the fly. */ @Override public NamespaceContext getNamespaceContext() { return new FilteredNamespaces(super.getNamespaceContext(), version, true); }