Jump to content
Sign in to follow this  
Guest wsucougar86

Validating "Linked" values in multiple nodes

Recommended Posts

Guest wsucougar86
<Element ID="01" Item="Element01">	 <ElementID>01</ElementID>	 ...</Element>

For the XML sample above, is there anyway to ensure that the value of all three values (two attributes of "Element" and innertext value of "ElementID") all contain the same numeric value? I know I can use <xs:pattern> to require that ID be two numeric digits, etc. But if the "ID" attribute is 02 then ElementID needs to be 02 and the Item attribute must be "Element02" -- is it possible to link values like that in an XML schema??Hopefully that makes sense, but let me know if it doesn't. I appreciate the help!

Share this post


Link to post
Share on other sites

You can specify one of theese attributes as being of type xs:ID (or an extension/restriction of it), and the other one of xs:IDREF.Note that xs:IDREF items can't be xs:IDs at the same time. In other words, their xs:ID counterpart must be present in the document.Also, xs:IDs can't be the same between each other (I think). That is, you can't have for example "ID" and "Item" declared as xs:ID, and use "01" as a value for both.

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...
Sign in to follow this  

×
×
  • Create New...