public static boolean isArgumentNode(Node node) { return Argument.ELEM_NAME.equals(node.getName()); }
public static boolean isAllowedValueNode(Node node) { return ELEM_NAME.equals(node.getName()); }
public static boolean isActionNode(Node node) { return Action.ELEM_NAME.equals(node.getName()); }
public static boolean isStateVariableNode(Node node) { return StateVariable.ELEM_NAME.equals(node.getName()); }
public static boolean isIconNode(Node node) { return Icon.ELEM_NAME.equals(node.getName()); }
public static boolean isAllowedValueRangeNode(Node node) { return ELEM_NAME.equals(node.getName()); }
public static boolean isServiceNode(Node node) { return Service.ELEM_NAME.equals(node.getName()); }
public static boolean isDeviceNode(Node node) { return Device.ELEM_NAME.equals(node.getName()); }
public int getIndex(String name){ int index = -1; for (Iterator<Node> i = nodeList.iterator(); i.hasNext();) { index++; Node n = i.next(); if(n.getName().equals(name)) return index; } return index; }
public String getActionName() { Node node = getActionNode(); if (node == null) return ""; String name = node.getName(); if (name == null) return ""; int idx = name.indexOf(SOAP.DELIM)+1; if (idx < 0) return ""; return name.substring(idx, name.length()); }
public Node getNode(String name) { if (name == null) return null; int nLists = size(); for (int n=0; n<nLists; n++) { Node node = getNode(n); String nodeName = node.getName(); if (name.compareTo(nodeName) == 0) return node; } return null; }
public Node getEndsWith(String name) { if (name == null) return null; int nLists = size(); for (int n=0; n<nLists; n++) { Node node = getNode(n); String nodeName = node.getName(); if (nodeName == null) continue; if (nodeName.endsWith(name) == true) return node; } return null; } }
private Property getProperty(Node varNode) { Property prop = new Property(); if (varNode == null) return prop; // remove the event namespace String variableName = varNode.getName(); int index = variableName.lastIndexOf(':'); if (index != -1) variableName = variableName.substring(index + 1); prop.setName(variableName); prop.setValue(varNode.getValue()); return prop; }
public void output(PrintWriter ps, int indentLevel, boolean hasChildNode) { String indentString = getIndentLevelString(indentLevel); String name = getName(); String value = getValue(); if (hasNodes() == false || hasChildNode == false) { ps.print(indentString + "<" + name); outputAttributes(ps); // Thnaks for Tho Beisch (11/09/04) if (value == null || value.length() == 0) { // Not using the short notation <node /> because it cause compatibility trouble ps.println("></" + name + ">"); } else { ps.println(">" + XML.escapeXMLChars(value) + "</" + name + ">"); } return; } ps.print(indentString + "<" + name); outputAttributes(ps); ps.println(">"); int nChildNodes = getNNodes(); for (int n=0; n<nChildNodes; n++) { Node cnode = getNode(n); cnode.output(ps, indentLevel+1, true); } ps.println(indentString +"</" + name + ">"); }
public ArgumentList getResponse() { ArgumentList argList = new ArgumentList(); Node resNode = getActionResponseNode(); if (resNode == null) return argList; int nArgs = resNode.getNNodes(); for (int n=0; n<nArgs; n++) { Node node = resNode.getNode(n); String name = node.getName(); String value = node.getValue(); Argument arg = new Argument(name, value); argList.add(arg); } return argList; } }
public ArgumentList getArgumentList() { Node actNode = getActionNode(); int nArgNodes = actNode.getNNodes(); ArgumentList argList = new ArgumentList(); for (int n=0; n<nArgNodes; n++) { Argument arg = new Argument(); Node argNode = actNode.getNode(n); arg.setName(argNode.getName()); arg.setValue(argNode.getValue()); argList.add(arg); } return argList; }
public final static boolean isItemNode(Node node) { String name = node.getName(); if (name == null) return false; return name.equals(NAME); }
public static boolean isIconNode(Node node) { return Icon.ELEM_NAME.equals(node.getName()); }
public final static boolean isResourceNode(Node node) { String name = node.getName(); if (name == null) return false; return name.equals(NAME); }
public boolean set(Node otherNode) { if (otherNode == null) return false; setName(otherNode.getName()); setValue(otherNode.getValue()); removeAllAttributes(); int nOtherAttributes = otherNode.getNAttributes(); for (int n=0; n<nOtherAttributes; n++) { Attribute otherAttr = otherNode.getAttribute(n); Attribute thisAttr = new Attribute(otherAttr); addAttribute(thisAttr); } removeAllNodes(); int nOtherChildNodes = otherNode.getNNodes(); for (int n=0; n<nOtherChildNodes; n++) { Node otherChildNode = otherNode.getNode(n); Node thisChildNode = new Node(); thisChildNode.set(otherChildNode); addNode(thisChildNode); } return true; }