|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.bibop.xml.AbstractSAXProcessor | +--org.bibop.xml.xforge.XForgeProcessor
The main entry point for the x:forge framework. The class is responsible for receiving XML SAX events, delegate x:forge related events to the appropriate x:forge components and pass through unchanged the remaining SAX events. In a typical SAX environment usually an application invokes a parser setting itself as the ContentHandler. In a x:forge enviroment the XForgeprocessor should be set as the ContentHandler of the parser and the application should be set as the XForgeProcessor ContentHandler. As an example:
XForgeProcessor xfp = new XForgeProcessor(); xfp.configure(Configuration conf); parser.setContentHandler(xfp); xfp.setContenHandler(this); parser.parse();
Field Summary | |
private java.util.List |
activePrefixes
|
private org.apache.avalon.excalibur.component.ExcaliburComponentManager |
componentManager
|
static java.lang.String |
DEFAULT_ENCODING
|
protected java.lang.Boolean |
lastifresult
|
protected org.apache.avalon.framework.logger.Logger |
log
|
private ProcessingOptions |
po
|
static java.lang.String |
XFORGE_CONTEXTS_XMLNS_URI
XForge declaration contexts namespace |
static java.lang.String |
XFORGE_DEFAULT_CONTEXT_CLASS
The XForge default context identifier |
static java.lang.Class |
XFORGE_DEFAULT_VARIABLES_CONTEXT
The XForge default context identifier |
static java.lang.String |
XFORGE_NAME
Deprecated. |
static java.lang.String |
XFORGE_XMLNS_AUTOMATION_URI
The XForge components namespace |
static java.lang.String |
XFORGE_XMLNS_URI
The XForge namespace |
private ElementsStack |
xForgeStack
|
Fields inherited from class org.bibop.xml.AbstractSAXProcessor |
contentHandler, lexicalHandler |
Constructor Summary | |
XForgeProcessor()
|
Method Summary | |
void |
characters(char[] ch,
int start,
int len)
Receive notification of character data. |
private void |
clearStatus()
|
void |
comment(char[] ch,
int start,
int len)
Report an XML comment anywhere in the document. |
void |
configure(org.apache.avalon.framework.configuration.Configuration conf)
Configures the application based on a Avalon Configuration object. |
protected void |
debug(java.lang.String str)
|
void |
enableLogging(org.apache.avalon.framework.logger.Logger logger)
Provide component with a logger. |
void |
endCDATA()
Report the end of a CDATA section. |
void |
endDocument()
Receive notification of the end of a document. |
void |
endDTD()
Report the end of DTD declarations. |
void |
endElement(java.lang.String uri,
java.lang.String loc,
java.lang.String raw)
Receive notification of the end of an element. |
void |
endEntity(java.lang.String name)
Report the end of an entity. |
void |
endPrefixMapping(java.lang.String prefix)
End the scope of a prefix-URI mapping. |
java.util.List |
getActivePrefixes()
Keep track of namespaces added by previous elements. |
private org.xml.sax.ContentHandler |
getCurrentContentHandler()
|
private org.xml.sax.ext.LexicalHandler |
getCurrentLexicalHandler()
|
private PrefixesMonitor |
getCurrentPrefixesMonitor()
|
static java.lang.Object |
getVariableValue(PrefixesMonitor prefixes,
java.lang.String name)
|
static java.lang.Object |
getVariableValue(java.lang.String name)
|
void |
ignorableWhitespace(char[] ch,
int start,
int len)
Receive notification of ignorable whitespace in element content. |
private boolean |
isInNamespace(java.lang.String ns)
|
org.w3c.dom.Document |
process(org.w3c.dom.Document document)
Allows using DOM structures in the x:forge framework. |
void |
processingInstruction(java.lang.String target,
java.lang.String data)
Receive notification of a processing instruction. |
protected void |
resetIf()
|
void |
setDocumentLocator(org.xml.sax.Locator locator)
Receive an object for locating the origin of SAX document events. |
void |
setParentPrefixesMonitor(PrefixesMonitor parent)
Sets the (previous) namespace prefixes monitor. |
void |
setProcessingOptions(ProcessingOptions aPO)
|
static void |
setVariableValue(PrefixesMonitor prefixes,
java.lang.String name,
java.lang.Object value)
|
static void |
setVariableValue(java.lang.String name,
java.lang.Object value)
|
void |
skippedEntity(java.lang.String name)
Receive notification of a skipped entity. |
void |
startCDATA()
Report the start of a CDATA section. |
void |
startDocument()
Receive notification of the beginning of a document. |
void |
startDTD(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
Report the start of DTD declarations, if any. |
void |
startElement(java.lang.String uri,
java.lang.String loc,
java.lang.String raw,
org.xml.sax.Attributes a)
Receive notification of the beginning of an element. |
void |
startEntity(java.lang.String name)
Report the beginning of an entity. |
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
Begin the scope of a prefix-URI Namespace mapping. |
Methods inherited from class org.bibop.xml.AbstractSAXProcessor |
setConsumer, setContentHandler, setLexicalHandler, toSax |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private ProcessingOptions po
protected org.apache.avalon.framework.logger.Logger log
protected java.lang.Boolean lastifresult
public static final java.lang.String XFORGE_DEFAULT_CONTEXT_CLASS
public static final java.lang.Class XFORGE_DEFAULT_VARIABLES_CONTEXT
public static final java.lang.String XFORGE_XMLNS_URI
public static final java.lang.String XFORGE_XMLNS_AUTOMATION_URI
public static final java.lang.String XFORGE_CONTEXTS_XMLNS_URI
public static final java.lang.String XFORGE_NAME
private org.apache.avalon.excalibur.component.ExcaliburComponentManager componentManager
private ElementsStack xForgeStack
private java.util.List activePrefixes
public static java.lang.String DEFAULT_ENCODING
Constructor Detail |
public XForgeProcessor()
Method Detail |
protected void resetIf()
public void enableLogging(org.apache.avalon.framework.logger.Logger logger)
enableLogging
in interface org.apache.avalon.framework.logger.LogEnabled
logger
- the loggerpublic void configure(org.apache.avalon.framework.configuration.Configuration conf) throws org.apache.avalon.framework.configuration.ConfigurationException
<?xml version="1.0"?> <xforge> <components> <component role="process"> <component-instance name="HelloWorld" class="org.bibop.xml.xforge.component.examples.HelloWorldComponent" /> </component> </components> </xforge>
configure
in interface org.apache.avalon.framework.configuration.Configurable
conf
- An Avalon Configuration Object
org.apache.avalon.framework.configuration.ConfigurationException
- Exception due to misconfigurationprivate void clearStatus()
public void setProcessingOptions(ProcessingOptions aPO)
public org.w3c.dom.Document process(org.w3c.dom.Document document) throws java.lang.Exception
process
in interface DOMProcessor
document
- a Document object to be processed
java.lang.Exception
- Fooooooooof fightprotected void debug(java.lang.String str)
private PrefixesMonitor getCurrentPrefixesMonitor()
public static java.lang.Object getVariableValue(java.lang.String name) throws ParserError, XForgeException
ParserError
XForgeException
public static java.lang.Object getVariableValue(PrefixesMonitor prefixes, java.lang.String name) throws ParserError, XForgeException
ParserError
XForgeException
public static void setVariableValue(java.lang.String name, java.lang.Object value) throws ParserError, XForgeException
ParserError
XForgeException
public static void setVariableValue(PrefixesMonitor prefixes, java.lang.String name, java.lang.Object value) throws ParserError, XForgeException
ParserError
XForgeException
private org.xml.sax.ContentHandler getCurrentContentHandler()
private org.xml.sax.ext.LexicalHandler getCurrentLexicalHandler()
private boolean isInNamespace(java.lang.String ns)
public java.util.List getActivePrefixes() throws XForgeException
getActivePrefixes
in interface PrefixesMonitor
XForgeException
- In this particular context the Exception will
never be thrownpublic void setParentPrefixesMonitor(PrefixesMonitor parent) throws XForgeException
setParentPrefixesMonitor
in interface PrefixesMonitor
parent
- the parent object implementing PrefixesMonitor interface.
XForgeException
- never thrown herepublic void startElement(java.lang.String uri, java.lang.String loc, java.lang.String raw, org.xml.sax.Attributes a) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
startElement
in class AbstractSAXProcessor
uri
- The Namespace URI, or the empty string if the element has no
Namespace URI or if Namespace processing is not being performed.loc
- The local name (without prefix), or the empty string if
Namespace processing is not being performed.raw
- The raw XML 1.0 name (with prefix), or the empty string if
raw names are not available.a
- The attributes attached to the element. If there are no
attributes, it shall be an empty Attributes object.
org.xml.sax.SAXException
public void endElement(java.lang.String uri, java.lang.String loc, java.lang.String raw) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
endElement
in class AbstractSAXProcessor
uri
- The Namespace URI, or the empty string if the element has no
Namespace URI or if Namespace processing is not being performed.loc
- The local name (without prefix), or the empty string if
Namespace processing is not being performed.raw
- The raw XML 1.0 name (with prefix), or the empty string if
raw names are not available.
org.xml.sax.SAXException
public void setDocumentLocator(org.xml.sax.Locator locator)
setDocumentLocator
in interface org.xml.sax.ContentHandler
setDocumentLocator
in class AbstractSAXProcessor
locator
- An object that can return the location of any SAX
document event.public void startDocument() throws org.xml.sax.SAXException
startDocument
in interface org.xml.sax.ContentHandler
startDocument
in class AbstractSAXProcessor
org.xml.sax.SAXException
public void endDocument() throws org.xml.sax.SAXException
endDocument
in interface org.xml.sax.ContentHandler
endDocument
in class AbstractSAXProcessor
org.xml.sax.SAXException
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXException
startPrefixMapping
in interface org.xml.sax.ContentHandler
startPrefixMapping
in class AbstractSAXProcessor
prefix
- The Namespace prefix being declared.uri
- The Namespace URI the prefix is mapped to.
org.xml.sax.SAXException
public void endPrefixMapping(java.lang.String prefix) throws org.xml.sax.SAXException
endPrefixMapping
in interface org.xml.sax.ContentHandler
endPrefixMapping
in class AbstractSAXProcessor
prefix
- The prefix that was being mapping.
org.xml.sax.SAXException
public void characters(char[] ch, int start, int len) throws org.xml.sax.SAXException
characters
in interface org.xml.sax.ContentHandler
characters
in class AbstractSAXProcessor
ch
- The characters from the XML document.start
- The start position in the array.len
- The number of characters to read from the array.
org.xml.sax.SAXException
public void ignorableWhitespace(char[] ch, int start, int len) throws org.xml.sax.SAXException
ignorableWhitespace
in interface org.xml.sax.ContentHandler
ignorableWhitespace
in class AbstractSAXProcessor
ch
- The characters from the XML document.start
- The start position in the array.len
- The number of characters to read from the array.
org.xml.sax.SAXException
public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
processingInstruction
in interface org.xml.sax.ContentHandler
processingInstruction
in class AbstractSAXProcessor
target
- The processing instruction target.data
- The processing instruction data, or null if none was
supplied.
org.xml.sax.SAXException
public void skippedEntity(java.lang.String name) throws org.xml.sax.SAXException
skippedEntity
in interface org.xml.sax.ContentHandler
skippedEntity
in class AbstractSAXProcessor
name
- The name of the skipped entity. If it is a parameter
entity, the name will begin with '%'.
org.xml.sax.SAXException
public void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException
startDTD
in interface org.xml.sax.ext.LexicalHandler
startDTD
in class AbstractSAXProcessor
name
- The document type name.publicId
- The declared public identifier for the external DTD
subset, or null if none was declared.systemId
- The declared system identifier for the external DTD
subset, or null if none was declared.
org.xml.sax.SAXException
public void endDTD() throws org.xml.sax.SAXException
endDTD
in interface org.xml.sax.ext.LexicalHandler
endDTD
in class AbstractSAXProcessor
org.xml.sax.SAXException
public void startEntity(java.lang.String name) throws org.xml.sax.SAXException
startEntity
in interface org.xml.sax.ext.LexicalHandler
startEntity
in class AbstractSAXProcessor
name
- The name of the entity. If it is a parameter entity, the
name will begin with '%'.
org.xml.sax.SAXException
public void endEntity(java.lang.String name) throws org.xml.sax.SAXException
endEntity
in interface org.xml.sax.ext.LexicalHandler
endEntity
in class AbstractSAXProcessor
name
- The name of the entity that is ending.
org.xml.sax.SAXException
public void startCDATA() throws org.xml.sax.SAXException
startCDATA
in interface org.xml.sax.ext.LexicalHandler
startCDATA
in class AbstractSAXProcessor
org.xml.sax.SAXException
public void endCDATA() throws org.xml.sax.SAXException
endCDATA
in interface org.xml.sax.ext.LexicalHandler
endCDATA
in class AbstractSAXProcessor
org.xml.sax.SAXException
public void comment(char[] ch, int start, int len) throws org.xml.sax.SAXException
comment
in interface org.xml.sax.ext.LexicalHandler
comment
in class AbstractSAXProcessor
ch
- An array holding the characters in the comment.start
- The starting position in the array.len
- The number of characters to use from the array.
org.xml.sax.SAXException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |