package com.langintro.celtx_to_odt;

import java.util.Iterator;
import javax.xml.XMLConstants;
import javax.xml.namespace.NamespaceContext;

public class CeltxNamespaceContext implements NamespaceContext {

	private String ns1NamespaceUri = "";

    public String getNamespaceURI(String prefix) {
		String result = null;
        if (prefix == null) throw new NullPointerException("Null prefix");
        else if ("dc".equals(prefix)) result = "http://purl.org/dc/elements/1.1/";
		else if ("cx".equals(prefix)) result= "http://celtx.com/NS/v1/";
		else if ("RDF".equals(prefix)) result = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
        else if ("xml".equals(prefix)) result = XMLConstants.XML_NS_URI;
		else if ("NS1".equals(prefix)) result = ns1NamespaceUri;
        return result;
    }

	public void setNs1NamespaceUri(String uri)
	{
		ns1NamespaceUri = uri;
	}

	public String getNs1NamespaceUri()
	{
		return ns1NamespaceUri;
	}

    // This method isn't necessary for XPath processing.
    public String getPrefix(String uri) {
        throw new UnsupportedOperationException();
    }

    // This method isn't necessary for XPath processing either.
    public Iterator getPrefixes(String uri) {
        throw new UnsupportedOperationException();
    }

}