1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.millscript.commons.xml.tokenizer;
22
23 import org.millscript.commons.alert.Alert;
24 import org.millscript.commons.util.IMap;
25
26 /**
27 * This class provides a <code>Name</code> implementation for use when
28 * documents are processed wihtout namespace support.
29 */
30 public class NoNamespacesName extends AbstractName {
31
32 /**
33 * This is the ID from the release 0.3.0 for future compatibility.
34 */
35 private static final long serialVersionUID = 7762757201196265287L;
36
37 /**
38 * The full name.
39 */
40 private final String name;
41
42 /**
43 * Constructs a new no namespace name, with the specified element name.
44 *
45 * @param n the name
46 */
47 public NoNamespacesName( final String n ) {
48
49
50 if ( n == null ) {
51 throw new NullPointerException( "name cannot be null" );
52 }
53 this.name = n;
54 }
55
56 /**
57 * @see org.millscript.commons.alert.AlertDecorator#decorate(org.millscript.commons.alert.Alert)
58 */
59 public Alert decorate( final Alert alert ) {
60 return alert.culprit( "xml name", this.getQName() );
61 }
62
63 /**
64 * @see org.millscript.commons.xml.api.Name#getLocalName()
65 */
66 public String getLocalName() {
67 return this.name;
68 }
69
70 /**
71 * @see org.millscript.commons.xml.api.Name#getNamespace()
72 */
73 public String getNamespace() {
74 return "";
75 }
76
77 /**
78 * @see org.millscript.commons.xml.api.Name#getPrefix()
79 */
80 public String getPrefix() {
81 return "";
82 }
83
84 /**
85 * @see org.millscript.commons.xml.api.Name#getQName()
86 */
87 public String getQName() {
88 return this.name;
89 }
90
91 /**
92 * @see org.millscript.commons.xml.tokenizer.ProtoName#setNamespace(IMap)
93 */
94 @Override
95 public AbstractName setNamespace( final IMap< String, String > scope ) {
96 return this;
97 }
98
99 /**
100 * @see java.lang.Object#toString()
101 */
102 @Override
103 public String toString() {
104 return this.name;
105 }
106
107 }