Example usage for org.dom4j Element addAttribute

List of usage examples for org.dom4j Element addAttribute

Introduction

In this page you can find the example usage for org.dom4j Element addAttribute.

Prototype

Element addAttribute(QName qName, String value);

Source Link

Document

Adds the attribute value of the given fully qualified name.

Usage

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 writeSetTarget(Element parentElement, SetTarget setTarget) {
    Element element = parentElement.addElement("settarget");
    element.addAttribute("name", setTarget.getName());
    return element;
}

From source file:com.jswiff.xml.ActionXMLWriter.java

License:Open Source License

private static Element writeStoreRegister(Element parentElement, StoreRegister storeRegister) {
    Element element = parentElement.addElement("storeregister");
    element.addAttribute("number", Short.toString(storeRegister.getNumber()));
    return element;
}

From source file:com.jswiff.xml.ActionXMLWriter.java

License:Open Source License

private static Element writeTry(Element parentElement, Try tryAction) {
    Element element = parentElement.addElement("try");
    if (tryAction.catchInRegister()) {
        element.addAttribute("catchregister", Short.toString(tryAction.getCatchRegister()));
    } else {/*  w w w .  ja v  a  2 s  . co m*/
        element.addAttribute("catchvariable", tryAction.getCatchVariable());
    }
    RecordXMLWriter.writeActionBlock(element.addElement("try"), tryAction.getTryBlock());
    if (tryAction.hasCatchBlock()) {
        RecordXMLWriter.writeActionBlock(element.addElement("catch"), tryAction.getCatchBlock());
    }
    if (tryAction.hasFinallyBlock()) {
        RecordXMLWriter.writeActionBlock(element.addElement("finally"), tryAction.getFinallyBlock());
    }
    return element;
}

From source file:com.jswiff.xml.ActionXMLWriter.java

License:Open Source License

private static Element writeUnknown(Element parentElement, UnknownAction action) {
    Element element = parentElement.addElement("unknownaction");
    element.addAttribute("code", Integer.toString(action.getCode()));
    element.addText(Base64.encode(action.getData()));
    return element;
}

From source file:com.jswiff.xml.ActionXMLWriter.java

License:Open Source License

private static Element writeWaitForFrame(Element parentElement, WaitForFrame waitForFrame) {
    Element element = parentElement.addElement("waitforframe");
    element.addAttribute("frame", Integer.toString(waitForFrame.getFrame()));
    element.addAttribute("skipcount", Short.toString(waitForFrame.getSkipCount()));
    return element;
}

From source file:com.jswiff.xml.ActionXMLWriter.java

License:Open Source License

private static Element writeWaitForFrame2(Element parentElement, WaitForFrame2 waitForFrame2) {
    Element element = parentElement.addElement("waitforframe2");
    element.addAttribute("skipcount", Short.toString(waitForFrame2.getSkipCount()));
    return element;
}

From source file:com.jswiff.xml.RecordXMLWriter.java

License:Open Source License

static void writeAlignmentZones(Element parentElement, AlignmentZone[] alignmentZones) {
    Element element = parentElement.addElement("zones");
    for (int i = 0; i < alignmentZones.length; i++) {
        AlignmentZone zone = alignmentZones[i];
        Element zoneElement = element.addElement("zone");
        if (zone.hasX()) {
            zoneElement.addAttribute("left", StringUtilities.doubleToString(zone.getLeft()));
            zoneElement.addAttribute("width", StringUtilities.doubleToString(zone.getWidth()));
        }//ww  w .  ja  v  a 2  s . c  o  m
        if (zone.hasY()) {
            zoneElement.addAttribute("baseline", StringUtilities.doubleToString(zone.getBaseline()));
            zoneElement.addAttribute("height", StringUtilities.doubleToString(zone.getHeight()));
        }
    }
}

From source file:com.jswiff.xml.RecordXMLWriter.java

License:Open Source License

static void writeButtonCondAction(Element parentElement, ButtonCondAction buttonCondAction) {
    Element element = parentElement.addElement("buttoncondaction");
    if (buttonCondAction.isOutDownToIdle()) {
        element.addAttribute("outdowntoidle", "true");
    }/*from  w  w w.j  a  va 2  s . c  o m*/
    if (buttonCondAction.isOutDownToOverDown()) {
        element.addAttribute("outdowntooverdown", "true");
    }
    if (buttonCondAction.isIdleToOverDown()) {
        element.addAttribute("idletooverdown", "true");
    }
    if (buttonCondAction.isIdleToOverUp()) {
        element.addAttribute("idletooverup", "true");
    }
    if (buttonCondAction.isOverDownToIdle()) {
        element.addAttribute("overdowntoidle", "true");
    }
    if (buttonCondAction.isOverDownToOutDown()) {
        element.addAttribute("overdowntooutdown", "true");
    }
    if (buttonCondAction.isOverDownToOverUp()) {
        element.addAttribute("overdowntooverup", "true");
    }
    if (buttonCondAction.isOverUpToIdle()) {
        element.addAttribute("overuptoidle", "true");
    }
    if (buttonCondAction.isOverUpToOverDown()) {
        element.addAttribute("overuptooverdown", "true");
    }
    byte keyPress = buttonCondAction.getKeyPress();
    if (keyPress != 0) {
        element.addAttribute("keypress", Byte.toString(keyPress));
    }
    RecordXMLWriter.writeActionBlock(element, buttonCondAction.getActions());
}