Schema to class mappings

A summary of how schemas are mapped to classes follows:

The following table shows some highlights of the DataBeans generated for the Recipe DTD:

Table 2-1: DTD to Java class mapping

DTD element

Generated Java class

An element containing only text.

<!ELEMENT Name (#PCDATA)>

A single Java class representing the element, with public accessor and mutator methods for the text.

Class: Name

Methods:

 public String getData()
 public void setData( String data )

An element containing child elements.

<!ELEMENT Ingredient (Food, Quantity)

A Java class representing the parent element, with public accessor and mutator methods for the child element.

Class: Ingredient

Methods:

 public Food getFood()
 public Food setFood()
 public Quantity getQuantity()
 public Quantity setQuantity()

An element containing a repeating child and attributes.

<!ELEMENT IngredientList (Ingredient+)>

<!ATTLIST IngredientList serves CDATA #REQUIRED>

A Java class representing the parent element, with public methods for accessing and modifying the list of children.

Class: IngredientList

Methods:

public Ingredient setIngredient( int index )
public Ingredient getIngredient( int index )
java.lang.Object (getint index)
java.util.List get Ingredient()
void set Ingredient (Ingredient instance, int index)
java.lang.String getAttributeServes(java.lang.String attrValue)

An element containing child elements and text. Recipe is the root.

<!ELEMENT Recipe (#PCDATA | IndexCard | IngredientList | StepList )*>

A Java class representing the parent with accessor and mutator methods for each child, for the text data, and for the object. The get object method is for any element that has more than one child and enables you to retrieve the children in the order they were originally specified.

Class: Recipe

Methods:

public java.util.List getIndexCard()
public IndexCard getIndexCard(int index)
public void setIndexCard(IndexCard instance,    int index)
public IndexCard setIndexCard(int index)
public java.util.List getIngredientList()
public IngredientList getIngredientList(int    index)
public void setIngredientList(IngredientList    instance, int index)
public IngredientList setIngredientList(int    index)
public java.util.List getStepList()
public StepList getStepList(int index)
public void setStepList(StepList instance, int    index)
public StepList setStepList(int index)
public Data getData( int index )
public Data setData( String data, int index )
public Object get( int index )
public void setMainDocument
   ( com.sybase.DataBean.serializable.
   DataBeanSerializable mainDocument )
public void validate()
public void serializeXML
   ( java.io.OutputStream ostrm )
public void deserializeXML
   ( java.io.InputStream istrm, boolean    validate )