Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.openfuxml.addon.wiki.processor.ofx.emitter;
 
 import java.util.Map;
 
 
import  org.slf4j.Logger;
import  org.slf4j.LoggerFactory;
public class OfxListEmitter extends NestingEmitter
	final static Logger logger = LoggerFactory.getLogger(OfxListEmitter.class);
	public static enum Ordering {ordered,unordered}
	private Map<StringStringattributes;
	private Ordering ordering;
	private final static String tag = "list:list";
	public OfxListEmitter(EmitterFactory efOrdering ordering)
	{
		super(ef);
		this.=ordering;
	}
	public void setAttribute(String nameString value)
	{
		if ( == null)
		{
		}
		.put(namevalue);
	}
	protected boolean localStart(XMLStreamWriter writerString htmlElementNameAttributes attsthrows XMLStreamException
	{
		switch()
		{
			case typeOrdered(writer);break;
			case typeUnordered(writer);break;
		}
		boolean hasId = false;
		if ( != null)
		{
			for (Map.Entry<StringStringattr : .entrySet())
			{
				writer.writeAttribute(attr.getKey(), attr.getValue());
			}
			if (.containsKey("id")) {hasId = true;}
		}
		if(!hasId)
		{
			String elementId = atts.getValue("id");
			if (elementId != null)
			{
				writer.writeAttribute("id"elementId);
			}
		}
		return true;
	}
	protected boolean localEnd(XMLStreamWriter writerString htmlElementNamethrows XMLStreamException
	{
		return true;
	}
	private void typeOrdered(XMLStreamWriter writerthrows XMLStreamException
	{
		writer.writeStartElement("list:type");
		writer.writeAttribute("ordering""ordered");
	}
	private void typeUnordered(XMLStreamWriter writerthrows XMLStreamException
	{
		writer.writeStartElement("list:type");
		writer.writeAttribute("ordering""unordered");
	}
New to GrepCode? Check out our FAQ X