2

I'd like to understand the difference and use cases of each group type.

I've seen this example in W3 schools, and it wasn't clear when to use either.

kjhughes
  • 106,133
  • 27
  • 181
  • 240
Alex
  • 41
  • 5
  • 2
    W3Schools can sometimes be a handy source of reference information and sometimes it can be dreadful. I'd put the page you cite in the second category. It collects a random set of concepts together under an invented heading "indicators" which is not used in the spec (and is therefore never going to appear in an error message), and it doesn't explain any of them in enough detail to actually use them. To use XSD, in my view, you need to buy a couple of good books. – Michael Kay Jan 15 '23 at 15:10

1 Answers1

2

XSD xs:group and xs:attributeGroup enable declaration reuse in xs:complexType definitions:

  • Use xs:group to define a named, reusable group of elements.

  • Use xs:attributeGroup to define a named, reusable group of attributes.

See W3C XML Schema Part 0: Primer for xs:group and xs:attributeGroup examples.

See also

kjhughes
  • 106,133
  • 27
  • 181
  • 240