List of usage examples for org.dom4j Element getText
String getText();
From source file:com.jswiff.xml.TagXMLReader.java
License:Open Source License
private static Tag readDefineFontInfo2(Element tagElement) { int fontId = RecordXMLReader.getIntAttribute("fontid", tagElement); String fontName = getStringAttribute("fontname", tagElement); List charElements = tagElement.elements(); int arrayLength = charElements.size(); char[] codeTable = new char[arrayLength]; for (int i = 0; i < arrayLength; i++) { Element charElement = (Element) charElements.get(i); codeTable[i] = charElement.getText().charAt(0); }/*from w w w . jav a 2 s.c o m*/ DefineFontInfo2 defineFontInfo2 = new DefineFontInfo2(fontId, fontName, codeTable, readLangCode(tagElement)); if (RecordXMLReader.getBooleanAttribute("bold", tagElement)) { defineFontInfo2.setBold(true); } if (RecordXMLReader.getBooleanAttribute("italic", tagElement)) { defineFontInfo2.setItalic(true); } if (RecordXMLReader.getBooleanAttribute("smalltext", tagElement)) { defineFontInfo2.setSmallText(true); } return defineFontInfo2; }
From source file:com.jswiff.xml.TagXMLReader.java
License:Open Source License
private static Tag readDefineSound(Element tagElement) { int characterId = RecordXMLReader.getCharacterId(tagElement); byte format = getSoundFormat(getStringAttribute("format", tagElement)); byte rate = getSoundRate(getStringAttribute("rate", tagElement)); boolean is16BitSample = RecordXMLReader.getBooleanAttribute("sample16bit", tagElement); boolean isStereo = RecordXMLReader.getBooleanAttribute("stereo", tagElement); long sampleCount = RecordXMLReader.getLongAttribute("samplecount", tagElement); byte[] soundData = Base64.decode(tagElement.getText()); return new DefineSound(characterId, format, rate, is16BitSample, isStereo, sampleCount, soundData); }
From source file:com.jswiff.xml.TagXMLReader.java
License:Open Source License
private static Tag readJPEGTables(Element tagElement) { Element jpegDataElement = RecordXMLReader.getElement("jpegdata", tagElement); byte[] jpegData = Base64.decode(jpegDataElement.getText()); return new JPEGTables(jpegData); }
From source file:com.jswiff.xml.TagXMLReader.java
License:Open Source License
private static Tag readMetadata(Element tagElement) { return new Metadata(tagElement.getText()); }
From source file:com.jswiff.xml.TagXMLReader.java
License:Open Source License
private static Tag readVideoFrame(Element tagElement) { int streamId = RecordXMLReader.getIntAttribute("streamid", tagElement); int frameNum = RecordXMLReader.getIntAttribute("framenum", tagElement); byte[] videoData = Base64.decode(tagElement.getText()); return new VideoFrame(streamId, frameNum, videoData); }
From source file:com.jswiff.xml.XMLReader.java
License:Open Source License
private void parseHeader(Element headerElement) { short swfVersion = RecordXMLReader.getShortAttribute("swfversion", headerElement); swfDocument.setVersion(swfVersion);/*from w w w . j a v a2s . com*/ swfDocument.setCompressed(RecordXMLReader.getBooleanAttribute("compressed", headerElement)); Element framesElement = RecordXMLReader.getElement("frames", headerElement); swfDocument.setFrameCount(RecordXMLReader.getIntAttribute("count", framesElement)); swfDocument.setFrameRate(RecordXMLReader.getShortAttribute("rate", framesElement)); Element sizeElement = RecordXMLReader.getElement("size", framesElement); swfDocument.setFrameSize(RecordXMLReader.readRect(sizeElement)); Element backgroundColorElement = RecordXMLReader.getElement("bgcolor", headerElement); swfDocument.setBackgroundColor(RecordXMLReader.readRGB(backgroundColorElement)); if (swfVersion >= 8) { String access = RecordXMLReader.getStringAttribute("access", headerElement); if (access.equals("local")) { swfDocument.setAccessMode(SWFDocument.ACCESS_MODE_LOCAL); } else if (access.equals("network")) { swfDocument.setAccessMode(SWFDocument.ACCESS_MODE_NETWORK); } Element metadata = headerElement.element("metadata"); if (metadata != null) { swfDocument.setMetadata(Base64.decodeString(metadata.getText())); } } }
From source file:com.kingmed.dp.mail.util.XMLHandler.java
@SuppressWarnings("rawtypes") public static Map<String, String> transXmltoMapForSpec(String xmlInfo) throws DocumentException { Document doc = DocumentHelper.parseText(xmlInfo); // xml Map<String, String> map = new HashMap<String, String>(); Element rootElt = doc.getRootElement(); Iterator iter = rootElt.elementIterator(); while (iter.hasNext()) { Element dataElement = (Element) iter.next(); map.put(dataElement.getName(), dataElement.getText()); }//www . j a va 2 s . co m Element e = (Element) (rootElt.element("specimen").elements().get(0)); map.put("specimen", e.asXML()); return map; }
From source file:com.kingmed.dp.mail.util.XMLHandler.java
public static Map<String, Object> transXmltoMapForReport(String xmlInfo) throws DocumentException { Document doc = DocumentHelper.parseText(xmlInfo); // xml Map<String, Object> map = new HashMap<String, Object>(); Element rootElt = doc.getRootElement(); @SuppressWarnings("rawtypes") Iterator iter = rootElt.elementIterator(); while (iter.hasNext()) { Element dataElement = (Element) iter.next(); map.put(dataElement.getName(), dataElement.getText()); }/*from w ww .j a v a 2 s . c o m*/ /* Element e = (Element) (rootElt.element("Data")); String data = ""; if (e != null) { data = ((Element) e.elements().get(0)).asXML(); map.put("Data", "<Data>" + data + "</Data>"); } else { data = xmlInfo; map.put("Data", data); } */ return map; }
From source file:com.kingmed.dp.mail.util.XMLHandler.java
public static Map<String, String> transSimpleXmltoMap(String xmlInfo) throws DocumentException { Document doc = DocumentHelper.parseText(xmlInfo); // xml Map<String, String> map = new HashMap<String, String>(); Element rootElt = doc.getRootElement(); @SuppressWarnings("rawtypes") Iterator iter = rootElt.elementIterator(); while (iter.hasNext()) { Element dataElement = (Element) iter.next(); map.put(dataElement.getName(), dataElement.getText()); }/*from ww w.ja v a2 s . c o m*/ return map; }
From source file:com.kingmed.yuyt.util.XMLHandler.java
public static Map<String, String> transXmltoMapForSpec(String xmlInfo) throws DocumentException { Document doc = DocumentHelper.parseText(xmlInfo); // xml Map<String, String> map = new HashMap<String, String>(); Element rootElt = doc.getRootElement(); Iterator iter = rootElt.elementIterator(); while (iter.hasNext()) { Element dataElement = (Element) iter.next(); map.put(dataElement.getName(), dataElement.getText()); }//from ww w. ja v a2 s . c om Element e = (Element) (rootElt.element("specimen").elements().get(0)); map.put("specimen", e.asXML()); return map; }