J2EE deployment descriptors

 
 
Every J2EE application module must include an XML based deployment descriptor that provide configuration information for the asset as well as defining relationships to other components.

There are two types of deployments descriptors:
  • vendor neutral deployment descriptors (a.k.a deployment descriptors)
  • vendor specific deployment descriptor (a.k.a deployment plans)
Deployment descriptors are necessary but are not always sufficient to deploy an asset on your server.
Deployment plans provides additional information to map declared resources names, ejb names, security roles, JMS roles (if any) to actual resources in the server. The deployment plans also contain specific server settings and configurations.

rss feed






Validate XML documents using DTDs and IE browser



Information
This solution does not work on Firefox browser.

Operating system used
Windows Vista Home Premium SP 1

Software prerequisites
Internet Explorer 7


Procedure
  1. Create a folder, for example c:\mytest

  2. Place your XML file in this folder.

  3. Make sure your XML file contains the line referring to the DTD, for example:

    <!DOCTYPE web-app SYSTEM "http://java.sun.com/dtd/web-app_2_3.dtd">

  4. Download file validate.html and place it in the same folder as the XML file.
    The HTML file looks like:
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    <html>
      <head>
      <title>Mobilefish.com - Validate XML with DTDs using IE browser</title>
      <script type="text/javascript" language="JavaScript">
      //<![CDATA[
      
      var xmlDocumentObject;
      
      function validateXML(){
        xmlDocumentObject = new ActiveXObject("microsoft.XMLDOM");
        xmlDocumentObject.onreadystatechange = changeHandler;
        xmlDocumentObject.load('web.xml');
      }
      
      function changeHandler(){
        if(xmlDocumentObject.readyState == 4){
            var errorText = xmlDocumentObject.parseError.srcText;
            errorText = xmlDocumentObject.parseError.srcText.replace(/\</g, "&lt");
            errorText = errorText.replace(/\>/g, "&gt");
            if (xmlDocumentObject.parseError.errorCode != 0) {
                displayDIV.innerHTML = "Error in " +
                xmlDocumentObject.parseError.url +
                " line " + xmlDocumentObject.parseError.line +
                " position " + xmlDocumentObject.parseError.linepos +
                ":<br />Source: " + errorText +
                "<br />" + xmlDocumentObject.parseError.reason +
                "<br />" +  "Error: " +
                xmlDocumentObject.parseError.errorCode;
            } else {
                displayDIV.innerHTML = "Document validated OK.<br />";
            }
        }
      }
      //]]>          
      </script>
      </head>
      
      <body>
        <h1>Validate XML with DTDs using IE 7 browser</h1>
        <form name="testForm" action="javascript:void(null);">
          <input type="button" value="Validate XML" onclick="validateXML()" />
        </form>
        <br /><br />
        <div id="displayDIV"></div>
        
      </body>
    </html>
    
    
  5. The following code loads an existing XML document (web.xml) into the XML parserEdit:
    xmlDocumentObject.load('web.xml');

    Enter your xml filename. You may also enter an URL, for example:
    http://www.mobilefish.com/web.xml

  6. Start the IE 7 browser, load the validate.html file and press the "Validate XML document" button.

    If there are no errors you will see:

    Validate XML document no errors

    If there are errors you will see:

    Validate XML document with errors