use of org.apache.xalan.templates.ElemParam in project robovm by robovm.
the class ProcessorExsltFuncResult method startElement.
/**
* Verify that the func:result element does not appear within a variable,
* parameter, or another func:result, and that it belongs to a func:function
* element.
*/
public void startElement(StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes) throws SAXException {
String msg = "";
super.startElement(handler, uri, localName, rawName, attributes);
ElemTemplateElement ancestor = handler.getElemTemplateElement().getParentElem();
while (ancestor != null && !(ancestor instanceof ElemExsltFunction)) {
if (ancestor instanceof ElemVariable || ancestor instanceof ElemParam || ancestor instanceof ElemExsltFuncResult) {
msg = "func:result cannot appear within a variable, parameter, or another func:result.";
handler.error(msg, new SAXException(msg));
}
ancestor = ancestor.getParentElem();
}
if (ancestor == null) {
msg = "func:result must appear in a func:function element";
handler.error(msg, new SAXException(msg));
}
}
use of org.apache.xalan.templates.ElemParam in project j2objc by google.
the class ProcessorGlobalParamDecl method endElement.
/**
* Receive notification of the end of an element.
*
* @param name The element type name.
* @param attributes The specified or defaulted attributes.
*
* @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
* @param uri The Namespace URI, or an empty string.
* @param localName The local name (without prefix), or empty string if not namespace processing.
* @param rawName The qualified name (with prefix).
*/
public void endElement(StylesheetHandler handler, String uri, String localName, String rawName) throws org.xml.sax.SAXException {
ElemParam v = (ElemParam) handler.getElemTemplateElement();
handler.getStylesheet().appendChild(v);
handler.getStylesheet().setParam(v);
super.endElement(handler, uri, localName, rawName);
}
use of org.apache.xalan.templates.ElemParam in project intellij-community by JetBrains.
the class XalanStyleFrame method addVariable.
private void addVariable(ElemVariable variable, boolean global, Collection<Debugger.Variable> variables) {
final Debugger.Variable.Kind kind = variable instanceof ElemParam ? Debugger.Variable.Kind.PARAMETER : Debugger.Variable.Kind.VARIABLE;
assert global == variable.getIsTopLevel() : global + " vs. " + variable.getIsTopLevel() + " (" + variable.getName() + ")";
final String name = variable.getName().getLocalName();
try {
final Value value = kind == Debugger.Variable.Kind.PARAMETER ? // http://youtrack.jetbrains.net/issue/IDEA-78638
eval("$" + variable.getName().toString()) : new XObjectValue(variable.getValue(myTransformer, myCurrentNode));
variables.add(new VariableImpl(name, value, global, kind, variable.getSystemId(), variable.getLineNumber()));
} catch (TransformerException e) {
debug(e);
} catch (Debugger.EvaluationException e) {
debug(e);
}
}
use of org.apache.xalan.templates.ElemParam in project j2objc by google.
the class ProcessorExsltFuncResult method startElement.
/**
* Verify that the func:result element does not appear within a variable,
* parameter, or another func:result, and that it belongs to a func:function
* element.
*/
public void startElement(StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes) throws SAXException {
String msg = "";
super.startElement(handler, uri, localName, rawName, attributes);
ElemTemplateElement ancestor = handler.getElemTemplateElement().getParentElem();
while (ancestor != null && !(ancestor instanceof ElemExsltFunction)) {
if (ancestor instanceof ElemVariable || ancestor instanceof ElemParam || ancestor instanceof ElemExsltFuncResult) {
msg = "func:result cannot appear within a variable, parameter, or another func:result.";
handler.error(msg, new SAXException(msg));
}
ancestor = ancestor.getParentElem();
}
if (ancestor == null) {
msg = "func:result must appear in a func:function element";
handler.error(msg, new SAXException(msg));
}
}
use of org.apache.xalan.templates.ElemParam in project j2objc by google.
the class ProcessorExsltFunction method ancestorIsOk.
/**
* Verify that a literal result belongs to a result element, a variable,
* or a parameter.
*/
boolean ancestorIsOk(ElemTemplateElement child) {
while (child.getParentElem() != null && !(child.getParentElem() instanceof ElemExsltFunction)) {
ElemTemplateElement parent = child.getParentElem();
if (parent instanceof ElemExsltFuncResult || parent instanceof ElemVariable || parent instanceof ElemParam || parent instanceof ElemMessage)
return true;
child = parent;
}
return false;
}
Aggregations