List of usage examples for org.dom4j Element addElement
Element addElement(String name);
Element
node with the given name to this branch and returns a reference to the new node. From source file:com.jswiff.xml.ActionXMLWriter.java
License:Open Source License
private static Element writeDefineFunction2(Element parentElement, DefineFunction2 defineFunction2) { Element element = parentElement.addElement("definefunction2"); element.addAttribute("name", defineFunction2.getName()); element.addAttribute("registercount", Short.toString(defineFunction2.getRegisterCount())); RegisterParam[] parameters = defineFunction2.getParameters(); Element parametersElement = element.addElement("parameters"); for (int i = 0; i < parameters.length; i++) { RegisterParam parameter = parameters[i]; Element paramElement = parametersElement.addElement("registerparam"); paramElement.addAttribute("name", parameter.getParamName()); paramElement.addAttribute("register", Short.toString(parameter.getRegister())); }/*from w w w.j a v a 2 s . c o m*/ Element preloadElement = element.addElement("preload"); if (defineFunction2.preloadsArguments()) { preloadElement.addAttribute("arguments", "true"); } if (defineFunction2.preloadsGlobal()) { preloadElement.addAttribute("global", "true"); } if (defineFunction2.preloadsParent()) { preloadElement.addAttribute("parent", "true"); } if (defineFunction2.preloadsRoot()) { preloadElement.addAttribute("root", "true"); } if (defineFunction2.preloadsSuper()) { preloadElement.addAttribute("super", "true"); } if (defineFunction2.preloadsThis()) { preloadElement.addAttribute("this", "true"); } Element suppressElement = element.addElement("suppress"); if (defineFunction2.suppressesArguments()) { suppressElement.addAttribute("arguments", "true"); } if (defineFunction2.suppressesSuper()) { suppressElement.addAttribute("super", "true"); } if (defineFunction2.suppressesThis()) { suppressElement.addAttribute("this", "true"); } RecordXMLWriter.writeActionBlock(element, defineFunction2.getBody()); return element; }
From source file:com.jswiff.xml.ActionXMLWriter.java
License:Open Source License
private static Element writeGetURL(Element parentElement, GetURL getURL) { Element element = parentElement.addElement("geturl"); element.addAttribute("url", getURL.getURL()); element.addAttribute("target", getURL.getTarget()); return element; }
From source file:com.jswiff.xml.ActionXMLWriter.java
License:Open Source License
private static Element writeGetURL2(Element parentElement, GetURL2 getURL2) { Element element = parentElement.addElement("geturl2"); switch (getURL2.getSendVarsMethod()) { case GetURL2.METHOD_GET: element.addAttribute("sendvarsmethod", "get"); break;/*w w w.java 2 s . com*/ case GetURL2.METHOD_POST: element.addAttribute("sendvarsmethod", "post"); break; default: element.addAttribute("sendvarsmethod", "none"); } if (getURL2.isLoadTarget()) { element.addAttribute("loadtarget", "true"); } if (getURL2.isLoadVariables()) { element.addAttribute("loadvariables", "true"); } return element; }
From source file:com.jswiff.xml.ActionXMLWriter.java
License:Open Source License
private static Element writeGoToFrame(Element parentElement, GoToFrame goToFrame) { Element element = parentElement.addElement("gotoframe"); element.addAttribute("frame", Integer.toString(goToFrame.getFrame())); return element; }
From source file:com.jswiff.xml.ActionXMLWriter.java
License:Open Source License
private static Element writeGoToFrame2(Element parentElement, GoToFrame2 goToFrame2) { Element element = parentElement.addElement("gotoframe2"); element.addAttribute("scenebias", Integer.toString(goToFrame2.getSceneBias())); if (goToFrame2.play()) { element.addAttribute("play", "true"); }//from w w w. j a v a 2 s. co m return element; }
From source file:com.jswiff.xml.ActionXMLWriter.java
License:Open Source License
private static Element writeGoToLabel(Element parentElement, GoToLabel goToLabel) { Element element = parentElement.addElement("gotolabel"); element.addAttribute("framelabel", goToLabel.getFrameLabel()); return element; }
From source file:com.jswiff.xml.ActionXMLWriter.java
License:Open Source License
private static Element writeIf(Element parentElement, If ifAction) { Element element = parentElement.addElement("if"); element.addAttribute("branchlabel", ifAction.getBranchLabel()); return element; }
From source file:com.jswiff.xml.ActionXMLWriter.java
License:Open Source License
private static Element writeJump(Element parentElement, Jump jump) { Element element = parentElement.addElement("jump"); element.addAttribute("branchlabel", jump.getBranchLabel()); return element; }
From source file:com.jswiff.xml.ActionXMLWriter.java
License:Open Source License
private static Element writePush(Element parentElement, Push push) { Element element = parentElement.addElement("push"); List values = push.getValues(); for (Iterator it = values.iterator(); it.hasNext();) { Push.StackValue value = (Push.StackValue) it.next(); switch (value.getType()) { case Push.StackValue.TYPE_BOOLEAN: element.addElement("boolean").addAttribute("value", Boolean.toString(value.getBoolean())); break; case Push.StackValue.TYPE_CONSTANT_16: element.addElement("constant16").addAttribute("id", Integer.toString(value.getConstant16())); break; case Push.StackValue.TYPE_CONSTANT_8: element.addElement("constant8").addAttribute("id", Integer.toString(value.getConstant8())); break; case Push.StackValue.TYPE_DOUBLE: element.addElement("double").addAttribute("value", Double.toString(value.getDouble())); break; case Push.StackValue.TYPE_FLOAT: element.addElement("float").addAttribute("value", Float.toString(value.getFloat())); break; case Push.StackValue.TYPE_INTEGER: element.addElement("integer").addAttribute("value", Long.toString(value.getInteger())); break; case Push.StackValue.TYPE_NULL: element.addElement("null"); break; case Push.StackValue.TYPE_REGISTER: element.addElement("register").addAttribute("number", Short.toString(value.getRegisterNumber())); break; case Push.StackValue.TYPE_STRING: element.addElement("string").addAttribute("value", value.getString()); break; case Push.StackValue.TYPE_UNDEFINED: element.addElement("undefined"); break; }//from www .ja v a2s .c o m } return element; }
From source file:com.jswiff.xml.ActionXMLWriter.java
License:Open Source License
private static Element writeSetTarget(Element parentElement, SetTarget setTarget) { Element element = parentElement.addElement("settarget"); element.addAttribute("name", setTarget.getName()); return element; }