ENGLISH | JAPANESE |
<< | HOW TO RELAX/Part 1: RELAX Core/STEP 5: Dividing large modules | >> |
elementRule
and a tag
. If each elementRule
and tag
requires three lines, the total is 1200 lines. If we write extensive documentation, the total may become 3000 lines or even more. This size is too large to put in a single file.include
element. The include
element is replaced with the content of the referenced module.include
. First, a module to be included is as below:
<module moduleVersion="1.2" relaxCoreVersion="1.0" targetNamespace="" xmlns="http://www.xml.gr.jp/xmlns/relaxCore"> <interface/> <elementRule role="bar" type="emptyString"/> <tag name="bar"/> </module> |
This module contains an elementRule
and tag
for the element type bar
. The interface
element is empty. Suppose that this module is stored in bar.rlx
.
Next, a module which references to and includes this module is as below:
<module moduleVersion="1.2" relaxCoreVersion="1.0" targetNamespace="" xmlns="http://www.xml.gr.jp/xmlns/relaxCore"> <interface> <export label="foo"/> </interface> <elementRule role="foo"> <ref label="bar"/> </elementRule> <tag name="foo"/> <include moduleLocation="bar.rlx" /> </module> |
This module contains an elementRule
and tag
for the element type foo
. The include
at the end of this this module references to bar.rlx
via the moduleLocation
attribute.
The include
element is replaced by the body of the referenced module, which the content of the module
element except the interface
element. In this example, replacement is done as below:
<module moduleVersion="1.2" relaxCoreVersion="1.0" targetNamespace="" xmlns="http://www.xml.gr.jp/xmlns/relaxCore"> <interface> <export label="foo"/> </interface> <elementRule role="foo"> <ref label="bar"/> </elementRule> <tag name="foo"/> <elementRule role="bar" type="emptyString"/> <tag name="bar"/> </module> |
interface
element of the referenced module is empty. Suppose that an export
element is supplied in the interface
element.
<module moduleVersion="1.2" relaxCoreVersion="1.0" targetNamespace="" xmlns="http://www.xml.gr.jp/xmlns/relaxCore"> <interface> <export label="bar"/> </interface> <elementRule role="bar" type="emptyString"/> <tag name="bar"/> </module> |
In this case, the children of the interface
element in the referenced module are attached to the interface
element in the referencing module. In this example, the result of replacement is as below:
<module moduleVersion="1.2" relaxCoreVersion="1.0" targetNamespace="" xmlns="http://www.xml.gr.jp/xmlns/relaxCore"> <interface> <export label="foo"/> <export label="bar"/> </interface> <elementRule role="foo"> <ref label="bar"/> </elementRule> <tag name="foo"/> <elementRule role="bar" type="emptyString"/> <tag name="bar"/> </module> |
<< | HOW TO RELAX/Part 1: RELAX Core/STEP 5: Dividing large modules | >> |