// moment this splits a tag into two causing a
// failure later
continue;
} else if (node instanceof TagNode && ((TagNode) node).getTagName().startsWith("SWF:")) {
final TagNode tagNode = (TagNode) node;
final String tagName = tagNode.getTagName().toUpperCase();
LOG.debug(tagName);
// TODO remove context & request from Attributes -- the tags
// will be re-used across
// requests
final Attributes attributes = new Attributes(tagNode, context);
int type = 0;
if (tagNode.isEndTag()) {
type = SwfTag.END;
} else {
type = tagNode.isEmptyXmlTag() ? SwfTag.EMPTY : SwfTag.START;
}
testForProcessorForTag(lexer, tagName);
lineNumbers = lineNumbering(node);
final SwfTag tag = new SwfTag(tagName, attributes, type, lineNumbers, loadFile.getCanonicalPath());
tags.push(tag);
if (tagName.equals("SWF:IMPORT")) {
if (!tagNode.isEmptyXmlTag()) {
throw new ScimpiException("Import tag must be empty");
}
String importFile = tagNode.getAttribute("file");
if (context.isDebug()) {
context.getWriter().println("<!-- " + "import file " + importFile + " -->");
}
importFile = context.replaceVariables(importFile);
parseHtmlFile(loadPath, importFile, context, tags, tagsForPreviousTemplate);
}
if (tagName.equals("SWF:TEMPLATE")) {
if (!tagNode.isEmptyXmlTag()) {
throw new ScimpiException("Template tag must be empty");
}
if (template != null) {
throw new ScimpiException("Template tag can only be used once within a file");
}
template = tagNode.getAttribute("file");
template = context.replaceVariables(template);
if (context.isDebug()) {
context.getWriter().println("<!-- " + "apply template " + template + " -->");
}
tags = new Stack<Snippet>();
}
if (tagName.equals("SWF:CONTENT")) {
if (!tagNode.isEmptyXmlTag()) {
throw new ScimpiException("Content tag must be empty");
}
if (context.isDebug()) {
context.getWriter().println("<!-- " + "insert content into template -->");
}