to shaoyy:
给你看个根据schema自动生成的代码:
/*
* This class was automatically generated with
* <a href="http://castor.exolab.org">Castor 0.9.4</a>, using an
* XML Schema.
* $Id$
*/
package com.lnboy.gbinfo;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
import java.io.IOException;
import java.io.Reader;
import java.io.Serializable;
import java.io.Writer;
import org.exolab.castor.xml.*;
import org.exolab.castor.xml.MarshalException;
import org.exolab.castor.xml.ValidationException;
import org.xml.sax.ContentHandler;
/**
*
*
* @version $Revision$ $Date$
**/
public class Guestnote implements java.io.Serializable {
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
private int _noteid;
/**
* keeps track of state for field: _noteid
**/
private boolean _has_noteid;
private java.lang.String _username;
private java.lang.String _email;
private java.lang.String _content;
private java.lang.String _ip;
private long _time;
/**
* keeps track of state for field: _time
**/
private boolean _has_time;
private java.lang.String _reply;
//----------------/
//- Constructors -/
//----------------/
public Guestnote() {
super();
} //-- com.zzjz.gbinfo.Guestnote()
//-----------/
//- Methods -/
//-----------/
/**
* Returns the value of field 'content'.
*
* @return the value of field 'content'.
**/
public java.lang.String getContent()
{
return this._content;
} //-- java.lang.String getContent()
/**
* Returns the value of field 'email'.
*
* @return the value of field 'email'.
**/
public java.lang.String getEmail()
{
return this._email;
} //-- java.lang.String getEmail()
/**
* Returns the value of field 'ip'.
*
* @return the value of field 'ip'.
**/
public java.lang.String getIp()
{
return this._ip;
} //-- java.lang.String getIp()
/**
* Returns the value of field 'noteid'.
*
* @return the value of field 'noteid'.
**/
public int getNoteid()
{
return this._noteid;
} //-- int getNoteid()
/**
* Returns the value of field 'reply'.
*
* @return the value of field 'reply'.
**/
public java.lang.String getReply()
{
return this._reply;
} //-- java.lang.String getReply()
/**
* Returns the value of field 'time'.
*
* @return the value of field 'time'.
**/
public long getTime()
{
return this._time;
} //-- long getTime()
/**
* Returns the value of field 'username'.
*
* @return the value of field 'username'.
**/
public java.lang.String getUsername()
{
return this._username;
} //-- java.lang.String getUsername()
/**
**/
public boolean hasNoteid()
{
return this._has_noteid;
} //-- boolean hasNoteid()
/**
**/
public boolean hasTime()
{
return this._has_time;
} //-- boolean hasTime()
/**
**/
public boolean isValid()
{
try {
validate();
}
catch (org.exolab.castor.xml.ValidationException vex) {
return false;
}
return true;
} //-- boolean isValid()
/**
*
*
* @param out
**/
public void marshal(java.io.Writer out)
throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
{
Marshaller.marshal(this, out);
} //-- void marshal(java.io.Writer)
/**
*
*
* @param handler
**/
public void marshal(org.xml.sax.ContentHandler handler)
throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
{
Marshaller.marshal(this, handler);
} //-- void marshal(org.xml.sax.ContentHandler)
/**
* Sets the value of field 'content'.
*
* @param content the value of field 'content'.
**/
public void setContent(java.lang.String content)
{
this._content = content;
} //-- void setContent(java.lang.String)
/**
* Sets the value of field 'email'.
*
* @param email the value of field 'email'.
**/
public void setEmail(java.lang.String email)
{
this._email = email;
} //-- void setEmail(java.lang.String)
/**
* Sets the value of field 'ip'.
*
* @param ip the value of field 'ip'.
**/
public void setIp(java.lang.String ip)
{
this._ip = ip;
} //-- void setIp(java.lang.String)
/**
* Sets the value of field 'noteid'.
*
* @param noteid the value of field 'noteid'.
**/
public void setNoteid(int noteid)
{
this._noteid = noteid;
this._has_noteid = true;
} //-- void setNoteid(int)
/**
* Sets the value of field 'reply'.
*
* @param reply the value of field 'reply'.
**/
public void setReply(java.lang.String reply)
{
this._reply = reply;
} //-- void setReply(java.lang.String)
/**
* Sets the value of field 'time'.
*
* @param time the value of field 'time'.
**/
public void setTime(long time)
{
this._time = time;
this._has_time = true;
} //-- void setTime(long)
/**
* Sets the value of field 'username'.
*
* @param username the value of field 'username'.
**/
public void setUsername(java.lang.String username)
{
this._username = username;
} //-- void setUsername(java.lang.String)
/**
*
*
* @param reader
**/
public static com.zzjz.gbinfo.Guestnote unmarshal(java.io.Reader reader)
throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
{
return (com.zzjz.gbinfo.Guestnote) Unmarshaller.unmarshal(com.zzjz.gbinfo.Guestnote.class, reader);
} //-- com.zzjz.gbinfo.Guestnote unmarshal(java.io.Reader)
/**
**/
public void validate()
throws org.exolab.castor.xml.ValidationException
{
org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
validator.validate(this);
} //-- void validate()
}