Devsphere.com


com.devsphere.xml.taglib.process.parse
Class Builder

java.lang.Object
  |
  +--org.xml.sax.helpers.DefaultHandler
        |
        +--com.devsphere.xml.saxdomix.SDXBuilder
              |
              +--com.devsphere.xml.taglib.support.builder.BuilderSupport
                    |
                    +--com.devsphere.xml.taglib.process.parse.Builder
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, org.xml.sax.ext.LexicalHandler

public class Builder
extends BuilderSupport

An instance of this class will get all SAX events during the parsing of an input source. These events will be forwarded to a SAX handler (that is also a SAXDOMIX controller) or the builder will create DOM sub-trees depending on the value returned by the wantDOM() method of the handler object. The DOM sub-trees will be passed to the handleDOM() method of the handler object.


Field Summary
 
Fields inherited from class com.devsphere.xml.saxdomix.SDXBuilder
controller, handler, helper, inCDATA, lexicalHandler, newCDATA, stack, wantDOM
 
Constructor Summary
Builder(Handler handler, AbstractLogger logger, javax.servlet.jsp.PageContext context)
          Initializes the builder.
 
Method Summary
 void fatalError(org.xml.sax.SAXParseException e)
          Throws a fatal parse error.
static boolean isAbsoluteUrl(java.lang.String url)
          Verifies if a given URL is absolute.
 void parse(org.xml.sax.InputSource source, boolean validating)
          Parses an input source using SAXDOMIX.
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
          Resolves an entity in the context of the web application.
 
Methods inherited from class com.devsphere.xml.taglib.support.builder.BuilderSupport
error, getSAXParser, getSAXParserFactory, log, warning
 
Methods inherited from class com.devsphere.xml.saxdomix.SDXBuilder
characters, comment, endCDATA, endDocument, endDTD, endElement, endEntity, processingInstruction, setDocumentLocator, startCDATA, startDocument, startDTD, startElement, startEntity
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, ignorableWhitespace, notationDecl, skippedEntity, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Builder

public Builder(Handler handler,
               AbstractLogger logger,
               javax.servlet.jsp.PageContext context)
Initializes the builder.

Parameters:
handler - SAX event handler that is also SAXDOMIX controller
logger - used for logging error messages and exceptions
context - the JSP PageContext object
Method Detail

parse

public void parse(org.xml.sax.InputSource source,
                  boolean validating)
           throws javax.xml.parsers.ParserConfigurationException,
                  org.xml.sax.SAXException,
                  java.io.IOException
Parses an input source using SAXDOMIX.

Overrides:
parse in class BuilderSupport
Parameters:
source - the XML input source that must be parsed
validating - a flag indicating if the XML content should be validated by the XML parser
Throws:
org.xml.sax.SAXException - to signal a SAX error
java.io.IOException - to signal an I/O error
javax.xml.parsers.ParserConfigurationException - to signal a configuration error

fatalError

public void fatalError(org.xml.sax.SAXParseException e)
                throws org.xml.sax.SAXException
Throws a fatal parse error.

Specified by:
fatalError in interface org.xml.sax.ErrorHandler
Overrides:
fatalError in class BuilderSupport
Parameters:
e - the SAX fatal error
Throws:
org.xml.sax.SAXException - the SAX fatal error

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
                                      throws org.xml.sax.SAXException
Resolves an entity in the context of the web application.

Specified by:
resolveEntity in interface org.xml.sax.EntityResolver
Overrides:
resolveEntity in class org.xml.sax.helpers.DefaultHandler
Parameters:
publicId - the public identifier of the entity
systemId - the system identifier of the entity
Throws:
org.xml.sax.SAXException - to signal an error

isAbsoluteUrl

public static boolean isAbsoluteUrl(java.lang.String url)
Verifies if a given URL is absolute.

Parameters:
url - the URL that must be verified if it's absolute
Returns:
true if the given URL is absolute

 Devsphere.com