The Document Header

An XML document may start with a tag that specifies the version of XML that is in use:

<?xml version="1.0" encoding="UTF-8"?>

This tag identifies the document as an XML document that adheres to Version 1.0 of the XML specification. The character encoding used (UTF-8) is usually supported by EJB vendors.

The next tag specifies the DTD that defines the document. In EJB 2.0, it looks like this:

<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">

In EJB 1.1, it looks like this:

<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
JavaBeans 1.1//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd">

This tag provides the URL from which you (or, more importantly, tools processing the deployment descriptor) can download the document. The DTD can be used to validate the XML document; this means that the EJB server deploying the bean can download the DTD and use it to prove that your deployment descriptor is correct (i.e., that it is organized correctly, it uses the right tag names, and all the tags and attributes have appropriate parameters).

This tag also identifies the name of the document’s root element, which is <ejb-jar> . The <ejb-jar> tag marks the beginning of the document proper.

Get Enterprise JavaBeans, Third 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.