|
BEA Systems, Inc. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weblogic.apache.xalan.transformer.QueuedEvents | +--weblogic.apache.xalan.transformer.ResultTreeHandler
This class is a layer between the direct calls to the result tree content handler, and the transformer. For one thing, we have to delay the call to getContentHandler().startElement(name, atts) because of the xsl:attribute and xsl:copy calls. In other words, the attributes have to be fully collected before you can call startElement.
This class is based on an implementation from the Apache XML Project. In future releases the XML parser, XSLT processor, and associated classes will likely be updated to be based on a later version of the Apache implementations. Since Apache does not guarantee backwards compatibility between versions of their software, we cannot guarantee backwards compatibility of any of the classes contained in the weblogic.apache package or sub-packages.
Field Summary | |
ClonerToResultTree |
m_cloner
This class clones nodes to the result tree. |
Fields inherited from class weblogic.apache.xalan.transformer.QueuedEvents |
m_attributes,
m_docEnded,
m_docPending,
m_elemIsEnded,
m_elemIsPending,
m_eventCount,
m_localName,
m_name,
m_namespaces,
m_nsDeclsHaveBeenAdded,
m_url |
Constructor Summary | |
ResultTreeHandler()
Null constructor for object pooling. |
|
ResultTreeHandler(TransformerImpl transformer,
org.xml.sax.ContentHandler realHandler)
Create a new result tree handler. |
Method Summary | |
void |
addAttribute(int attr)
Copy an DOM attribute to the created output element, executing attribute templates as need be, and processing the xsl:use attribute. |
void |
addAttribute(java.lang.String uri,
java.lang.String localName,
java.lang.String rawName,
java.lang.String type,
java.lang.String value)
Add an attribute to the end of the list. |
void |
addAttributes(int src)
Copy DOM attributes to the result element. |
void |
addNSDeclsToAttrs()
Add the attributes that have been declared to the attribute list. |
void |
characters(char[] ch,
int start,
int length)
Bottleneck the characters event. |
void |
characters(org.w3c.dom.Node node)
|
void |
comment(char[] ch,
int start,
int length)
Bottleneck the comment event. |
void |
comment(java.lang.String data)
Bottleneck the comment event. |
void |
endCDATA()
End the CDATA characters. |
void |
endDocument()
Bottleneck the endDocument event. |
void |
endDTD()
End the DTD. |
void |
endElement(java.lang.String ns,
java.lang.String localName,
java.lang.String name)
Bottleneck the endElement event. |
void |
endEntity(java.lang.String name)
End an entity. |
void |
endPrefixMapping(java.lang.String prefix)
End the scope of a prefix-URI mapping. |
void |
ensureNamespaceDeclDeclared(weblogic.apache.xml.dtm.DTM dtm,
int namespace)
This function checks to make sure a given prefix is really declared. |
void |
ensurePrefixIsDeclared(java.lang.String ns,
java.lang.String rawName)
This function checks to make sure a given prefix is really declared. |
void |
entityReference(java.lang.String name)
Entity reference event. |
void |
error(org.xml.sax.SAXParseException exception)
Receive notification of a recoverable error. |
void |
fatalError(org.xml.sax.SAXParseException exception)
Receive notification of a non-recoverable error. |
void |
flushPending()
Flush the pending element. |
void |
flushPending(boolean flushPrefixes)
Flush the pending element, and any attributes associated with it. |
org.xml.sax.ContentHandler |
getContentHandler()
Return the current content handler. |
org.w3c.dom.traversal.NodeIterator |
getContextNodeList()
Get the current context node list. |
ElemTemplateElement |
getCurrentElement()
Retrieves the stylesheet element that produced the SAX event. |
org.w3c.dom.Node |
getCurrentNode()
This method retrieves the current context node in the source tree. |
ElemTemplate |
getCurrentTemplate()
This method retrieves the xsl:template that is in effect, which may be a matched template or a named template. |
org.w3c.dom.Node |
getMatchedNode()
Retrieves the node in the source tree that matched the template obtained via getMatchedTemplate(). |
ElemTemplate |
getMatchedTemplate()
This method retrieves the xsl:template that was matched. |
org.xml.sax.helpers.NamespaceSupport |
getNamespaceSupport()
Get the NamespaceSupport object. |
java.lang.String |
getNewUniqueNSPrefix()
Get new unique namespace prefix. |
MutableAttrListImpl |
getPendingAttributes()
Get the pending attributes. |
java.lang.String |
getPrefix(java.lang.String namespace)
Given a namespace, try and find a prefix. |
javax.xml.transform.Transformer |
getTransformer()
Get the TrAX Transformer object in effect. |
int |
getUniqueNSValue()
Get a unique namespace value. |
java.lang.String |
getURI(java.lang.String prefix)
Given a prefix, return the namespace, |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Bottleneck the ignorableWhitespace event. |
void |
init(TransformerImpl transformer,
org.xml.sax.ContentHandler realHandler)
Initializer method. |
boolean |
isDefinedNSDecl(int attr)
Returns whether a namespace is defined |
boolean |
isDefinedNSDecl(int attr,
weblogic.apache.xml.dtm.DTM dtm)
Returns whether a namespace is defined |
boolean |
isDefinedNSDecl(java.lang.String rawName,
java.lang.String value)
Return whether or not a namespace declaration is defined |
boolean |
isElementPending()
Tell if an element is pending, to be output to the result tree. |
void |
outputResultTreeFragment(XObject obj,
XPathContext support)
Given a result tree fragment, walk the tree and output it to the result stream. |
void |
processingInstruction(java.lang.String target,
java.lang.String data)
Bottleneck the processingInstruction event. |
void |
processNSDecls(int src,
int type,
weblogic.apache.xml.dtm.DTM dtm)
Copy xmlns: attributes in if not already in scope. |
protected void |
sendEndPrefixMappings()
Add the attributes that have been declared to the attribute list. |
protected void |
sendStartPrefixMappings()
Add the attributes that have been declared to the attribute list. |
void |
setContentHandler(org.xml.sax.ContentHandler ch)
Set the current content handler. |
void |
setDocumentLocator(org.xml.sax.Locator locator)
To fullfill the FormatterListener interface... |
void |
setNSDeclsHaveBeenAdded(boolean b)
Set whether Namespace declarations have been added to this element |
void |
skippedEntity(java.lang.String name)
Receive notification of a skipped entity. |
protected void |
startAndAddPrefixMappings()
Combination of sendStartPrefixMappings and addNSDeclsToAttrs() (which it mostly replaces). |
void |
startCDATA()
Start the CDATACharacters. |
void |
startDocument()
Bottleneck the startDocument event. |
void |
startDTD(java.lang.String s1,
java.lang.String s2,
java.lang.String s3)
Start the DTD. |
void |
startElement(java.lang.String ns,
java.lang.String localName,
java.lang.String name,
org.xml.sax.Attributes atts)
Bottleneck the startElement event. |
void |
startEntity(java.lang.String name)
Start an entity. |
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
Begin the scope of a prefix-URI Namespace mapping. |
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri,
boolean shouldFlush)
Begin the scope of a prefix-URI Namespace mapping. |
void |
warning(org.xml.sax.SAXParseException exception)
Receive notification of a warning. |
Methods inherited from class weblogic.apache.xalan.transformer.QueuedEvents |
reInitEvents,
reset |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public ClonerToResultTree m_cloner
Constructor Detail |
public ResultTreeHandler()
public ResultTreeHandler(TransformerImpl transformer, org.xml.sax.ContentHandler realHandler)
transformer
- non-null transformer instancerealHandler
- Content Handler instanceMethod Detail |
public void init(TransformerImpl transformer, org.xml.sax.ContentHandler realHandler)
transformer
- non-null transformer instancerealHandler
- Content Handler instancepublic void startDocument() throws org.xml.sax.SAXException
public void endDocument() throws org.xml.sax.SAXException
public void startElement(java.lang.String ns, java.lang.String localName, java.lang.String name, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
ns
- Namespace URI of elementlocalName
- Local part of qname of elementname
- Name of elementatts
- List of attributes for the elementpublic void endElement(java.lang.String ns, java.lang.String localName, java.lang.String name) throws org.xml.sax.SAXException
ns
- Namespace URI of elementlocalName
- Local part of qname of elementname
- Name of elementpublic void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXException
The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the http://xml.org/sax/features/namespaces feature is true (the default).
There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary.
Note that start/endPrefixMapping events are not guaranteed to be properly nested relative to each-other: all startPrefixMapping events will occur before the corresponding startElement event, and all endPrefixMapping events will occur after the corresponding endElement event, but their order is not guaranteed.
prefix
- The Namespace prefix being declared.uri
- The Namespace URI the prefix is mapped to.endPrefixMapping(java.lang.String)
,
startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri, boolean shouldFlush) throws org.xml.sax.SAXException
prefix
- The Namespace prefix being declared.uri
- The Namespace URI the prefix is mapped to.shouldFlush
- Indicate whether pending events needs
to be flushed firstpublic void endPrefixMapping(java.lang.String prefix) throws org.xml.sax.SAXException
See startPrefixMapping for details. This event will always occur after the corresponding endElement event, but the order of endPrefixMapping events is not otherwise guaranteed.
prefix
- The prefix that was being mapping.startPrefixMapping(java.lang.String, java.lang.String)
,
endElement(java.lang.String, java.lang.String, java.lang.String)
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
ch
- Array of characters to processstart
- start of characters in the arraylength
- Number of characters in the arraypublic void characters(org.w3c.dom.Node node) throws org.xml.sax.SAXException
public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
ch
- Array of characters to processstart
- start of characters in the arraylength
- Number of characters in the arraypublic void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
target
- Processing instruction target namedata
- Processing instruction datapublic void comment(java.lang.String data) throws org.xml.sax.SAXException
data
- Comment datapublic void comment(char[] ch, int start, int length) throws org.xml.sax.SAXException
ch
- Character array with comment datastart
- start of characters in the arraylength
- number of characters in the arraypublic void entityReference(java.lang.String name) throws org.xml.sax.SAXException
name
- Name of entitypublic void startEntity(java.lang.String name) throws org.xml.sax.SAXException
name
- Name of the entitypublic void endEntity(java.lang.String name) throws org.xml.sax.SAXException
name
- Name of the entitypublic void startDTD(java.lang.String s1, java.lang.String s2, java.lang.String s3) throws org.xml.sax.SAXException
s1
- The document type name.s2
- The declared public identifier for the
external DTD subset, or null if none was declared.s3
- The declared system identifier for the
external DTD subset, or null if none was declared.public void endDTD() throws org.xml.sax.SAXException
public void startCDATA() throws org.xml.sax.SAXException
public void endCDATA() throws org.xml.sax.SAXException
public void skippedEntity(java.lang.String name) throws org.xml.sax.SAXException
The Parser will invoke this method once for each entity skipped. Non-validating processors may skip entities if they have not seen the declarations (because, for example, the entity was declared in an external DTD subset). All processors may skip external entities, depending on the values of the http://xml.org/sax/features/external-general-entities and the http://xml.org/sax/features/external-parameter-entities properties.
name
- The name of the skipped entity. If it is a
parameter entity, the name will begin with '%'.public void setNSDeclsHaveBeenAdded(boolean b)
b
- Flag indicating whether Namespace declarations
have been added to this elementpublic final void flushPending() throws org.xml.sax.SAXException
public final void flushPending(boolean flushPrefixes) throws org.xml.sax.SAXException
type
- Event type
NEEDSDOC @param flushPrefixespublic void outputResultTreeFragment(XObject obj, XPathContext support) throws org.xml.sax.SAXException
obj
- Result tree fragment objectsupport
- XPath context for the result tree fragmentpublic void setDocumentLocator(org.xml.sax.Locator locator)
locator
- Document locatorpublic void ensurePrefixIsDeclared(java.lang.String ns, java.lang.String rawName) throws org.xml.sax.SAXException
ns
- Namespace URI of the elementrawName
- Raw name of element (with prefix)public void ensureNamespaceDeclDeclared(weblogic.apache.xml.dtm.DTM dtm, int namespace) throws org.xml.sax.SAXException
ns
- Namespace URI of the elementrawName
- Raw name of element (with prefix)
NEEDSDOC @param dtm
NEEDSDOC @param namespaceprotected void sendStartPrefixMappings() throws org.xml.sax.SAXException
protected void startAndAddPrefixMappings() throws org.xml.sax.SAXException
protected void sendEndPrefixMappings() throws org.xml.sax.SAXException
public void addNSDeclsToAttrs()
public void processNSDecls(int src, int type, weblogic.apache.xml.dtm.DTM dtm) throws javax.xml.transform.TransformerException
src
- Source Node
NEEDSDOC @param type
NEEDSDOC @param dtmpublic java.lang.String getURI(java.lang.String prefix)
prefix
- Given prefix namepublic java.lang.String getPrefix(java.lang.String namespace)
namespace
- Given namespace URIpublic org.xml.sax.helpers.NamespaceSupport getNamespaceSupport()
public final org.xml.sax.ContentHandler getContentHandler()
setContentHandler(org.xml.sax.ContentHandler)
public void setContentHandler(org.xml.sax.ContentHandler ch)
ch
- Content Handler to be setgetContentHandler()
public int getUniqueNSValue()
public java.lang.String getNewUniqueNSPrefix()
public MutableAttrListImpl getPendingAttributes()
public void addAttribute(java.lang.String uri, java.lang.String localName, java.lang.String rawName, java.lang.String type, java.lang.String value) throws javax.xml.transform.TransformerException
Do not pass in xmlns decls to this function!
For the sake of speed, this method does no checking to see if the attribute is already in the list: that is the responsibility of the application.
uri
- The Namespace URI, or the empty string if
none is available or Namespace processing is not
being performed.localName
- The local name, or the empty string if
Namespace processing is not being performed.rawName
- The raw XML 1.0 name, or the empty string
if raw names are not available.type
- The attribute type as a string.value
- The attribute value.public boolean isDefinedNSDecl(java.lang.String rawName, java.lang.String value)
rawName
- Raw name of namespace elementvalue
- URI of given namespacepublic boolean isDefinedNSDecl(int attr)
attr
- Namespace attribute nodepublic boolean isDefinedNSDecl(int attr, weblogic.apache.xml.dtm.DTM dtm)
attr
- Namespace attribute nodedtm
- The DTM that owns attr.public void addAttribute(int attr) throws javax.xml.transform.TransformerException
attr
- Attribute node to add to result treepublic void addAttributes(int src) throws javax.xml.transform.TransformerException
src
- Source node with the attributespublic final boolean isElementPending()
public ElemTemplateElement getCurrentElement()
Please note that the ElemTemplateElement returned may be in a default template, and thus may not be defined in the stylesheet.
public org.w3c.dom.Node getCurrentNode()
public ElemTemplate getCurrentTemplate()
Please note that the ElemTemplate returned may be a default template, and thus may not have a template defined in the stylesheet.
public ElemTemplate getMatchedTemplate()
Please note that the ElemTemplate returned may be a default template, and thus may not have a template defined in the stylesheet.
public org.w3c.dom.Node getMatchedNode()
public org.w3c.dom.traversal.NodeIterator getContextNodeList()
public javax.xml.transform.Transformer getTransformer()
public void warning(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXException
SAX parsers will use this method to report conditions that are not errors or fatal errors as defined by the XML 1.0 recommendation. The default behaviour is to take no action.
The SAX parser must continue to provide normal parsing events after invoking this method: it should still be possible for the application to process the document through to the end.
Filters may use this method to report other, non-XML warnings as well.
exception
- The warning information encapsulated in a
SAX parse exception.SAXParseException
public void error(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXException
This corresponds to the definition of "error" in section 1.2 of the W3C XML 1.0 Recommendation. For example, a validating parser would use this callback to report the violation of a validity constraint. The default behaviour is to take no action.
The SAX parser must continue to provide normal parsing events after invoking this method: it should still be possible for the application to process the document through to the end. If the application cannot do so, then the parser should report a fatal error even if the XML 1.0 recommendation does not require it to do so.
Filters may use this method to report other, non-XML errors as well.
exception
- The error information encapsulated in a
SAX parse exception.SAXParseException
public void fatalError(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXException
This corresponds to the definition of "fatal error" in section 1.2 of the W3C XML 1.0 Recommendation. For example, a parser would use this callback to report the violation of a well-formedness constraint.
The application must assume that the document is unusable after the parser has invoked this method, and should continue (if at all) only for the sake of collecting addition error messages: in fact, SAX parsers are free to stop reporting any other events once this method has been invoked.
exception
- The error information encapsulated in a
SAX parse exception.SAXParseException
|
Documentation is available at http://download.oracle.com/docs/cd/E13222_01/wls/docs70 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |