Java XML Namespace getTEINamespaceContext()

Here you can find the source of getTEINamespaceContext()

Description

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>

License

Open Source License

Return

A NamespaceContext object

Declaration

public static NamespaceContext getTEINamespaceContext() 

Method Source Code

//package com.java2s;

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

public class Main {
    /**//from   w w  w. j a v  a  2 s  .  c om
     * 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;
    }
}

Related

  1. getPackageNamespace(Class cls)
  2. getPrefix(final Package targetPackage, String namespaceURI)
  3. getPrefixFromNamespaceDeclaration(String namespace)
  4. getRequestMessageType(String intfNamespace, String op, String prefix)
  5. getSchemaNamespace(Package pkg)
  6. getXmlSchemaNamespace(Class clazz)
  7. isNamespaceAware()
  8. isValidFragment(final Object obj, final String namespace, final String localPart)
  9. logWriter(Logger logger, String msg, XMLStreamWriter writer, String namespaceURI)