Lines 45-50
Link Here
|
45 |
} |
45 |
} |
46 |
return result; |
46 |
return result; |
47 |
} |
47 |
} |
|
|
48 |
|
49 |
public static List getXmiMultiValueAsString(Node node, String attributeName) { |
50 |
List result = null; |
51 |
if (node != null) { |
52 |
// assume the MultiValued thing cannot be as an attribute... |
53 |
return getElementValueAsStringList( node, attributeName ); |
54 |
} |
55 |
return result; |
56 |
} |
48 |
|
57 |
|
49 |
public static List getXmiRefValue(Node node, String attributeName) { |
58 |
public static List getXmiRefValue(Node node, String attributeName) { |
50 |
List value = new ArrayList(); |
59 |
List value = new ArrayList(); |
Lines 93-98
Link Here
|
93 |
result = ""; |
102 |
result = ""; |
94 |
} else { |
103 |
} else { |
95 |
result = attributeNode.getNodeValue(); |
104 |
result = attributeNode.getNodeValue(); |
|
|
105 |
} |
106 |
} |
107 |
} |
108 |
return result; |
109 |
} |
110 |
|
111 |
public static List getElementValueAsStringList(Node node, String attributeName) { |
112 |
List result = null; |
113 |
if (node != null) { |
114 |
List l = getChildNodeList( node, attributeName ); |
115 |
if (l != null) { |
116 |
result = new ArrayList(l.size()); |
117 |
for (Iterator it = l.iterator(); it.hasNext(); ) { |
118 |
Node attributeNode = ((Node)it.next()).getFirstChild(); |
119 |
if (attributeNode == null) { |
120 |
result.add(""); |
121 |
} else { |
122 |
result.add(attributeNode.getNodeValue()); |
123 |
} |
124 |
} |
125 |
} |
126 |
} |
127 |
return result; |
128 |
} |
129 |
|
130 |
public static List getChildNodeList(Node parentNode, String childNodeName) { |
131 |
List result = null; |
132 |
if ((parentNode != null) && (childNodeName != null)) { |
133 |
NodeList children = parentNode.getChildNodes(); |
134 |
for (int cnt = 0; cnt < children.getLength(); cnt++) { |
135 |
Node child = children.item(cnt); |
136 |
// [PENDING] this is ugly !!! namespaces should be resolved correctly |
137 |
if (childNodeName.equals(resolveFullName(child))) { |
138 |
if (result == null) |
139 |
result = new LinkedList(); |
140 |
result.add(child); |
96 |
} |
141 |
} |
97 |
} |
142 |
} |
98 |
} |
143 |
} |