I believe the three below are syntactically correct; but which are permitted according to conventions (especially in the enterprise)?
The first one below is used in most examples I've seen (e.g. JAXB), but it's verbose:
<xs:annotation>
<xs:appinfo>
<myinfo>don't panic</myinfo>
</xs:appinfo>
</xs:annotation>
This second one below is allowed because any attributes are permitted on <appinfo>
(that aren't in xml schema's own namespace). It's shorter, and seems reasonable - but is it conventional?
<xs:annotation>
<xs:appinfo myinfo="don't panic"/>
</xs:annotation>
This last one below is my favourite, because it's so short and doesn't clutter up the schema. I'm sure it's legal, because like <appinfo>
, any attributes are permitted on an <annotation>
(again, provided non-xml schema namespaced). But it encodes application info without using an <appinfo>
, so I'm afraid it would be frowned upon. Would it be?
<xs:annotation myinfo="don't panic"/>
Many thanks for your comments!