The Example XML and Java Bean Files

Assume you have an XML file that looks like the one shown in Listing 24.1.

Code Listing 24.1. Source Code for people.dtd
<!ELEMENT people (person*)>

<!ELEMENT person (first-name|middle-name|last-name)+>

<!ELEMENT first-name (#PCDATA)>
<!ELEMENT middle-name (#PCDATA)>
<!ELEMENT last-name (#PCDATA)>

Furthermore, you have two Java bean classes, People and Person, shown in Listings 24.2 and 24.3.

Code Listing 24.2. Source Code for People.java
 package usingj2ee.xml; import java.util.Vector; public class People implements java.io.Serializable { protected Vector personVec; public People() { personVec = new Vector(); } public Person[] getPerson() { Person[] retval = new Person[personVec.size()]; personVec.copyInto(retval); ...

Get Special Edition Using Java™ 2 Enterprise Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.