use of org.exist.util.sax.event.contenthandler.EndElement in project exist by eXist-db.
the class ConfigurationDocumentTrigger method setAccountPrimaryGroupToNoGroup.
private void setAccountPrimaryGroupToNoGroup() throws SAXException {
final SAXEvent firstEvent = deferred.peek();
if (!(firstEvent instanceof StartElement)) {
throw new SAXException("Unbalanced SAX Events");
}
StartElement start = ((StartElement) firstEvent);
if (start.namespaceURI == null || !start.namespaceURI.equals(Configuration.NS) || !start.localName.equals(PrincipalType.ACCOUNT.getElementName())) {
throw new SAXException("First element does not match ending '" + PrincipalType.ACCOUNT.getElementName() + "' element");
}
start = (StartElement) deferred.pop();
final AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "name", "name", "CDATA", SecurityManager.UNKNOWN_GROUP);
final StartElement startPrimaryGroup = new StartElement(start.namespaceURI, PrincipalType.GROUP.getElementName(), PrincipalType.GROUP.getElementName(), attrs);
final EndElement endPrimaryGroup = new EndElement(startPrimaryGroup.namespaceURI, startPrimaryGroup.localName, startPrimaryGroup.qname);
deferred.push(endPrimaryGroup);
deferred.push(startPrimaryGroup);
deferred.push(start);
}
Aggregations