use of org.exist.util.sax.event.contenthandler.Characters in project exist by eXist-db.
the class ConfigurationDocumentTrigger method findName.
/**
* Attempts to find and extract the text value
* of the name element from the deferred elements
*
* @return The text value of the name element, or null otherwise
*/
private String findName() {
boolean inName = false;
final StringBuilder name = new StringBuilder();
for (final SAXEvent event : deferred) {
if (event instanceof Element) {
final Element element = (Element) event;
if (element.namespaceURI != null && element.namespaceURI.equals(Configuration.NS) && element.localName.equals("name")) {
inName = !inName;
}
}
if (inName && event instanceof Characters) {
name.append(((Characters) event).ch);
}
}
if (name.length() > 0) {
return name.toString().trim();
} else {
return null;
}
}
Aggregations