List of usage examples for org.dom4j Element addAttribute
Element addAttribute(QName qName, String value);
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())); }/*www . j a v a 2 s. c o m*/ }
From source file:com.jswiff.xml.TagXMLWriter.java
License:Open Source License
private static void writeLanguage(Element parentElement, LangCode langCode) { if (langCode != null) { switch (langCode.getLanguageCode()) { case LangCode.LATIN: parentElement.addAttribute("language", "latin"); break; case LangCode.UNDEFINED: parentElement.addAttribute("language", "undefined"); break; case LangCode.JAPANESE: parentElement.addAttribute("language", "japanese"); break; case LangCode.KOREAN: parentElement.addAttribute("language", "korean"); break; case LangCode.SIMPLIFIED_CHINESE: parentElement.addAttribute("language", "simpchinese"); break; case LangCode.TRADITIONAL_CHINESE: parentElement.addAttribute("language", "tradchinese"); break; default://from w w w . j a v a2 s.c o m throw new IllegalArgumentException("Illegal language code: " + langCode.getLanguageCode()); } } }
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); }//ww w . j a va 2 s .c o 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())); }/* w ww.ja va2 s .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()); } }
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())); }/*ww w . j a v a 2s . c o 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()); } 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 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()); }
From source file:com.jswiff.xml.TagXMLWriter.java
License:Open Source License
private static void writeScriptLimits(Element parentElement, ScriptLimits tag) { Element element = parentElement.addElement("scriptlimits"); element.addAttribute("maxrecursiondepth", Integer.toString(tag.getMaxRecursionDepth())); element.addAttribute("scripttimeout", Integer.toString(tag.getScriptTimeoutSeconds())); }