Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.openfuxml.addon.wiki.emitter.injection;
 
 
 
 import  net.sf.exlp.util.xml.JaxbUtil;
 
import  org.openfuxml.addon.wiki.data.jaxb.Ofxgallery.Ofximage;
import  org.openfuxml.addon.wiki.data.jaxb.Wikiinjection;
import  org.slf4j.Logger;
import  org.slf4j.LoggerFactory;
public class OfxInjectionEmitter extends NestingEmitter
	final static Logger logger = LoggerFactory.getLogger(OfxInjectionEmitter.class);
	public OfxInjectionEmitter(EmitterFactory efString injectionDir)
	{
		super(ef);
		this.=injectionDir;
	}
	protected boolean localStart(XMLStreamWriter writerString htmlElementNameAttributes attsthrows XMLStreamException
	{
		Wikiinjection injection = new Wikiinjection();
		injection.setFormat(atts.getValue("format"));
		injection.setId(atts.getValue("id"));
		injection.setOfxtag(atts.getValue("ofxtag"));
		injection.setWikitag(atts.getValue("wikitag"));
		JdomXmlStreamer jdomStreamer = new JdomXmlStreamer(writer);
		if(injection.getOfxtag().equals("ofxchart"))
		{
			OfxChartEmitter chartEmitter = new OfxChartEmitter(injection);
			chartEmitter.transform(jdomStreamer);
		}
		if(injection.getOfxtag().equals("ofxgallery"))
		{
			String injectionName = injection.getId()+"-"+injection.getOfxtag();
			String xmlFile = +"/"+injectionName+".xml";
			try
			{
				injection = (Wikiinjection)JaxbUtil.loadJAXB(xmlFile, Wikiinjection.class);
			}
			{
				// TODO Auto-generated catch block
			}
			int i=0;
			for(Ofximage image : injection.getOfxgallery().get(0).getOfximage())
			{
				i++;
				OfxImageEmitter imageEmitter = new OfxImageEmitter(image,injectionName+"-"+i);
				imageEmitter.transform(jdomStreamer);
			}
		}
		else{.warn("Unkown ofxtag: "+injection.getOfxtag());}
		return true;
	}
New to GrepCode? Check out our FAQ X