java.lang.Object | |
↳ | com.microstrategy.web.transform.MSTRLayoutParser |
![]() |
The MSTRLayoutParser class is default parser for all MicroStrategy-defined layout definitions. It provides many hooks for customization, for example:
getContentHandler(String)
is used to retrieve a SAX ContentHandler for the
layout XML. This needs to use MSTRLayoutParser.ParserContentHandler
as the base class
to enable the MSTRLayoutParser component to interact with the underlying
SAX Parser.getEntityResolver(String)
is used to retrieve an EntityResolver object for
the ContentHandler. It is used to locate any entities references in the layout
XML document. The default implementation (MSTRLayoutParser.ParserEntityResolver
) uses the
entitySearchDir
parameter of the parseLayout(String, String, LayoutParser.MessageListener)
method to
reroute references to the XHTML 1.1 and MicroStrategy Layout DTDs to this directory.getErrorHandler(LayoutParser.MessageListener, MSTRLayoutParser.ParserContentHandler)
is used to retrieve an ErrorHandler object for the
ContentHandler. All warning and error messages are routed through this object.
The default implementation (MSTRLayoutParser.ParserErrorHandler
) routes these messages
to a supplied LayoutParser.MessageListener
object.parseLayout(String, String, LayoutParser.MessageListener)
method are themselves
protected methods can be overriden.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
class | MSTRLayoutParser.ParserContentHandler | This is the default implementation of the ContentHandler to use parse the layout XML. | |||||||||
class | MSTRLayoutParser.ParserEntityResolver | This is the default implementation of the EntityResolver object. | |||||||||
class | MSTRLayoutParser.ParserErrorHandler | This is the defualt implementation for the ErrorHandler object used with the SAX Parser. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
MSTRLayoutParser()
Standard no-args constructor for the layout parser.
| |||||||||||
MSTRLayoutParser(boolean debug)
Special version of the Parser that can enable more diagnostic messages.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String |
getDescription()
Gets the description of this layout parser object (to be read by someone
wishing to use it).
| ||||||||||
LayoutTag |
parseLayout(String layout, String location, LayoutSource layoutSource, LayoutParser.MessageListener listener)
This method performs a parsing operation on a layout definition (supplied as a
string).
| ||||||||||
LayoutTag |
parseLayout(String layout, String location, LayoutParser.MessageListener listener)
This method is deprecated.
- use
parseLayout(String, String, LayoutSource, MessageListener)
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
MSTRLayoutParser.ParserContentHandler |
getContentHandler(String layoutLocation)
Returns a
MSTRLayoutParser.ParserContentHandler object which performs the actual
parsing of the layout text. | ||||||||||
InputStream |
getEntityAsStream(String entityId)
Returns an InputStream for the specified entity file name.
| ||||||||||
EntityResolver |
getEntityResolver(String entitySearchDir)
Returns an EntityResolver object used by the parser to resolve references
to external DTDs.
| ||||||||||
ErrorHandler |
getErrorHandler(LayoutParser.MessageListener listener, MSTRLayoutParser.ParserContentHandler pch)
Returns an ErrorHandler object used by the parser to route error and warning
messages back to the caller.
| ||||||||||
InputSource |
getInputSource(String xmlText)
Returns an InputSource object for the supplied layout XML.
| ||||||||||
LayoutTag |
loadDocument(InputSource inputSource, String layoutLocation, String entitySearchDir, LayoutParser.MessageListener listener)
This method performs the actual SAX parsing of the layout definition.
| ||||||||||
void |
performStaticSemanticChecks(LayoutTag layoutTag, LayoutParser.MessageListener listener)
Perform any additional static semantic analyses on the generated
LayoutTag object. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Standard no-args constructor for the layout parser.
Special version of the Parser that can enable more diagnostic messages.
debug | Whether to enable more diagnostic messages. If enabled, the messages are sent to System.err. |
---|
Gets the description of this layout parser object (to be read by someone wishing to use it). This description should include some reference to the type of special tags that understands.
This method performs a parsing operation on a layout definition (supplied as a
string). If the caller wants to be informed of warning and error conditions, he should
create an instance of an object that implements the LayoutParser.MessageListener
interface.
This particular implentation is broken up into three steps:
InputSource
object (see getInputSource(String)
using the supplied layout
text.InputSource
computed in the previous
step. (See loadDocument(InputSource, String, String, LayoutParser.MessageListener)
)performStaticSemanticChecks(LayoutTag, LayoutParser.MessageListener)
.layout | The Layout Definition as a string. |
---|---|
location | The source location for this layout. It is only used for diagnostic purposes. If omitted, then no source location is mentioned any error or warning messages. |
layoutSource | The layout source is for loading the external file when IncludeTag is used |
listener | An instance of a MessageListener object that the parser uses to indicate warning and error conditions. |
LayoutParsingException | If parsing fails (due to an error condition), this exception is raised. |
---|
This method is deprecated.
- use parseLayout(String, String, LayoutSource, MessageListener)
This method performs a parsing operation on a layout definition (supplied as a
string). If the caller wants to be informed of warning and error conditions, he should
create an instance of an object that implements the LayoutParser.MessageListener
interface.
This particular implentation is broken up into three steps:
InputSource
object (see getInputSource(String)
using the supplied layout
text.InputSource
computed in the previous
step. (See loadDocument(InputSource, String, String, LayoutParser.MessageListener)
)performStaticSemanticChecks(LayoutTag, LayoutParser.MessageListener)
.layout | The Layout Definition as a string. |
---|---|
location | The source location for this layout. It is only used for diagnostic purposes. If omitted, then no source location is mentioned any error or warning messages. |
listener | An instance of a MessageListener object that the parser uses to indicate warning and error conditions. |
LayoutParsingException | If parsing fails (due to an error condition), this exception is raised. |
---|
Returns a MSTRLayoutParser.ParserContentHandler
object which performs the actual
parsing of the layout text.
layoutLocation | The location of the original layout definition. It is only used in diagnostic messages. |
---|
MSTRLayoutParser.ParserContentHandler
object used by the loadDocument(InputSource, String, String, LayoutParser.MessageListener)
method.
Returns an InputStream for the specified entity file name.
entityId | The file name containing XML entities |
---|
null
if the entity file can not be found.
IOException | thrown if there is any error reading the entity file. |
---|
Returns an EntityResolver object used by the parser to resolve references to external DTDs.
entitySearchDir | The location to use to search for all DTDs. |
---|
Returns an ErrorHandler object used by the parser to route error and warning messages back to the caller.
listener | An LayoutParser.MessageListener object to use. |
---|---|
pch | A reference to the MSTRLayoutParser.ParserContentHandler object instance. |
loadDocument(InputSource, String, String, LayoutParser.MessageListener)
method.
Returns an InputSource object for the supplied layout XML.
xmlText | The layout definition to parse. |
---|
loadDocument(InputSource, String, String, LayoutParser.MessageListener)
method.
LayoutParsingException |
---|
This method performs the actual SAX parsing of the layout definition.
inputSource | The InputSource object which contains a reference to the the layout defintion being parsed. |
---|---|
layoutLocation | The source location of the layout definition. It is used for generate meaningful error messages. |
entitySearchDir | This is the directory where the Parser may find the referenced DTDs. |
listener | This is an instance of LayoutParser.MessageListener object used
to communicate warning and error messages back to the caller. |
LayoutTag
, if parsing was successful.LayoutParsingException | If parsing fails, this is thrown. |
---|
Perform any additional static semantic analyses on the generated LayoutTag
object.
The current implementation does not perform any additional checks at this time.
layoutTag | The generated layout, in the form of a LayoutTag . |
---|---|
listener | The LayoutParser.MessageListener object to pass messages through. |
LayoutParsingException | An exception is through if any sematic checks fail. |
---|