// Path: src/main/java/org/dynaform/xml/XmlVisitor.java
// public interface XmlVisitor {
// 
//   /**
//    * Handle text.
//    * 
//    * @param s text.
//    * @return XML event handler to be used as next.
//    */
//   XmlVisitor text(String s);
// 
//   /**
//    * Handle XML element start.
//    * 
//    * @param element name of the XML element.
//    * @return event handler for the XML element.
//    */
//   ElementVisitor visitElement(String element);
//   
//   /**
//    * Handle end of the XML element body.
//    * 
//    * @return event handler of the XML element to be used as next.
//    */
//   ElementVisitor visitEndBody();
// 
//   /**
//    * Event handler of XML element.
//    * 
//    * @author Rein Raudjärv
//    */
//   interface ElementVisitor {
//     /**
//      * Handle XML attribute.
//      * 
//      * @param name name of the XML attribute.
//      * @param value value of the XML attribute.
//      * @return event handler for the XML element.
//      */
//     ElementVisitor visitAttribute(String name, String value);
// 
//     /**
//      * Handle start of the XML body.
//      * 
//      * @return event handler for the XML element body.
//      */
//     XmlVisitor visitBody();
// 
//     /**
//      * Handle end of the XML element.
//      * 
//      * @return XML event handler to be used as next.
//      */
//     XmlVisitor visitEndElement();
//   }
// 
// }
// 
// Path: src/main/java/org/dynaform/xml/form/Form.java
// public interface Form {
//   
//   String HL_CHILD = "/";
//   String HL_DESCENDANT_OR_SELF = "//";
//   String LL_CHILD = "!";
//   String LL_DESCENDANT_OR_SELF = "!!";
//   String INDEX_START = "[";
//   String INDEX_END = "]";
//   String OPERATOR_SEQUENCE = "sequence";
//   String OPERATOR_CHOICE = "choice";
//   String OPERATOR_ALL = "all";
//   
//   // Identity and parent
//   String getDescendantOrSelfSelector();         // "//element"
//   String getFullSelector();                     // "/aa/bb/cc!selector[0]"
//   String getHighLevelFullSelectorForChildren(); // "/aa/bb/cc"
// 
//   String getHighLevelId();  // cc
//   String getLowLevelId();   // selector[0]
//   
//   Form getParent();
//   void _setParent(Form parent);
//   
//   // Sequence
//   String nextCounterValue();
//   
//   // Visitors
// 	void accept(FormVisitor visitor);
// 	<T> T apply(FormFunction<T> function);
// 
// }


import org.dynaform.xml.RepeatAdapter;
import org.dynaform.xml.XmlVisitor;
import org.dynaform.xml.form.Form;
import org.dynaform.xml.form.FormRepeat;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

package org.dynaform.xml.reader;



/**
 * @author Rein Raudjärv
 * 
 * @see FormRepeat
 * @see RepeatAdapter
 * @see XmlReader
 */
public class RepeatReader<F extends Form> implements XmlReader {

  private static final Log log = LogFactory.getLog(RepeatReader.class);

  private final FormRepeat<F> form;
  private final RepeatAdapter<F> adapter;

  public RepeatReader(FormRepeat<F> form, RepeatAdapter<F> adapter) {
    this.form = form;
    this.adapter = adapter;
  }


// Path: src/main/java/org/dynaform/xml/XmlVisitor.java
// public interface XmlVisitor {
// 
//   /**
//    * Handle text.
//    * 
//    * @param s text.
//    * @return XML event handler to be used as next.
//    */
//   XmlVisitor text(String s);
// 
//   /**
//    * Handle XML element start.
//    * 
//    * @param element name of the XML element.
//    * @return event handler for the XML element.
//    */
//   ElementVisitor visitElement(String element);
//   
//   /**
//    * Handle end of the XML element body.
//    * 
//    * @return event handler of the XML element to be used as next.
//    */
//   ElementVisitor visitEndBody();
// 
//   /**
//    * Event handler of XML element.
//    * 
//    * @author Rein Raudjärv
//    */
//   interface ElementVisitor {
//     /**
//      * Handle XML attribute.
//      * 
//      * @param name name of the XML attribute.
//      * @param value value of the XML attribute.
//      * @return event handler for the XML element.
//      */
//     ElementVisitor visitAttribute(String name, String value);
// 
//     /**
//      * Handle start of the XML body.
//      * 
//      * @return event handler for the XML element body.
//      */
//     XmlVisitor visitBody();
// 
//     /**
//      * Handle end of the XML element.
//      * 
//      * @return XML event handler to be used as next.
//      */
//     XmlVisitor visitEndElement();
//   }
// 
// }
// 
// Path: src/main/java/org/dynaform/xml/form/Form.java
// public interface Form {
//   
//   String HL_CHILD = "/";
//   String HL_DESCENDANT_OR_SELF = "//";
//   String LL_CHILD = "!";
//   String LL_DESCENDANT_OR_SELF = "!!";
//   String INDEX_START = "[";
//   String INDEX_END = "]";
//   String OPERATOR_SEQUENCE = "sequence";
//   String OPERATOR_CHOICE = "choice";
//   String OPERATOR_ALL = "all";
//   
//   // Identity and parent
//   String getDescendantOrSelfSelector();         // "//element"
//   String getFullSelector();                     // "/aa/bb/cc!selector[0]"
//   String getHighLevelFullSelectorForChildren(); // "/aa/bb/cc"
// 
//   String getHighLevelId();  // cc
//   String getLowLevelId();   // selector[0]
//   
//   Form getParent();
//   void _setParent(Form parent);
//   
//   // Sequence
//   String nextCounterValue();
//   
//   // Visitors
// 	void accept(FormVisitor visitor);
// 	<T> T apply(FormFunction<T> function);
// 
// }


// Path: src/main/java/org/dynaform/xml/reader/RepeatReader.java
import org.dynaform.xml.RepeatAdapter;
import org.dynaform.xml.XmlVisitor;
import org.dynaform.xml.form.Form;
import org.dynaform.xml.form.FormRepeat;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

package org.dynaform.xml.reader;



/**
 * @author Rein Raudjärv
 * 
 * @see FormRepeat
 * @see RepeatAdapter
 * @see XmlReader
 */
public class RepeatReader<F extends Form> implements XmlReader {

  private static final Log log = LogFactory.getLog(RepeatReader.class);

  private final FormRepeat<F> form;
  private final RepeatAdapter<F> adapter;

  public RepeatReader(FormRepeat<F> form, RepeatAdapter<F> adapter) {
    this.form = form;
    this.adapter = adapter;
  }


  public XmlVisitor create(XmlReader next) {
