MCPcopy Create free account
hub / github.com/apache/tomcat / endElement

Method endElement

java/org/apache/tomcat/util/digester/Digester.java:1065–1146  ·  view source on GitHub ↗

Process notification of the end of an XML element being reached. @param namespaceURI - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed. @param localName - The local name (without prefix), or the

(String namespaceURI, String localName, String qName)

Source from the content-addressed store, hash-verified

1063 * @exception SAXException if a parsing error is to be reported
1064 */
1065 @Override
1066 public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
1067
1068 boolean debug = log.isTraceEnabled();
1069
1070 if (debug) {
1071 if (saxLog.isDebugEnabled()) {
1072 saxLog.trace("endElement(" + namespaceURI + "," + localName + "," + qName + ")");
1073 }
1074 log.trace(" match='" + match + "'");
1075 log.trace(" bodyText='" + bodyText + "'");
1076 }
1077
1078 // Parse system properties
1079 bodyText = updateBodyText(bodyText);
1080
1081 // the actual element name is either in localName or qName, depending
1082 // on whether the parser is namespace aware
1083 String name = localName;
1084 if ((name == null) || (name.isEmpty())) {
1085 name = qName;
1086 }
1087
1088 // Fire "body" events for all relevant rules
1089 List<Rule> rules = matches.pop();
1090 if ((rules != null) && (!rules.isEmpty())) {
1091 String bodyText = this.bodyText.toString().intern();
1092 for (Rule rule : rules) {
1093 try {
1094 if (debug) {
1095 log.trace(" Fire body() for " + rule);
1096 }
1097 rule.body(namespaceURI, name, bodyText);
1098 } catch (Exception e) {
1099 log.error(sm.getString("digester.error.body"), e);
1100 throw createSAXException(e);
1101 } catch (Error e) {
1102 log.error(sm.getString("digester.error.body"), e);
1103 throw e;
1104 }
1105 }
1106 } else {
1107 if (debug) {
1108 log.trace(sm.getString("digester.noRulesFound", match));
1109 }
1110 if (rulesValidation) {
1111 log.warn(sm.getString("digester.noRulesFound", match));
1112 }
1113 }
1114
1115 // Recover the body text from the surrounding element
1116 bodyText = bodyTexts.pop();
1117
1118 // Fire "end" events for all relevant rules in reverse order
1119 if (rules != null) {
1120 for (int i = 0; i < rules.size(); i++) {
1121 int j = (rules.size() - i) - 1;
1122 try {

Callers

nothing calls this directly

Calls 15

updateBodyTextMethod · 0.95
bodyMethod · 0.95
createSAXExceptionMethod · 0.95
endMethod · 0.95
isTraceEnabledMethod · 0.65
isDebugEnabledMethod · 0.65
traceMethod · 0.65
toStringMethod · 0.65
errorMethod · 0.65
getStringMethod · 0.65
warnMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected