Element that can only have one of two text values?

后端 未结 2 433
孤独总比滥情好
孤独总比滥情好 2020-12-02 01:59

I\'m constructing a DTD which has a fuel_system element.

I want to restrict the text between tag. It must be only

2条回答
  •  醉梦人生
    2020-12-02 02:28

    when defining an element in a DTD, there is no way to restrict the text inside the element. you can only tell what other element (child elements) it might contain and their order, or you can tell that the element contains text, or a mixture of the 2.

    so, basically you have 2 options for restricting the : either declare it as an attribute (), or declare children elements and . the choice between those 2 options depends on what you are trying to describe and what will change depending on the type of fuel-system.

    (the grammar for the declaration of an element is defined here)

    examples: first option, attributes

    
    
    

    second option, child elements

    
    
    
    

提交回复
热议问题