// 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();
//   }
// 
// }


import org.dynaform.xml.XmlVisitor;

package org.dynaform.xml.writer;


/**
 * @author Rein Raudjärv
 * 
 * @see XmlWriter
 * @see TextWriter
 * @see XmlTextHandler
 */
public class TextXmlWriter implements XmlWriter {

  private final TextWriter textWriter;
  
  public TextXmlWriter(TextWriter textWriter) {
    this.textWriter = textWriter;
  }
  
  public TextWriter getWriter() {
    return textWriter;
  }

  public boolean isEmpty() {
    return textWriter.getText() == null;
  }

  public void write(XmlVisitor xv) {

// 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/writer/TextXmlWriter.java
import org.dynaform.xml.XmlVisitor;

package org.dynaform.xml.writer;


/**
 * @author Rein Raudjärv
 * 
 * @see XmlWriter
 * @see TextWriter
 * @see XmlTextHandler
 */
public class TextXmlWriter implements XmlWriter {

  private final TextWriter textWriter;
  
  public TextXmlWriter(TextWriter textWriter) {
    this.textWriter = textWriter;
  }
  
  public TextWriter getWriter() {
    return textWriter;
  }

  public boolean isEmpty() {
    return textWriter.getText() == null;
  }

  public void write(XmlVisitor xv) {

    xv.text(textWriter.getText());
