How to use a pattern to match element names in compact relaxng

183 Views Asked by At

I have some XML that needs validating from external source that has a similar layout too below

<stuff>
   <id-0001>test</id-0001>
   <id-0002>test</id-0002>
   <id-0003>test</id-0003>
   <id-0004>test</id-0004>
</stuff>

I tried the following but it is not valid

datatypes xs = "http://www.w3.org/2001/XMLSchema-datatypes"
start = stuff

stuff = element stuff
{
   element id-* { text }*
}

Ideally I would like a regex match on the id tag names

1

There are 1 best solutions below

1
On

To my knowledge it's not possible to define patterns in RELAX NG for element names. See also RelaxNG enumerated element names and relax-ng compact: attribute whose name matches a reg-ex for similar questions.