Ejen Logo
 
   <sax>


Description
Sax node allows to switch to SAX mode and to use specialized XMLReaders.
 
Without any attributes, it simply switch to SAX mode, converting current DOM tree into SAX events: this may improve performances.
 
...
<sax>
  <filter uri="filter1.xsl"/>
  <filter uri="filter2.xsl"/>
  <filter uri="filter3.xsl"/>
</sax>
...

Here, the result of this SAX pipe will be converted into a DOM tree and will overwrite the current node (but you may use merge attribute to avoid this behavior).
 
With only a uri attribute and no children, it as the same effect as a source node (SAX events are converted into a DOM tree):
 
...
<sax uri="file.xml"/>
...

With a reader and a uri attributes, it may convert any kind of input content into an XML tree (provided that you have a specialized XMLReader):
 
...
<sax reader="org.ejen.readers.java.SourceReader" uri="Source.java"/>
...

This will read the "Source.java" file and produce an XML representation of its content.
 
You may again use filter nodes before returning to DOM mode:
 
...
<sax reader="org.ejen.readers.java.SourceReader" uri="Source.java">
  <filter uri="faddjdoc.xsl"/>
  ...
</sax>
...

You may also use one save or one template node to output the result of a transformation. This save or template must be the last child of a sax node:
 
...
<sax reader="org.ejen.readers.java.SourceReader" uri="SourceBean.java">
  <filter uri="fsrc.xsl"/>
  <template save="SourceHome.java" uri="ejb-home.xsl"/>
</sax>
...

This will create a "SourceHome.java" file based on an XML representation of a "SourceBean.java" file (see EJB demonstration). Note that if you use either a save or a template node, the result of the transformation is discarded when returning to DOM mode (no changes in the current node before and after this sax block) : any outputting consumes entirely SAX events.

Attribute Summary
 
NameDefault ValueOptionalAccepted Values
cachetruetruetrue | false
mergefalsetruetrue | false
reader true 
uri true 
validatingfalsetruetrue | false

Attribute Detail
 
cache
this attribute is always relative to an uri attribute within the same node. It allows to enable or to disable cache use for specific protocols (http protocol for example, if you have implemented this protocol with cache support).
merge
should we merge loaded XML tree as a child node of the current node (true) or replace current node (with all its children) by this loaded content (false) ? Default is false (overwrite current node).
reader
full name of a child class of org.ejen.readers.BaseReader. You may pass parameters to BaseReader implementations by using an URI-like query part: org.ejen.readers.binary.BinaryReader?low=true (refer to API documentation). If you want to create specialized DocumentReader, you should download Ejen sources and have a look at the org.ejen.readers.binary.BinaryReader class.
uri
name of the file to be generated. this is a generic input or output attribute. It is used as a content reference, using a specific protocol: file, http, ftp and jar protocols are supported by default, but there is a way to plug in additional protocols (see option node). If no protocol is specified, file is used by default. An uri attribute, except if it is absolute, is always relative to a base URI (see ejen node). Note that all protocols are not supposed to allow both reading and writing.
validating
should we perform validation of the loaded file ? Default is false (no validation). Note that this attribute has no effect if you are using a specialized reader.

Children
 
filter, save, template


SourceForge.net Logo