Jump to content

HowTo: Include *Both* Elements *And* Attributes in An Element


Jesdisciple

Recommended Posts

To understand how to do this, I Googled it multiple times and even went hunting through the obscure W3Schools Schema Reference the schema DTD. But I understood only when I specifically Googled W3.org and visited XML Schema Part 0: Primer. (To be fair, the answer was on the W3Schools XML Schema complexType Element page, but it was not given enough prominence for me to understand it as such.)Here's the first syntax that passed validation for me (minus the schema namespace):

<complexType>	<all>		...	</all>	<attribute>	<attribute>	<attribute>	...</complexType>

"all" can be replaced by "group," "sequence," or "choice," and the number of attributes is unrestricted. The attributes MUST come after that indicator.I hope someone will be spared the trouble I went through for this.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...