final Element child = (Element)children.get(0);
final String name = directive.getAttribute("name").getValue();
final String value = directive.getAttribute("value").getValue();
// Get the thing to operate on
ODOMAttribute attribute = null;
if (child.getName().equals("proxy")) {
// It's a proxy element, so get it by name and lookup
// the attribute
final ODOMElement element = (ODOMElement)elementsMap.
get(child.getAttribute("name").getValue());
attribute = (ODOMAttribute)element.getAttribute(name);
} else if (child.getName().equals("pathToSelection")) {
// It's an attribute within the selection, so first get
// the context element
final ODOMElement context = (ODOMElement)
getSingletonNode(
currentSelection,
child.getAttribute("context").getValue());
// Use the context to get the attribute
final String xpathStr = child.getAttribute("xpath").getValue();
Assert.assertEquals("xpath len", true, xpathStr.length() > 0);
attribute = (ODOMAttribute)getSingletonNode(context, xpathStr);
} else {
throw new IllegalStateException(
"Unknown child: " + child);
}
// This directive applies to EXTANT attributes only
if (attribute == null) {
throw new IllegalStateException("Could not find attrib");
}
// Now set the attribute
Utils.print("\nBefore updateAttribValue:");
Utils.print(attribute.getParent());
attribute.setValue(value);
Utils.print("\nAfter updateAttribValue:");
Utils.print(attribute.getParent());
}