1
2
3
4
5
6
7
8 package de.nierbeck.timeTrack.model.impl.runtime;
9
10 import javax.xml.namespace.NamespaceContext;
11
12 /***
13 * Maintains namespace<->prefix bindings.
14 *
15 * <p>
16 * This interface extends {@link NamespaceContext} and provides an additional
17 * functionality, which is necessary to declare namespaced attributes on
18 * elements. The added method is for self-consumption by the marshaller.
19 *
20 * This object is composed into a Serializer.
21 */
22 public interface NamespaceContext2 extends NamespaceContext {
23 /***
24 * Declares a new namespace binding within the current context.
25 *
26 * <p>
27 * The prefix is automatically assigned by MarshallingContext. If a given
28 * namespace URI is already declared, nothing happens.
29 *
30 * <p>
31 * It is <b>NOT</b> an error to declare the same namespace URI more than
32 * once.
33 *
34 * <p>
35 * For marshalling to work correctly, all namespace bindings for an element
36 * must be declared between its startElement method and its endAttributes
37 * event. Calling the same method with the same parameter between the
38 * endAttributes and the endElement returns the same prefix.
39 *
40 * @param requirePrefix
41 * If this parameter is true, this method must assign a prefix to
42 * this namespace, even if it's already bound to the default
43 * namespace. IOW, this method will never return null if this
44 * flag is true. This functionality is necessary to declare
45 * namespace URI used for attribute names.
46 * @param preferedPrefix
47 * If the caller has any particular preference to the prefix,
48 * pass that as a parameter. The callee will try to honor it. Set
49 * null if there's no particular preference.
50 *
51 * @return returns the assigned prefix. If the namespace is bound to the
52 * default namespace, null is returned.
53 */
54 String declareNamespace(String namespaceUri, String preferedPrefix,
55 boolean requirePrefix);
56 }