|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.xml.sax.helpers.DefaultHandler | +--org.apache.xalan.stree.SourceTreeHandler
This class handles SAX2 parse events to create a source tree for transformation.
Constructor Summary | |
SourceTreeHandler()
Create a SourceTreeHandler. |
|
SourceTreeHandler(TransformerImpl transformer)
Create a SourceTreeHandler that will start a transformation as soon as a startDocument occurs. |
|
SourceTreeHandler(TransformerImpl transformer,
boolean doFragment)
Create a SourceTreeHandler that will start a transformation as soon as a startDocument occurs. |
Method Summary | |
void |
attributeDecl(java.lang.String eName,
java.lang.String aName,
java.lang.String type,
java.lang.String valueDefault,
java.lang.String value)
Report an attribute type declaration. |
void |
characters(char[] ch,
int start,
int length)
Implement the characters event. |
void |
charactersRaw(char[] ch,
int start,
int length)
Implement the characters event. |
void |
comment(char[] ch,
int start,
int length)
Report an XML comment anywhere in the document. |
void |
elementDecl(java.lang.String name,
java.lang.String model)
Report an element type declaration. |
void |
endCDATA()
Report the end of a CDATA section. |
void |
endDocument()
Implement the endDocument event. |
void |
endDTD()
Report the end of DTD declarations. |
void |
endElement(java.lang.String ns,
java.lang.String localName,
java.lang.String name)
Implement the endElement event. |
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. |
void |
externalEntityDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
Report a parsed external entity declaration. |
Source |
getInputSource()
Get Source Document. |
Node |
getRoot()
Get the root document of tree that is being or will be created. |
java.lang.String |
getSystemId()
Get the base ID (URI or system ID) from where relative URLs will be resolved. |
Transformer |
getTransformer()
Get the Transformer associated with this handler, which is needed in order to set parameters and output properties. |
boolean |
getUseMultiThreading()
Tell whether or not the tree being built should handle transformation while the parse is still going on. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Implement the ignorableWhitespace event. |
void |
internalEntityDecl(java.lang.String name,
java.lang.String value)
Report an internal entity declaration. |
void |
notationDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
Receive notification of a notation declaration event. |
void |
processingInstruction(java.lang.String target,
java.lang.String data)
Implement the processingInstruction event. |
void |
setDocumentLocator(Locator locator)
Implement the setDocumentLocator event. |
void |
setExceptionThrown(java.lang.Exception e)
If an exception was thrown, keep track of it |
void |
setInputSource(Source source)
Set the Source document |
void |
setResult(Result result)
Method setResult allows the user of the TransformerHandler to set the result of the transform. |
void |
setRoot(DocImpl root)
Set the root document of tree will be created. |
void |
setShouldTransformAtEnd(boolean b)
|
void |
setSystemId(java.lang.String baseID)
Set the base ID (URL or system ID) from where relative URLs will be resolved. |
void |
setUseMultiThreading(boolean b)
Set whether or not the tree being built should handle transformation while the parse is still going on. |
void |
skippedEntity(java.lang.String name)
Receive notification of a skipped entity. |
void |
startCDATA()
Report the start of a CDATA section. |
void |
startDocument()
Implement the startDocument event. |
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 ns,
java.lang.String localName,
java.lang.String name,
Attributes atts)
Implement the startElement event. |
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. |
void |
unparsedEntityDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId,
java.lang.String notationName)
Receive notification of an unparsed entity declaration event. |
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
error,
fatalError,
resolveEntity,
warning |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public SourceTreeHandler(TransformerImpl transformer)
transformer
- The transformer this will use to transform a
source tree into a result tree.public SourceTreeHandler(TransformerImpl transformer, boolean doFragment)
transformer
- The transformer this will use to transform a
source tree into a result tree.public SourceTreeHandler()
Method Detail |
public void setShouldTransformAtEnd(boolean b)
public Node getRoot()
public void setRoot(DocImpl root)
root
- root document of tree that will be createdpublic void setExceptionThrown(java.lang.Exception e)
e
- Exception that was thrownpublic void setInputSource(Source source)
source
- source documentpublic Source getInputSource()
public void setDocumentLocator(Locator locator)
locator
- Document locatorpublic void setUseMultiThreading(boolean b)
b
- Flag to indicate whether to use multiple threadspublic boolean getUseMultiThreading()
public void startDocument() throws SAXException
public void endDocument() throws SAXException
public void startElement(java.lang.String ns, java.lang.String localName, java.lang.String name, Attributes atts) throws SAXException
ns
- Namespace of the elementlocalName
- Local part of the qualified name of the elementname
- Name of the elementatts
- List of attributes associated with the elementpublic void endElement(java.lang.String ns, java.lang.String localName, java.lang.String name) throws SAXException
ns
- Namespace of the elementlocalName
- Local part of the qualified name of the elementname
- Name of the elementpublic void startCDATA() throws SAXException
The contents of the CDATA section will be reported through the regular characters event.
endCDATA()
public void endCDATA() throws SAXException
startCDATA()
public void characters(char[] ch, int start, int length) throws SAXException
ch
- Character array from the characters eventstart
- Start index of characters to process in the arraylength
- Number of characters to process in the arraypublic void charactersRaw(char[] ch, int start, int length) throws SAXException
ch
- Character array from the characters eventstart
- Start index of characters to process in the arraylength
- Number of characters to process in the arraypublic void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
ch
- Character array from the characters eventstart
- Start index of characters to process in the arraylength
- Number of characters to process in the arraypublic void processingInstruction(java.lang.String target, java.lang.String data) throws SAXException
target
- Target of PI nodedata
- Content of PI nodepublic void comment(char[] ch, int start, int length) throws SAXException
This callback will be used for comments inside or outside the document element, including comments in the external DTD subset (if read).
ch
- An array holding the characters in the comment.start
- The starting position in the array.length
- The number of characters to use from the array.public void startEntity(java.lang.String name) throws SAXException
The start and end of the document entity are not reported. The start and end of the external DTD subset are reported using the pseudo-name "[dtd]". All other events must be properly nested within start/end entity events.
Note that skipped entities will be reported through the skippedEntity event, which is part of the ContentHandler interface.
name
- The name of the entity. If it is a parameter
entity, the name will begin with '%'.endEntity(java.lang.String)
,
DeclHandler.internalEntityDecl(java.lang.String, java.lang.String)
,
DeclHandler.externalEntityDecl(java.lang.String, java.lang.String, java.lang.String)
public void endEntity(java.lang.String name) throws SAXException
name
- The name of the entity that is ending.startEntity(java.lang.String)
public void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws SAXException
Any declarations are assumed to be in the internal subset unless otherwise indicated by a startEntity event.
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.endDTD()
,
startEntity(java.lang.String)
public void endDTD() throws SAXException
startDTD(java.lang.String, java.lang.String, java.lang.String)
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws 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 endPrefixMapping(java.lang.String prefix) throws 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 skippedEntity(java.lang.String name) throws 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 setResult(Result result) throws java.lang.IllegalArgumentException
result
- A Result instance, should not be null.public void setSystemId(java.lang.String baseID)
baseID
- Base URL for the source tree.public java.lang.String getSystemId()
setSystemId(java.lang.String)
.public Transformer getTransformer()
public void elementDecl(java.lang.String name, java.lang.String model) throws SAXException
The content model will consist of the string "EMPTY", the string "ANY", or a parenthesised group, optionally followed by an occurrence indicator. The model will be normalized so that all whitespace is removed,and will include the enclosing parentheses.
name
- The element type name.model
- The content model as a normalized string.public void attributeDecl(java.lang.String eName, java.lang.String aName, java.lang.String type, java.lang.String valueDefault, java.lang.String value) throws SAXException
Only the effective (first) declaration for an attribute will be reported. The type will be one of the strings "CDATA", "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", or "NOTATION", or a parenthesized token group with the separator "|" and all whitespace removed.
eName
- The name of the associated element.aName
- The name of the attribute.type
- A string representing the attribute type.valueDefault
- A string representing the attribute default
("#IMPLIED", "#REQUIRED", or "#FIXED") or null if
none of these applies.value
- A string representing the attribute's default value,
or null if there is none.public void internalEntityDecl(java.lang.String name, java.lang.String value) throws SAXException
Only the effective (first) declaration for each entity will be reported.
name
- The name of the entity. If it is a parameter
entity, the name will begin with '%'.value
- The replacement text of the entity.externalEntityDecl(java.lang.String, java.lang.String, java.lang.String)
,
DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
public void externalEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws SAXException
Only the effective (first) declaration for each entity will be reported.
name
- The name of the entity. If it is a parameter
entity, the name will begin with '%'.publicId
- The declared public identifier of the entity, or
null if none was declared.systemId
- The declared system identifier of the entity.internalEntityDecl(java.lang.String, java.lang.String)
,
DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
public void notationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws SAXException
It is up to the application to record the notation for later reference, if necessary.
At least one of publicId and systemId must be non-null. If a system identifier is present, and it is a URL, the SAX parser must resolve it fully before passing it to the application through this event.
There is no guarantee that the notation declaration will be reported before any unparsed entities that use it.
name
- The notation name.publicId
- The notation's public identifier, or null if
none was given.systemId
- The notation's system identifier, or null if
none was given.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
,
AttributeList
public void unparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notationName) throws SAXException
Note that the notation name corresponds to a notation reported by the notationDecl event. It is up to the application to record the entity for later reference, if necessary.
If the system identifier is a URL, the parser must resolve it fully before passing it to the application.
name
- The unparsed entity's name.publicId
- The entity's public identifier, or null if none
was given.systemId
- The entity's system identifier.notation
- name The name of the associated notation.notationDecl(java.lang.String, java.lang.String, java.lang.String)
,
AttributeList
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |