Package org.atomojo.app.db

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

/*
* XMLObject.java
*
* Created on June 6, 2007, 11:13 AM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/

package org.atomojo.app.db;

import java.io.IOException;
import org.atomojo.app.client.XMLRepresentationParser;
import org.infoset.xml.Element;
import org.infoset.xml.XMLException;
import org.restlet.representation.Representation;

/**
*
* @author alex
*/
public abstract class XMLObject
{
  
   Element xml;
   Representation rep;
  
   /** Creates a new instance of XMLObject */
   protected XMLObject(Representation rep)
   {
      this.rep = rep;
      this.xml = null;
   }
  
   protected XMLObject(Element xml)
   {
      this.rep = null;
      this.xml = xml;
   }
  
   public void parse()
      throws IOException,XMLException
   {
      XMLRepresentationParser parser = new XMLRepresentationParser();
      xml = parser.load(getRepresentation()).getDocumentElement();
   }
  
   public Element getElement()
   {
      return xml;
   }
  
   public Representation getRepresentation() {
      return rep;
   }
  
   public abstract void unmarshall()
      throws XMLException;
  
   public abstract void marshall()
      throws XMLException;
  
}
TOP

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

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.