pavankumard Posted May 4, 2007 Share Posted May 4, 2007 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 More sharing options...
eight968 Posted May 8, 2007 Share Posted May 8, 2007 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.