Ejen Logo
 
   <source>


Description
Source node is primarily intended to load an XML file in DOM mode. By using the validating attribute, it may perform DTD or XML Schema validation. builder attribute gives a way to use specialized DocumentBuilder in order to exploit any information (other than XML files).
 
...
<source uri="input.xml"/>
...

Here, the current XML node will be replaced by the "input.xml" content tree.
 
...
<source merge="true" uri="input.xml"/>
...

With this, merge attribute, "input.xml" content tree will be append as a new child node of the current XML node.
 
You may merge any number of files in the current XML tree:
 
...
<source uri="input.xml" validating="true"/>
<foreach select="doc/item">
  <source
    merge="true"
    uri="{@name}.xml"
    validating="true"/>
</foreach>
...

Each doc/item node will have a new appended child by loading an XML file whose name is based on a name attribute. In this sample, validation is performed for each input file.
 
You may finally use specialized DocumentBuilder:
 
...
<source builder="org.ejen.builders.html.HTMLBuilder" uri="http://www.sun.com"/>
...

An HTML builder is used in this example to convert HTML content into a DOM tree.
 
See also sax node.

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

Attribute Detail
 
builder
full name of a child class of org.ejen.builders.BaseBuilder. You may pass parameters to BaseBuilder implementations by using an URI-like query part: org.ejen.builders.html.HTMLBuilder?show-warning=true&amp;... (refer to API documentation). If you want to create specialized DocumentBuilder, you should download Ejen sources and have a look at the org.ejen.builders.html.HTMLBuilder class.
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).
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 builder.

Children
 
No.


SourceForge.net Logo