Jump to content

How to do this?


pavankumard
 Share

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 comment
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 comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...