⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 staxterminateactionfactory.java

📁 Software Testing Automation Framework (STAF)的开发代码
💻 JAVA
字号:
/*****************************************************************************//* Software Testing Automation Framework (STAF)                              *//* (C) Copyright IBM Corp. 2002                                              *//*                                                                           *//* This software is licensed under the Common Public License (CPL) V1.0.     *//*****************************************************************************/package com.ibm.staf.service.stax;import org.w3c.dom.Node;import org.w3c.dom.NamedNodeMap;import org.w3c.dom.NodeList;public class STAXTerminateActionFactory implements STAXActionFactory{    private static String fDTDInfo ="\n" +"<!--================= The Terminate Element ======================== -->\n" +"<!--\n" +"     The terminate element specifies to terminate a block in the job.\n" +"     If an if attribute is specified and it evaluates via Python to\n" +"     false, the terminate element is ignored.\n" +"-->\n" +"<!ELEMENT terminate  EMPTY>\n" +"<!ATTLIST terminate\n" +"          block      CDATA    #IMPLIED\n" +"          if         CDATA    \"1\"\n" +">\n";    public String getDTDInfo()    {        return fDTDInfo;    }    public String getDTDTaskName()    {        return "terminate";    }    public STAXAction parseAction(STAX staxService, STAXJob job,                                  org.w3c.dom.Node root) throws STAXException    {        String blockName = null;        String ifAttr = "1";        NamedNodeMap attrs = root.getAttributes();        for (int i = 0; i < attrs.getLength(); ++i)        {            Node thisAttr = attrs.item(i);            String errorInfo = "\n  Element: " + root.getNodeName() +               "  Attribute: " + thisAttr.getNodeName();            if (thisAttr.getNodeName().equals("block"))            {                blockName = STAXUtil.parseAndCompileForPython(                    thisAttr.getNodeValue(), errorInfo);            }            else if (thisAttr.getNodeName().equals("if"))            {                ifAttr = STAXUtil.parseAndCompileForPython(                    thisAttr.getNodeValue(), errorInfo);            }            else            {                throw new STAXInvalidXMLAttributeException(                          root.getNodeName() + ": " + thisAttr.getNodeName());            }        }        NodeList children = root.getChildNodes();        for (int i = 0; i < children.getLength(); ++i)        {            Node thisChild = children.item(i);            if (thisChild.getNodeType() == Node.COMMENT_NODE)            {                /* Do nothing */            }            else            {                throw new STAXInvalidXMLNodeTypeException(                          Integer.toString(thisChild.getNodeType()));            }        }        return new STAXTerminateAction(blockName, ifAttr);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -