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 writeDefineFontInfo2(Element parentElement, DefineFontInfo2 tag) { Element element = parentElement.addElement("definefontinfo2"); element.addAttribute("fontid", Integer.toString(tag.getFontId())); element.addAttribute("fontname", tag.getFontName()); if (tag.isBold()) { element.addAttribute("bold", "true"); }/*from ww w . j av a 2s. c o m*/ if (tag.isItalic()) { element.addAttribute("italic", "true"); } if (tag.isSmallText()) { element.addAttribute("smalltext", "true"); } writeLanguage(element, tag.getLangCode()); char[] codeTable = tag.getCodeTable(); for (int i = 0; i < codeTable.length; i++) { element.addElement("char").addText(Character.toString(codeTable[i])); } }
From source file:com.jswiff.xml.TagXMLWriter.java
License:Open Source License
private static void writeDefineMorphShape(Element parentElement, DefineMorphShape tag) { Element element = parentElement.addElement("definemorphshape"); element.addAttribute("charid", Integer.toString(tag.getCharacterId())); Shape startShape = tag.getStartShape(); Shape endShape = tag.getEndShape(); MorphLineStyles morphLineStyles = tag.getMorphLineStyles(); MorphFillStyles morphFillStyles = tag.getMorphFillStyles(); boolean zeroOffset = ((startShape == null) || (endShape == null) || (morphLineStyles == null) || (morphFillStyles == null)); Element startElement = element.addElement("start"); RecordXMLWriter.writeRect(startElement, "bounds", tag.getStartBounds()); Element endElement = element.addElement("end"); RecordXMLWriter.writeRect(endElement, "bounds", tag.getEndBounds()); if (!zeroOffset) { RecordXMLWriter.writeShape(startElement, startShape); RecordXMLWriter.writeShape(endElement, endShape); RecordXMLWriter.writeMorphLineStyles(element, morphLineStyles); RecordXMLWriter.writeMorphFillStyles(element, morphFillStyles); }// w ww . j a va 2 s.com }
From source file:com.jswiff.xml.TagXMLWriter.java
License:Open Source License
private static void writeDefineMorphShape2(Element parentElement, DefineMorphShape2 tag) { Element element = parentElement.addElement("definemorphshape2"); element.addAttribute("charid", Integer.toString(tag.getCharacterId())); Shape startShape = tag.getStartShape(); Shape endShape = tag.getEndShape(); MorphLineStyles morphLineStyles = tag.getMorphLineStyles(); MorphFillStyles morphFillStyles = tag.getMorphFillStyles(); boolean zeroOffset = ((startShape == null) || (endShape == null) || (morphLineStyles == null) || (morphFillStyles == null)); Element startElement = element.addElement("start"); RecordXMLWriter.writeRect(startElement, "shapebounds", tag.getStartShapeBounds()); RecordXMLWriter.writeRect(startElement, "edgebounds", tag.getStartEdgeBounds()); Element endElement = element.addElement("end"); RecordXMLWriter.writeRect(endElement, "shapebounds", tag.getEndShapeBounds()); RecordXMLWriter.writeRect(endElement, "edgebounds", tag.getEndEdgeBounds()); if (!zeroOffset) { RecordXMLWriter.writeShape(startElement, startShape); RecordXMLWriter.writeShape(endElement, endShape); RecordXMLWriter.writeMorphLineStyles(element, morphLineStyles); RecordXMLWriter.writeMorphFillStyles(element, morphFillStyles); }/*from w w w . j a v a 2 s . co m*/ }
From source file:com.jswiff.xml.TagXMLWriter.java
License:Open Source License
private static void writeDefineShape(Element parentElement, DefineShape tag) { Element element = parentElement.addElement("defineshape"); element.addAttribute("charid", Integer.toString(tag.getCharacterId())); RecordXMLWriter.writeRect(element, "bounds", tag.getShapeBounds()); RecordXMLWriter.writeShapeWithStyle(element, tag.getShapes()); }
From source file:com.jswiff.xml.TagXMLWriter.java
License:Open Source License
private static void writeDefineShape2(Element parentElement, DefineShape2 tag) { Element element = parentElement.addElement("defineshape2"); element.addAttribute("charid", Integer.toString(tag.getCharacterId())); RecordXMLWriter.writeRect(element, "bounds", tag.getShapeBounds()); RecordXMLWriter.writeShapeWithStyle(element, tag.getShapes()); }
From source file:com.jswiff.xml.TagXMLWriter.java
License:Open Source License
private static void writeDefineShape3(Element parentElement, DefineShape3 tag) { Element element = parentElement.addElement("defineshape3"); element.addAttribute("charid", Integer.toString(tag.getCharacterId())); RecordXMLWriter.writeRect(element, "bounds", tag.getShapeBounds()); RecordXMLWriter.writeShapeWithStyle(element, tag.getShapes()); }
From source file:com.jswiff.xml.TagXMLWriter.java
License:Open Source License
private static void writeDefineShape4(Element parentElement, DefineShape4 tag) { Element element = parentElement.addElement("defineshape4"); element.addAttribute("charid", Integer.toString(tag.getCharacterId())); RecordXMLWriter.writeRect(element, "shapebounds", tag.getShapeBounds()); RecordXMLWriter.writeRect(element, "edgebounds", tag.getEdgeBounds()); RecordXMLWriter.writeShapeWithStyle(element, tag.getShapes()); }
From source file:com.jswiff.xml.TagXMLWriter.java
License:Open Source License
private static void writeDefineSound(Element parentElement, DefineSound tag) { Element element = parentElement.addElement("definesound"); element.addAttribute("charid", Integer.toString(tag.getCharacterId())); element.addAttribute("format", getSoundFormatString(tag.getFormat())); element.addAttribute("rate", getSoundRateString(tag.getRate())); if (tag.is16BitSample()) { element.addAttribute("sample16bit", "true"); }// w ww . java 2 s. c om if (tag.isStereo()) { element.addAttribute("stereo", "true"); } element.addAttribute("samplecount", Long.toString(tag.getSampleCount())); element.addText(Base64.encode(tag.getSoundData())); }
From source file:com.jswiff.xml.TagXMLWriter.java
License:Open Source License
private static void writeDefineSprite(Element parentElement, DefineSprite tag) { Element element = parentElement.addElement("definesprite"); element.addAttribute("charid", Integer.toString(tag.getCharacterId())); for (Iterator it = tag.getControlTags().iterator(); it.hasNext();) { Tag controlTag = (Tag) it.next(); writeTag(element, controlTag);//from ww 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 writeDefineText(Element parentElement, DefineText tag) { Element element = parentElement.addElement("definetext"); element.addAttribute("charid", Integer.toString(tag.getCharacterId())); RecordXMLWriter.writeRect(element, "bounds", tag.getTextBounds()); RecordXMLWriter.writeMatrix(element, "matrix", tag.getTextMatrix()); Element textRecordsElement = element.addElement("textrecords"); TextRecord[] textRecords = tag.getTextRecords(); for (int i = 0; i < textRecords.length; i++) { RecordXMLWriter.writeTextRecord(textRecordsElement, textRecords[i]); }//from ww w . ja v a 2 s . c o m }