Gotz defines two XML Namespaces.
They are required in root element <gotz> in the definition files bean.xml and job.xml files
<gotz xmlns="http://codetab.org/gotz"
xmlns:xf="http://codetab.org/xfields">
....
</gotz>
The namespace http://codetab.org/gotz is default namespace and it is set with xmlns attribute.
Gotz uses extensible fields (xfields) to pass user defined values to the classes and these fields uses namespace http://codetab.org/xfields and it is set in root element using xml:xf attribute with xf prefix. The root element of xfields is <fields> and now onward, we refer xfields as fields.
Embedded Fields
The <fields> defined within dataDef should always prefixed with xf:
<dateDef>
....
<member name="year">
<xf:fields>
<xf:indexRange value="2-6" />
</xf:fields>
</member>
Standalone Fields
The job.xml defines tasks using fields element and when tasks definition is lengthy it may be cumbersome to prefix, each and every fields, with xf: and to make it easy, for standalone fields such as tasks we reset NS http://codetab.org/xfields as default NS. The snippet from Example-6 job.xml is shown below
<gotz xmlns="http://codetab.org/gotz" xmlns:xf="http://codetab.org/xfields">
<locators group="bs">
<locator name="Acme" url="/defs/examples/page/acme-bs.html" />
</locators>
<fields name="locator" class="org.codetab.gotz.model.Locator"
xmlns="http://codetab.org/xfields">
<tasks name="bs tasks" group="bs">
<task name="bs" dataDef="bs">
...
</fields>
<dataDef name="bs">
<axis name="col">
xf:fields>
<xf:query region="table:contains(Sources Of Funds)"
field="tr:nth-child(1) > td:nth-child(%{col.index})" />
</xf:fields>
</dataDef>
</gotz>
- It starts with standard <gotz> with default NS (gotz) and xf: NS (xfields)
- The first child, locators, belongs to default NS (gotz) and any embedded fields should be prefixed with xf:
- The next element fields, redefines NS http://codetab.org/xfields as default. Now on, there is no need to prefix xf: for fields and all its children.
- The redefined NS is only applicable up to the closing <fields> and after that, original NS become effective So, <dataDef belongs default NS (gotz) and any fields embedded in it should be prefixed with xf:
In this next chapter, we look at tasks and how to define workflow.