Next in thread →
Next in month →
Re: [xml-dev] Do not use the same tag name for different things ... Do you agree?
<Items>
<Aquarium>
<Tank>40 gallon capacity</Tank>
</Aquarium>
<Abrams>
<Tank>M-1A2C</Tank>
</Abrams>
<Aquarium>
<Tank>40 gallon capacity</Tank>
</Aquarium>
<Abrams>
<Tank>M-1A2C</Tank>
</Abrams>
</Items>
is valid against
start = items
items = element Items {thing*}
thing = ( pet-house | vehicle )
pet-house = aquarium
aquarium = element Aquarium { fish-tank }
# add more pet houses here
fish-tank = element Tank {text}
vehicle = abrams
# add more vehicles here
abrams = element Abrams { battle-tank }
battle-tank = element Tank {text}
items = element Items {thing*}
thing = ( pet-house | vehicle )
pet-house = aquarium
aquarium = element Aquarium { fish-tank }
# add more pet houses here
fish-tank = element Tank {text}
vehicle = abrams
# add more vehicles here
abrams = element Abrams { battle-tank }
battle-tank = element Tank {text}
On Fri, 21 Jan 2022 at 17:06, Roger L Costello <[email protected]> wrote:
David Carlisle wrote (paraphrasing):
> The fact that you cannot have two different global declarations
> of a Tank element is a limitation of XML Schemas. Other
> constraint languages do not have the limitation.
Wow!
> If you use Relax NG you can globally declare tank-fish and
> tank-military patterns that both use the same element name,
> but each used in their respective contexts.
Wow!
I haven't done anything with Relax NG for a long time. Would someone show Relax NG code that creates two "Tank" elements (an aquarium tank and a military tank) without violating DRY (Don't Repeat Yourself), please?
/Roger
Next in thread →
Next in month →