Package de.hybris.bootstrap.xml
Class UndoableXMLOutputter
- java.lang.Object
-
- org.znerd.xmlenc.XMLOutputter
-
- de.hybris.bootstrap.xml.UndoableXMLOutputter
-
- All Implemented Interfaces:
org.znerd.xmlenc.StatefulXMLEventListener,org.znerd.xmlenc.XMLEventListener,org.znerd.xmlenc.XMLEventListenerStates
public class UndoableXMLOutputter extends org.znerd.xmlenc.XMLOutputterXML outputter wrapper implementation which allows to write a certain amount of data and removing it afterwards from the output. This class uses aUndoableWriterWrapperinstance.UndoableXMLOutputter xout = new UndoableXMLOutputter(actualWriter); // start undoable writing xout.markSavePoint(); try { // ... write xml ... // finally store changes xout.commitSavePoint(); } catch (Exception e) { // discard any changes and restore outputter state xout.restoreSavePoint(); }
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcommitSavePoint()Stores all xml data which has been written sincemarkSavePoint()has been called to the underlying writer.booleanhasSavePoint()Tells whether or not undoable writing has been started or not.voidmarkSavePoint()Starts undoable xml writing.voidrestoreSavePoint()Discards all xml data which has been written sincemarkSavePoint()has been called.-
Methods inherited from class org.znerd.xmlenc.XMLOutputter
attribute, cdata, close, comment, declaration, dtd, endDocument, endTag, getElementStack, getElementStackCapacity, getElementStackSize, getEncoding, getIndentation, getLineBreak, getQuotationMark, getState, getWriter, isEscaping, pcdata, pcdata, pi, reset, reset, reset, setElementStackCapacity, setEscaping, setIndentation, setLineBreak, setQuotationMark, setState, startTag, whitespace, whitespace
-
-
-
-
Method Detail
-
markSavePoint
public void markSavePoint()
Starts undoable xml writing. Be sure to call eithercommitSavePoint()orrestoreSavePoint()at the end of undoable writing period.- Throws:
java.lang.IllegalStateException- if called twice before eithercommitSavePoint()orrestoreSavePoint()have been called
-
hasSavePoint
public boolean hasSavePoint()
Tells whether or not undoable writing has been started or not.
-
restoreSavePoint
public void restoreSavePoint()
Discards all xml data which has been written sincemarkSavePoint()has been called. The prevous outputter state is restored (opened tag, indentation level, ... ).From now on undoable writing is disabled until
markSavePoint()is called again.
-
commitSavePoint
public void commitSavePoint()
Stores all xml data which has been written sincemarkSavePoint()has been called to the underlying writer.From now on undoable writing is disabled until
markSavePoint()is called again.
-
-