Package org.atomojo.app.db

Source Code of org.atomojo.app.db.ListItemDestination

/*
* ListItemDestination.java
*
* Created on June 6, 2007, 2:29 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/

package org.atomojo.app.db;

import org.infoset.xml.Document;
import org.infoset.xml.Item;
import org.infoset.xml.ItemDestination;
import org.infoset.xml.XMLException;
import org.infoset.xml.util.DocumentDestination;

/**
*
* @author alex
*/
public class ListItemDestination implements ItemDestination
{
  
   int level = -1;
   DocumentDestination dest = null;
  
   /** Creates a new instance of ListItemDestination */
   public ListItemDestination()
   {
   }
  
   public void onItem(Document doc)
   {
     
   }

   public void send(Item item)
      throws XMLException
   {
      if (item.getType()==Item.ItemType.ElementItem) {
         level++;
         if (level==1) {
            dest = new DocumentDestination();
         }
      }
      if (dest!=null) {
         dest.send(item);
      }
      if (item.getType()==Item.ItemType.ElementEndItem) {
         level--;
         if (level<1 && dest!=null) {
            onItem(dest.getDocument());
            dest = null;
         }
      }
   }
  
}
TOP

Related Classes of org.atomojo.app.db.ListItemDestination

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.