KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > tools > xjc > runtime > NamespaceContext2


1 package com.sun.tools.xjc.runtime;
2
3 import javax.xml.namespace.NamespaceContext JavaDoc;
4
5 /**
6  * Maintains namespace<->prefix bindings.
7  *
8  * <p>
9  * This interface extends {@link NamespaceContext} and provides
10  * an additional functionality, which is necessary to declare
11  * namespaced attributes on elements. The added method is for
12  * self-consumption by the marshaller.
13  *
14  * This object is composed into a Serializer.
15  */

16 public interface NamespaceContext2 extends NamespaceContext JavaDoc
17 {
18     /**
19      * Declares a new namespace binding within the current context.
20      *
21      * <p>
22      * The prefix is automatically assigned by MarshallingContext. If
23      * a given namespace URI is already declared, nothing happens.
24      *
25      * <p>
26      * It is <b>NOT</b> an error to declare the same namespace URI
27      * more than once.
28      *
29      * <p>
30      * For marshalling to work correctly, all namespace bindings
31      * for an element must be declared between its startElement method and
32      * its endAttributes event. Calling the same method with the same
33      * parameter between the endAttributes and the endElement returns
34      * the same prefix.
35      *
36      * @param requirePrefix
37      * If this parameter is true, this method must assign a prefix
38      * to this namespace, even if it's already bound to the default
39      * namespace. IOW, this method will never return null if this
40      * flag is true. This functionality is necessary to declare
41      * namespace URI used for attribute names.
42      * @param preferedPrefix
43      * If the caller has any particular preference to the
44      * prefix, pass that as a parameter. The callee will try
45      * to honor it. Set null if there's no particular preference.
46      *
47      * @return
48      * returns the assigned prefix. If the namespace is bound to
49      * the default namespace, null is returned.
50      */

51     String JavaDoc declareNamespace( String JavaDoc namespaceUri, String JavaDoc preferedPrefix, boolean requirePrefix );
52 }
53
Popular Tags