org.objectweb.kilim.repository
Class TemplateDescriptionParser

java.lang.Object
  extended byorg.objectweb.kilim.repository.TemplateDescriptionParser

public class TemplateDescriptionParser
extends java.lang.Object

Author:
dutoo, horn Kilim xml format parser. Uses a JAXP SAXParser. Validates the kilim xml DTD (which is to be found in a ResourceLoader) and logs its error and warnings to a ParserErrorHandler.

Nested Class Summary
private  class TemplateDescriptionParser.ContextData
          This private class is just a data container used to store information on the stack.
private  class TemplateDescriptionParser.KilimSaxHandler
           
 
Field Summary
private static java.lang.String CLASSPATH_URI_PREFIX
           
private  java.lang.String currentTemplateName
           
private  ParserErrorHandler errorHandler
           
private  ResourceLoader resourceLoader
           
private  javax.xml.parsers.SAXParser saxParser
           
private static java.lang.String SUPER_ID
           
 
Constructor Summary
TemplateDescriptionParser(boolean isValidating)
          Creates a new TemplateDescriptionParser using the JAXP SAX factory's new default parser, a new BasicErrorHandler and loads DTDs from a new ClassLoaderResourceLoader.
TemplateDescriptionParser(javax.xml.parsers.SAXParser aSaxParser, ParserErrorHandler anErrorHandler, ResourceLoader aResourceLoader)
          Creates a new TemplateDescriptionParser using the given custom template SAX parser.
 
Method Summary
 TemplateDescription importTemplateDescription(java.io.InputStream is, ResourceMapping aParsingResult, java.lang.String aName)
          Method importTemplateDescription.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASSPATH_URI_PREFIX

private static final java.lang.String CLASSPATH_URI_PREFIX
See Also:
Constant Field Values

SUPER_ID

private static final java.lang.String SUPER_ID
See Also:
Constant Field Values

resourceLoader

private ResourceLoader resourceLoader

saxParser

private javax.xml.parsers.SAXParser saxParser

errorHandler

private ParserErrorHandler errorHandler

currentTemplateName

private java.lang.String currentTemplateName
Constructor Detail

TemplateDescriptionParser

public TemplateDescriptionParser(boolean isValidating)
Creates a new TemplateDescriptionParser using the JAXP SAX factory's new default parser, a new BasicErrorHandler and loads DTDs from a new ClassLoaderResourceLoader.

May log SAXException on parser creation exception and. ParserConfigurationException if DTD validation is impossible

Parameters:
isValidating - if true, requires the parsed xml template to be validated against the kilim_template.dtd, which has therefore to be in the classpath. NB: the template parser behaviour on parsing error is undetermined if there is no template DTD validation.

TemplateDescriptionParser

public TemplateDescriptionParser(javax.xml.parsers.SAXParser aSaxParser,
                                 ParserErrorHandler anErrorHandler,
                                 ResourceLoader aResourceLoader)
Creates a new TemplateDescriptionParser using the given custom template SAX parser.

Parameters:
aSaxParser - the custom kilim xml format parser
anErrorHandler - to be used for model & parsing errors handling delegation
aResourceLoader - where the DTDs are to be found NB: the template parser behaviour on parsing error is undetermined if the given SAX parser doesn't validate template DTD.
Method Detail

importTemplateDescription

public TemplateDescription importTemplateDescription(java.io.InputStream is,
                                                     ResourceMapping aParsingResult,
                                                     java.lang.String aName)
Method importTemplateDescription.

Parameters:
is - kilim xml format data
aParsingResult - holds the template dependancies & naming to be solved
aName - is the template resource name.
Returns:
the parsed Template (its template naming is not resolved yet)