001/*
002 * Copyright 2006-2007 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.batch.item.xml.stax;
018
019import javax.xml.stream.XMLEventReader;
020
021
022/**
023 * Interface for event readers which support treating XML fragments as standalone XML documents
024 * by wrapping the fragments with StartDocument and EndDocument events.
025 * 
026 * @author Robert Kasanicky
027 */
028public interface FragmentEventReader extends XMLEventReader {
029
030        /**
031         * Tells the event reader its cursor position is exactly before the fragment.
032         */
033        void markStartFragment();
034        
035        /**
036         * Tells the event reader the current fragment has been processed.
037         * If the cursor is still inside the fragment it should be moved
038         * after the end of the fragment.
039         */
040        void markFragmentProcessed();
041        
042        /**
043         * Reset the state of the fragment reader - make it forget
044         * it assumptions about current position of cursor
045         * (e.g. in case of rollback of the wrapped reader).
046         */
047        void reset();
048
049}