1
|
|
/*
|
2
|
|
* JBind
|
3
|
|
*
|
4
|
|
* Copyright (c) by Stefan Wachter. All rights reserved.
|
5
|
|
*
|
6
|
|
* Usage, modification, and redistribution is subject to license terms that are
|
7
|
|
* available at 'http://www.jbind.org'. The JBind license is like the
|
8
|
|
* 'Apache Software License V 1.1'.
|
9
|
|
*/
|
10
|
|
package org.jbind.xml.instance.impl;
|
11
|
|
|
12
|
|
import java.util.Collections;
|
13
|
|
import java.util.ListIterator;
|
14
|
|
import java.util.Map;
|
15
|
|
|
16
|
|
import org.jbind.xml.base.ILocation;
|
17
|
|
import org.jbind.xml.core.base.ITextContentMemento;
|
18
|
|
import org.jbind.xml.core.base.ITextContentProvider;
|
19
|
|
import org.jbind.xml.core.bridge.IDataImplVisitor;
|
20
|
|
import org.jbind.xml.core.bridge.IElementImpl;
|
21
|
|
import org.jbind.xml.core.bridge.IImplContainer;
|
22
|
|
import org.jbind.xml.core.bridge.ITextImpl;
|
23
|
|
import org.jbind.xml.core.data.IAnyTypeData;
|
24
|
|
import org.jbind.xml.msg.XmlException;
|
25
|
|
|
26
|
|
public class TextImpl extends Impl implements ITextImpl {
|
27
|
|
|
28
|
|
private IImplContainer myParent;
|
29
|
|
private TextContent myTextContent = new TextContent();
|
30
|
|
|
31
|
682
|
public TextImpl(IImplContainer aParent, String aText, ILocation aLocation) {
|
32
|
682
|
super(aLocation);
|
33
|
682
|
myParent = aParent;
|
34
|
682
|
setTextContent(aText);
|
35
|
|
}
|
36
|
|
|
37
|
12
|
public TextImpl(IImplContainer aParent, ITextContentProvider aText, ILocation aLocation) {
|
38
|
12
|
super(aLocation);
|
39
|
12
|
myParent = aParent;
|
40
|
12
|
setTextContent(aText);
|
41
|
|
}
|
42
|
|
|
43
|
405
|
public void accept(IDataImplVisitor aVisitor) throws XmlException {
|
44
|
405
|
aVisitor.visitTextImpl(this);
|
45
|
|
}
|
46
|
|
|
47
|
0
|
public IImplContainer getParentImpl() {
|
48
|
0
|
return myParent;
|
49
|
|
}
|
50
|
|
|
51
|
0
|
public IAnyTypeData getAttributeData(String aNamespace, String aLocalName) {
|
52
|
0
|
return null;
|
53
|
|
}
|
54
|
|
|
55
|
0
|
public boolean isDefault() {
|
56
|
0
|
return false;
|
57
|
|
}
|
58
|
|
|
59
|
0
|
public boolean isNil() {
|
60
|
0
|
return false;
|
61
|
|
}
|
62
|
|
|
63
|
0
|
public ListIterator iterChildren() {
|
64
|
0
|
return Collections.EMPTY_LIST.listIterator();
|
65
|
|
}
|
66
|
|
|
67
|
0
|
public ListIterator iterElementData(String aNamespace, String aLocalName) {
|
68
|
0
|
return Collections.EMPTY_LIST.listIterator();
|
69
|
|
}
|
70
|
|
|
71
|
|
//
|
72
|
|
// namespace
|
73
|
|
//
|
74
|
|
|
75
|
0
|
public Map getPrefixToNamespaceMapping() {
|
76
|
0
|
return ((IElementImpl)getParentImpl()).getPrefixToNamespaceMapping();
|
77
|
|
}
|
78
|
|
|
79
|
|
//
|
80
|
|
// text content
|
81
|
|
//
|
82
|
|
|
83
|
0
|
public boolean hasTextContent() {
|
84
|
0
|
return true;
|
85
|
|
}
|
86
|
|
|
87
|
0
|
public void restoreTextContent(ITextContentMemento aMemento) {
|
88
|
0
|
myTextContent.restoreTextContent(aMemento);
|
89
|
|
}
|
90
|
|
|
91
|
0
|
public ITextContentMemento saveTextContent() {
|
92
|
0
|
return myTextContent.saveTextContent();
|
93
|
|
}
|
94
|
|
|
95
|
434
|
public String getTextContent() {
|
96
|
434
|
return myTextContent.getTextContent();
|
97
|
|
}
|
98
|
|
|
99
|
12
|
public void setTextContent(ITextContentProvider aTextContentProvider) {
|
100
|
12
|
myTextContent.setTextContent(aTextContentProvider);
|
101
|
|
}
|
102
|
|
|
103
|
682
|
public void setTextContent(String aString) {
|
104
|
682
|
myTextContent.setTextContent(aString);
|
105
|
|
}
|
106
|
|
|
107
|
|
}
|
108
|
|
|