in core/src/main/java/org/apache/commons/jelly/parser/XMLParser.java [1195:1260]
public void startElement(
String namespaceURI,
String localName,
String qName,
Attributes list)
throws SAXException {
try {
// add check to ensure namespace URI is "" for no namespace
if ( namespaceURI == null ) {
namespaceURI = "";
}
// if this is a tag then create a script to run it
// otherwise pass the text to the current body
TagScript newTagScript = createTag(namespaceURI, localName, list);
if (newTagScript == null) {
newTagScript = createStaticTag(namespaceURI, localName, qName, list);
}
tagScript = newTagScript;
tagScriptStack.add(tagScript);
if (tagScript != null) {
// set the line number details
if ( locator != null ) {
tagScript.setLocator(locator);
}
// sets the file name element names
if (fileName != null)
tagScript.setFileName(fileName);
tagScript.setElementName(qName);
tagScript.setLocalName(localName);
if (textBuffer.length() > 0) {
addTextScript(textBuffer.toString());
textBuffer.setLength(0);
}
script.addScript(tagScript);
// start a new body
scriptStack.push(script);
script = new ScriptBlock();
tagScript.setTagBody(script);
}
else {
// XXXX: might wanna handle empty elements later...
textBuffer.append("<");
textBuffer.append(qName);
int size = list.getLength();
for (int i = 0; i < size; i++) {
textBuffer.append(" ");
textBuffer.append(list.getQName(i));
textBuffer.append("=");
textBuffer.append("\"");
textBuffer.append(list.getValue(i));
textBuffer.append("\"");
}
textBuffer.append(">");
}
}
catch (SAXException e) {
throw e;
}
catch (Exception e) {
log.error( "Caught exception: " + e, e );
throw new SAXException( "Runtime Exception: " + e, e );
}
}