Jump to content

How to do this?


Recommended Posts

Hi, Is there any way to do the following using XSD? The XML is as follows. <Data> <UserId /> <Password /> <LoggedInDate /> ...... </Data> All tags have minOccurs="0" The XSD should be able to validate the following constraint ... If the <UserId> tag is passed then <Password> tag also should be passed. can I write an XSD for the above.Thanks & Regards,Pavan.

Link to post
Share on other sites

No, there is no way to link the two together that way, but you do have some other options if you change the way your xml is.You could have something like:<Data><Login UserID="" Password="" /> <LoggedInDate />Then you'd make the Login optional but the UserID and Password required.You could also do the very similar: <Data><LoginInfo> <UserId /> <Password /></LoginInfo><LoggedInDate />and make your schema like<xs:element name="LoginInfo"><xs:sequence><xs:element name="UserID" minOccurs="1"/><xs:element name="Password" minOccurs="1"/></xs:sequence></xs:element>--Charles

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...