com.thaiopensource.relaxng.input.parse.NamespaceContextImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of trang Show documentation
Show all versions of trang Show documentation
Jing/Trang - tools for validating and translating RelaxNG
The newest version!
package com.thaiopensource.relaxng.input.parse;
import com.thaiopensource.relaxng.edit.NamespaceContext;
import com.thaiopensource.relaxng.parse.Context;
import java.util.Collections;
import java.util.Set;
class NamespaceContextImpl implements NamespaceContext {
private final Context context;
private Set cachedPrefixes = null;
NamespaceContextImpl(Context context) {
this.context = context.copy();
}
public String getNamespace(String prefix) {
return context.resolveNamespacePrefix(prefix);
}
public Set getPrefixes() {
if (cachedPrefixes == null)
cachedPrefixes = Collections.unmodifiableSet(context.prefixes());
return cachedPrefixes;
}
}