|
Devsphere.com |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--javax.xml.transform.Transformer
|
+--com.devsphere.xml.saxdomix.SDXTransformer
|
+--com.devsphere.examples.xml.saxdomix.SmartTransformer
This example is similar to MixedTransformer, but it "knows"
when to request the DOM sub-trees for transformation.
SmartTransformer parses the XSL file and analyzes
the match attribute of the template and
key tags. This process is done before the mixed SAX-DOM parsing
and is useful to find out the names of the elements for which there are
template rules. The wantDOM() method returns true
for these elements.
SDXTransformer,
TransformerRunner| Field Summary | |
protected java.util.Vector |
elements
The names of the elements that will be the roots of the DOM sub-trees |
protected static javax.xml.parsers.SAXParserFactory |
jaxpFactory
JAXP factory for SAX parsers used to analyze the XSL files |
| Fields inherited from class com.devsphere.xml.saxdomix.SDXTransformer |
builder, fragmentTransformer, resultFilter, serializer, traxFactory |
| Constructor Summary | |
SmartTransformer(java.lang.String xslSystemID)
Does the initialization |
|
| Method Summary | |
protected void |
buildElementsVector(java.lang.String xslSystemID)
Parses the XSL file end analyzes the match attributes
of the template and key tags. |
static void |
main(java.lang.String[] args)
Uses TransformerRunner in order to create an instance of
this class, configure it and call its transform() method. |
protected void |
processPath(java.lang.String path)
Adds the last element of an XPath to the elements vector. |
protected void |
processPattern(java.lang.String pattern)
Processes the value of the match attribute of
a template or key tag. |
boolean |
wantDOM(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qualifiedName,
org.xml.sax.Attributes attributes)
Returns true when the application wants to receive
a DOM sub-tree for handling, that is the elements vector
contains the qualified name of the current element |
| Methods inherited from class com.devsphere.xml.saxdomix.SDXTransformer |
clearParameters, createBuilder, createResultFilter, createSerializer, getErrorListener, getOutputProperties, getOutputProperty, getParameter, getURIResolver, handleDOM, setErrorListener, setOutputProperties, setOutputProperty, setParameter, setURIResolver, transform |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static javax.xml.parsers.SAXParserFactory jaxpFactory
protected java.util.Vector elements
| Constructor Detail |
public SmartTransformer(java.lang.String xslSystemID)
throws javax.xml.transform.TransformerException,
javax.xml.parsers.ParserConfigurationException,
org.xml.sax.SAXException,
java.io.IOException
| Method Detail |
public boolean wantDOM(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qualifiedName,
org.xml.sax.Attributes attributes)
throws org.xml.sax.SAXException
true when the application wants to receive
a DOM sub-tree for handling, that is the elements vector
contains the qualified name of the current element
wantDOM in interface SDXControllerwantDOM in class SDXTransformernamespaceURI - The element's namespace URIlocalName - The element's local namequalifiedName - The element's qualified nameattributes - The element's attributes
builder must enter
in DOM parsing mode or must remain
in SAX parsing mode
org.xml.sax.SAXException - If an error must be signaled
protected void buildElementsVector(java.lang.String xslSystemID)
throws javax.xml.parsers.ParserConfigurationException,
org.xml.sax.SAXException,
java.io.IOException
match attributes
of the template and key tags. This process
is done before the mixed SAX-DOM parsing and is useful to find out
the names of the elements for which there are template rules.
The wantDOM() method returns true for these
elements.
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOExceptionprotected void processPattern(java.lang.String pattern)
match attribute of
a template or key tag. It removes all
predicates and passes each XPath to processPath().
protected void processPath(java.lang.String path)
elements vector.
public static void main(java.lang.String[] args)
TransformerRunner in order to create an instance of
this class, configure it and call its transform() method.
|
Devsphere.com |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||