Example usage for org.dom4j Element addElement

List of usage examples for org.dom4j Element addElement

Introduction

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

Prototype

Element addElement(String name);

Source Link

Document

Adds a new Element node with the given name to this branch and returns a reference to the new node.

Usage

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

License:Open Source License

private static void writeImportAssets2(Element parentElement, ImportAssets2 tag) {
    Element element = parentElement.addElement("importassets2");
    element.addAttribute("url", tag.getUrl());
    ImportAssets.ImportMapping[] mappings = tag.getImportMappings();
    for (int i = 0; i < mappings.length; i++) {
        ImportAssets.ImportMapping mapping = mappings[i];
        Element mappingElement = element.addElement("importmapping");
        mappingElement.addAttribute("name", mapping.getName());
        mappingElement.addAttribute("charid", Integer.toString(mapping.getCharacterId()));
    }//from  w  w w. j  a v a 2  s. c  om
}

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

License:Open Source License

private static void writeJPEGTables(Element parentElement, JPEGTables tag) {
    Element element = parentElement.addElement("jpegtables");
    element.addElement("jpegdata").addText(Base64.encode(tag.getJpegData()));
}

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

License:Open Source License

private static void writeMalformedTag(Element parentElement, MalformedTag tag) {
    Element element = parentElement.addElement("malformedtag");
    element.addAttribute("code", Integer.toString(tag.getCode()));
    Exception exception = tag.getException();
    Element exceptionElement = element.addElement("exception");
    exceptionElement.addAttribute("class", exception.getClass().getName());
    exceptionElement.addAttribute("message", exception.toString());
    element.addElement("data").addText(Base64.encode(tag.getData()));
}

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

License:Open Source License

private static void writePlaceObject(Element parentElement, PlaceObject tag) {
    Element element = parentElement.addElement("placeobject");
    element.addAttribute("charid", Integer.toString(tag.getCharacterId()));
    element.addAttribute("depth", Integer.toString(tag.getDepth()));
    RecordXMLWriter.writeMatrix(element, tag.getMatrix());
    CXform colorTransform = tag.getColorTransform();
    if (colorTransform != null) {
        RecordXMLWriter.writeCXForm(element, colorTransform);
    }/*  w ww . jav  a 2  s.co  m*/
}

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

License:Open Source License

private static void writePlaceObject2(Element parentElement, PlaceObject2 tag) {
    Element element = parentElement.addElement("placeobject2");
    element.addAttribute("depth", Integer.toString(tag.getDepth()));
    if (tag.hasCharacter()) {
        element.addAttribute("charid", Integer.toString(tag.getCharacterId()));
    }/*from w w w . j a  v  a 2s.  co m*/
    if (tag.hasName()) {
        element.addAttribute("name", tag.getName());
    }
    if (tag.isMove()) {
        element.addAttribute("move", "true");
    }
    if (tag.hasMatrix()) {
        RecordXMLWriter.writeMatrix(element, tag.getMatrix());
    }
    if (tag.hasColorTransform()) {
        RecordXMLWriter.writeCXFormWithAlpha(element, tag.getColorTransform());
    }
    if (tag.hasRatio()) {
        element.addAttribute("ratio", Integer.toString(tag.getRatio()));
    }
    if (tag.hasClipDepth()) {
        element.addAttribute("clipdepth", Integer.toString(tag.getClipDepth()));
    }
    if (tag.hasClipActions()) {
        RecordXMLWriter.writeClipActions(element, tag.getClipActions());
    }
}

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

License:Open Source License

private static void writePlaceObject3(Element parentElement, PlaceObject3 tag) {
    Element element = parentElement.addElement("placeobject3");
    element.addAttribute("depth", Integer.toString(tag.getDepth()));
    if (tag.hasCharacter()) {
        element.addAttribute("charid", Integer.toString(tag.getCharacterId()));
    }/*from www  .java 2s . c om*/
    if (tag.hasName()) {
        element.addAttribute("name", tag.getName());
    }
    if (tag.isMove()) {
        element.addAttribute("move", "true");
    }
    if (tag.hasMatrix()) {
        RecordXMLWriter.writeMatrix(element, tag.getMatrix());
    }
    if (tag.hasColorTransform()) {
        RecordXMLWriter.writeCXFormWithAlpha(element, tag.getColorTransform());
    }
    if (tag.hasRatio()) {
        element.addAttribute("ratio", Integer.toString(tag.getRatio()));
    }
    if (tag.hasClipDepth()) {
        element.addAttribute("clipdepth", Integer.toString(tag.getClipDepth()));
    }
    if (tag.hasClipActions()) {
        RecordXMLWriter.writeClipActions(element, tag.getClipActions());
    }
    if (tag.hasBlendMode()) {
        element.addAttribute("blendmode", BlendMode.getDescription(tag.getBlendMode()));
    }
    if (tag.isCacheAsBitmap()) {
        element.addAttribute("cacheasbitmap", "true");
    }
    if (tag.hasFilters()) {
        RecordXMLWriter.writeFilters(element, tag.getFilters());
    }
}

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

License:Open Source License

private static void writeProtect(Element parentElement, Protect tag) {
    Element element = parentElement.addElement("protect");
    String password = tag.getPassword();
    if (password != null) {
        element.addElement("password", tag.getPassword());
    }//  w w w .  j  a  v  a 2  s . c  o  m
}

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

License:Open Source License

private static void writeRemoveObject(Element parentElement, RemoveObject tag) {
    Element element = parentElement.addElement("removeobject");
    element.addAttribute("charid", Integer.toString(tag.getCharacterId()));
    element.addAttribute("depth", Integer.toString(tag.getDepth()));
}

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

License:Open Source License

private static void writeRemoveObject2(Element parentElement, RemoveObject2 tag) {
    Element element = parentElement.addElement("removeobject2");
    element.addAttribute("depth", Integer.toString(tag.getDepth()));
}

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

License:Open Source License

private static void writeScale9Grid(Element parentElement, Scale9Grid tag) {
    Element element = parentElement.addElement("scale9grid");
    element.addAttribute("charid", Integer.toString(tag.getCharacterId()));
    RecordXMLWriter.writeRect(element, "grid", tag.getGrid());
}