|
SAP NetWeaver 7.30 (SP02) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
com.sap.portal.httpconnectivity.transformationservice.EPSAXDefaultHandler
public abstract class EPSAXDefaultHandler
An abstract base class for the SAX transformers used in the
transformation service.
SAX handlers have access to the result handlers (ContentHandler
and LexicalHandler) and to the page context. If the result is an
instance of SAXResult, then the resultHandler is
available. If the result is an instance of StreamResult, then
the writer is available. The writer is a buffer that holds the result.
When implementing the doClone() method make sure that the handler remains
thread safe.
The default implementation of DefaultHandler is a simple
copy of the source to the result.
The following example shows a simple SAX handler that adds ID to XML nodes.
Error handling is removed.
public class MyUIDAdderHandler extends EPSAXDefaultHandler
{
// Map holding the input parameters that this handler exposes.
final private static Map mm_inputParameters = new HashMap(10);
// The list of parameters of this transformer
static
{
// Parameter holding the number of the first ID.
mm_inputParameters.put("StartUID","Integer");
}
private int m_iUIDCounter;
public MyUIDAdderHandler()
{
super();
m_iUIDCounter = 0;
}
// Clones the handler.
public EPSAXDefaultHandler doClone()
{
return new MyUIDAdderHandler();
}
public void startElement(String namespaceURI, String localName, String qName, Attributes attrs)
throws SAXException
{
AttributesImpl newAttrs = new AttributesImpl(attrs);
newAttrs.addAttribute("","","UID","integer",Integer.toString(m_iUIDCounter++));
super.startElement(namespaceURI, localName, qName, newAttrs);
}
public void startDocument() throws SAXException
{
Integer i = (Integer) m_paremetersMap.get("StartUID");
if(i!=null)
{
m_iUIDCounter = i.intValue();
}
super.startDocument();
}
public Map getInputProperties()
{
return mm_inputParameters;
}
}
| Field Summary | |
|---|---|
protected com.sapportals.htmlb.rendering.IPageContext |
m_pageContext
The current HTMLB page context. |
protected Map |
m_paremetersMap
The transformer input parameters. |
ContentHandler |
resultHandler
The result content handler. |
LexicalHandler |
resultLexicalHanlder
The result lexical handler. |
Writer |
writer
The writer associated with the result. |
| Constructor Summary | |
|---|---|
EPSAXDefaultHandler()
The class constructor. |
|
| Method Summary | |
|---|---|
void |
characters(char[] ch,
int start,
int length)
|
void |
clearParameters()
Clears the runtime parameters for the handler. |
void |
comment(char[] ch,
int start,
int length)
|
abstract EPSAXDefaultHandler |
doClone()
Clones the handler. |
void |
endCDATA()
|
void |
endDocument()
|
void |
endDTD()
|
void |
endElement(String namespaceURI,
String localName,
String qName)
|
void |
endEntity(String name)
|
void |
endPrefixMapping(String prefix)
|
void |
error(SAXParseException spe)
|
void |
fatalError(SAXParseException spe)
|
protected String |
getNormalizedString(char[] ch,
int start,
int length)
Gets a string from the specified buffer. |
com.sapportals.htmlb.rendering.IPageContext |
getPageContext()
Gets the HTMLB page context. |
Object |
getParemeter(String name)
Gets the parameter value from the runtime parameters. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
|
void |
processingInstruction(String target,
String data)
|
InputSource |
resolveEntity(String arg0,
String arg1)
|
void |
setPageContext(com.sapportals.htmlb.rendering.IPageContext context)
Places the HTMLB page context in the holder. |
void |
setParemeter(String name,
Object value)
Sets a runtime parameter. |
void |
setResult(Result result)
Sets the result of the transformation. |
void |
skippedEntity(String name)
|
void |
startCDATA()
|
void |
startDocument()
|
void |
startDTD(String name,
String publicId,
String systemId)
|
void |
startElement(String namespaceURI,
String localName,
String qName,
Attributes attrs)
|
void |
startEntity(String name)
|
void |
startPrefixMapping(String prefix,
String uri)
|
| Methods inherited from class org.xml.sax.helpers.DefaultHandler |
|---|
notationDecl, setDocumentLocator, unparsedEntityDecl, warning |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.sap.portal.httpconnectivity.transformationservice.ITransformerProperties |
|---|
getInputProperties |
| Field Detail |
|---|
public ContentHandler resultHandler
public LexicalHandler resultLexicalHanlder
protected com.sapportals.htmlb.rendering.IPageContext m_pageContext
protected Map m_paremetersMap
public Writer writer
| Constructor Detail |
|---|
public EPSAXDefaultHandler()
| Method Detail |
|---|
public com.sapportals.htmlb.rendering.IPageContext getPageContext()
IPageContextHolder
getPageContext in interface IPageContextHolderpublic void setPageContext(com.sapportals.htmlb.rendering.IPageContext context)
IPageContextHolder
setPageContext in interface IPageContextHoldercontext - the current page context to holdpublic Object getParemeter(String name)
name - the name of the parameter
public void setParemeter(String name,
Object value)
name - the name of the parameter to setvalue - the value of the parameterpublic void setResult(Result result)
result - the result of the transformationpublic void clearParameters()
public void characters(char[] ch,
int start,
int length)
throws SAXException
characters in interface ContentHandlercharacters in class org.xml.sax.helpers.DefaultHandlerSAXException
public void endDocument()
throws SAXException
endDocument in interface ContentHandlerendDocument in class org.xml.sax.helpers.DefaultHandlerSAXException
public void endElement(String namespaceURI,
String localName,
String qName)
throws SAXException
endElement in interface ContentHandlerendElement in class org.xml.sax.helpers.DefaultHandlerSAXException
public void endPrefixMapping(String prefix)
throws SAXException
endPrefixMapping in interface ContentHandlerendPrefixMapping in class org.xml.sax.helpers.DefaultHandlerSAXException
public void ignorableWhitespace(char[] ch,
int start,
int length)
throws SAXException
ignorableWhitespace in interface ContentHandlerignorableWhitespace in class org.xml.sax.helpers.DefaultHandlerSAXException
public void processingInstruction(String target,
String data)
throws SAXException
processingInstruction in interface ContentHandlerprocessingInstruction in class org.xml.sax.helpers.DefaultHandlerSAXException
public void skippedEntity(String name)
throws SAXException
skippedEntity in interface ContentHandlerskippedEntity in class org.xml.sax.helpers.DefaultHandlerSAXException
public void startDocument()
throws SAXException
startDocument in interface ContentHandlerstartDocument in class org.xml.sax.helpers.DefaultHandlerSAXException
public void startElement(String namespaceURI,
String localName,
String qName,
Attributes attrs)
throws SAXException
startElement in interface ContentHandlerstartElement in class org.xml.sax.helpers.DefaultHandlerSAXException
public void startPrefixMapping(String prefix,
String uri)
throws SAXException
startPrefixMapping in interface ContentHandlerstartPrefixMapping in class org.xml.sax.helpers.DefaultHandlerSAXException
public void comment(char[] ch,
int start,
int length)
throws SAXException
comment in interface LexicalHandlerSAXException
public void endCDATA()
throws SAXException
endCDATA in interface LexicalHandlerSAXException
public void endDTD()
throws SAXException
endDTD in interface LexicalHandlerSAXException
public void endEntity(String name)
throws SAXException
endEntity in interface LexicalHandlerSAXException
public void startDTD(String name,
String publicId,
String systemId)
throws SAXException
startDTD in interface LexicalHandlerSAXException
public void startEntity(String name)
throws SAXException
startEntity in interface LexicalHandlerSAXException
public void startCDATA()
throws SAXException
startCDATA in interface LexicalHandlerSAXException
public void error(SAXParseException spe)
throws SAXException
error in interface ErrorHandlererror in class org.xml.sax.helpers.DefaultHandlerSAXException
public void fatalError(SAXParseException spe)
throws SAXException
fatalError in interface ErrorHandlerfatalError in class org.xml.sax.helpers.DefaultHandlerSAXException
protected String getNormalizedString(char[] ch,
int start,
int length)
ch - the buffer for the charactersstart - the starting point in the bufferlength - the number of characters to take from the buffer
public abstract EPSAXDefaultHandler doClone()
public InputSource resolveEntity(String arg0,
String arg1)
throws SAXException
resolveEntity in interface EntityResolverresolveEntity in class org.xml.sax.helpers.DefaultHandlerSAXException| Access Rights |
|---|
| SC | DC | Public Part | ACH |
|---|---|---|---|
[sap.com] EP-ADMIN
|
[sap.com] tc/ep/admin/api/extd
|
api
|
EP-PIN
|
|
SAP NetWeaver 7.30 (SP02) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||