英語 での Elementrule の使用例とその 日本語 への翻訳
{-}
- 
                        Colloquial
                    
- 
                        Ecclesiastic
                    
- 
                        Computer
                    
- 
                        Programming
                    
At most once as the eldest child of each elementRule.
An elementRule can have the label attribute. A form of elementRule is as below:.
As a more advanced example, consider elementRule as below:.
HedgeRuleand elementRule are prohibited from sharing a label. The following example is a syntax error.
Prohibition of label sharing by hedgeRule and elementRule.
Finally, we add the role attribute to the elementRule and specify the role generated above.
An elementRule containing a tag may not have the role attribute. The label attribute is mandatory, instead.
In this example, a hedgeRule is referenced from an elementRule. But a hedgeRule may reference to another hedgeRule.
The elementRule element shown below has an annotation as its eldest child. The content of this annotation is omitted.
A sequence of<foo/> and<foo2/> matches ref in the mixed element. Thus,the following example is permitted by this elementRule.
This elementRule allows the following two elements only. Whitespace characters may not occur between and.
RELAX allows element elements as permissible hedge models. They are mere syntax sugar,and are expanded as ref, elementRule, and tag elements. In this section, we show motivation behind element elements and then present the mechanism.
An elementRule element is generated. As the value of its role attribute, we generate a role that does not conflict with any other role. The value of the label attribute is the label generated together with the ref element. As the hedge model of this elementRule, the type attribute of the element element is copied.
In STEPs 0 thru 9, attributes and tag names are separated from hedge models. Attributes and tag names are described by tag and attPool elements, while hedge models are described by elementRule and hedgeRule elements. An elementRule references to a tag via a role, and the tag may in turn reference to attPool elements.
Next, we move the embedded tag element from the elementRule and place as a sibling element. We then add the role attribute and specify the generated role as the attribute value.
To reference to such a hedgeRule, we write<hedgeRef label="foo"/>. This hedgeRef is replaced with the element hedge model specified in the hedgeRule. In the following example, the hedge model of the elementRule for the element type doc references to a hedgeRule. This elementRule is borrowed from the module in the beginning of STEP 1, and the hedge model minus title is rewritten by a hedgeRule.
In the following example, the hedge model of the elementRule for the element type doc references to a hedgeRule. This elementRule is borrowed from the module in the beginning of STEP 1, and the hedge model minus title is rewritten by a hedgeRule.
Suppose that we rewrite a DTD containing 200 element types in RELAX. This size is fairly large, but is not uncommon. For each element type, RELAX needs an 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.
Suppose that roles val-integer and val-string are referenced from these two elementRule elements only. Rather than introducing two names val-integer and val-string for referencing, authors might want to directly embed tag elements within elementRule elements.
Each of the element elements is replaced by a ref element. Furthermore, an elementRule element and tag element are generated for each element element. As a hedge model, each elementRule has a reference to the datatype specified by the type attribute of the original element element.