Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

public class Main {
    /**
     * Creates a NamespaceContext object with the following list of namespaces:
     * 
     * <dl>
     * <dt>tei</dt>
     * <dd>http://www.tei-c.org/ns/1.0</dd>
     * </dl>
     * 
     * @return A NamespaceContext object
     */
    public static NamespaceContext getTEINamespaceContext() {
        NamespaceContext ctx = new NamespaceContext() {
            public String getNamespaceURI(String prefix) {
                String uri;
                if (prefix.equals("tei"))
                    uri = "http://www.tei-c.org/ns/1.0";
                else
                    uri = null;

                return uri;
            }

            // Dummy implementation - not used!
            public Iterator<String> getPrefixes(String val) {
                return null;
            }

            // Dummy implemenation - not used!
            public String getPrefix(String uri) {
                return null;
            }
        };

        return ctx;
    }
}