FileDocCategorySizeDatePackage
DomainXmlSAXParser.javaAPI DocGlassfish v2 API4055Fri May 04 22:24:34 BST 2007com.sun.enterprise.admin.servermgmt.util

DomainXmlSAXParser

public class DomainXmlSAXParser extends DefaultHandler

Fields Summary
private final String
PROPERTY
private int
level
private String
domainXmlEventListenerClass
private File
dtd
Constructors Summary
Methods Summary
public voidendElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)

      level--;
  
public java.lang.StringgetDomainXmlEventListenerClass()


     
	return domainXmlEventListenerClass;
  
public voidparse(java.io.File domainXml, java.io.File dtd)

            this.dtd = dtd;
	    SAXParser saxParser; 
	    SAXParserFactory factory = SAXParserFactory.newInstance();
	    saxParser = factory.newSAXParser();
            saxParser.getXMLReader().setEntityResolver((EntityResolver)this);
	    saxParser.parse(domainXml,this);
  
public org.xml.sax.InputSourceresolveEntity(java.lang.String publicId, java.lang.String systemId)

      InputSource is = null;
      try {
          is = new InputSource(new java.io.FileInputStream(dtd));
      } catch(Exception e) {
          throw new SAXException("cannot resolve dtd", e);
      }
      return is;
  
public voidstartElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attrs)

      level++;
      if ( level==2 && PROPERTY.equals(qName)){
          if (attrs != null) {
              for (int i = 0; i < attrs.getLength(); i++) {
                  String aName = attrs.getQName(i); // Attr name
                  String aValue = attrs.getValue(aName);
                  if ("DomainXmlEventListenerClass".equals(aValue)) {
                      domainXmlEventListenerClass=attrs.getValue("value");
                  }
              }
          }
      }