本文整理汇总了Java中org.apache.xalan.templates.ElemLiteralResult类的典型用法代码示例。如果您正苦于以下问题:Java ElemLiteralResult类的具体用法?Java ElemLiteralResult怎么用?Java ElemLiteralResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ElemLiteralResult类属于org.apache.xalan.templates包,在下文中一共展示了ElemLiteralResult类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: endElement
import org.apache.xalan.templates.ElemLiteralResult; //导入依赖的package包/类
/**
* Receive notification of the end of an element.
*
* @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
{
ElemTemplateElement elem = handler.getElemTemplateElement();
if (elem instanceof ElemLiteralResult)
{
if (((ElemLiteralResult) elem).getIsLiteralResultAsStylesheet())
{
handler.popStylesheet();
}
}
super.endElement(handler, uri, localName, rawName);
}
示例2: getInstruction
import org.apache.xalan.templates.ElemLiteralResult; //导入依赖的package包/类
static String getInstruction(ElemTemplateElement node) {
final String name = node.getNodeName();
if (node instanceof ElemLiteralResult) {
return name;
} else if (name != null && name.indexOf(':') == -1) {
return "xsl:" + name;
}
return name;
}
示例3: validate
import org.apache.xalan.templates.ElemLiteralResult; //导入依赖的package包/类
/**
* Non-recursive traversal of FunctionElement tree based on TreeWalker to verify that
* there are no literal result elements except within a func:result element and that
* the func:result element does not contain any following siblings except xsl:fallback.
*/
public void validate(ElemTemplateElement elem, StylesheetHandler handler)
throws SAXException
{
String msg = "";
while (elem != null)
{
//System.out.println("elem " + elem);
if (elem instanceof ElemExsltFuncResult
&& elem.getNextSiblingElem() != null
&& !(elem.getNextSiblingElem() instanceof ElemFallback))
{
msg = "func:result has an illegal following sibling (only xsl:fallback allowed)";
handler.error(msg, new SAXException(msg));
}
if((elem instanceof ElemApplyImport
|| elem instanceof ElemApplyTemplates
|| elem instanceof ElemAttribute
|| elem instanceof ElemCallTemplate
|| elem instanceof ElemComment
|| elem instanceof ElemCopy
|| elem instanceof ElemCopyOf
|| elem instanceof ElemElement
|| elem instanceof ElemLiteralResult
|| elem instanceof ElemNumber
|| elem instanceof ElemPI
|| elem instanceof ElemText
|| elem instanceof ElemTextLiteral
|| elem instanceof ElemValueOf)
&& !(ancestorIsOk(elem)))
{
msg ="misplaced literal result in a func:function container.";
handler.error(msg, new SAXException(msg));
}
ElemTemplateElement nextElem = elem.getFirstChildElem();
while (nextElem == null)
{
nextElem = elem.getNextSiblingElem();
if (nextElem == null)
elem = elem.getParentElem();
if (elem == null || elem instanceof ElemExsltFunction)
return; // ok
}
elem = nextElem;
}
}