Jump to content
Jesdisciple

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

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...