Jump to content

Possible in XSD ?


w3-ravenala
 Share

Recommended Posts

Hi everyone,I've a very simple question about XSD schemas... here is the thing :In my XML file I have an Element containing an string attribute :<myElement myAttribute="aString">...</myElement>I want my schema to check that :- if "aString" contains '?' or '*', it has to match the regular expression A- else it must match the regular expression BDo you think it is possible with XSD ?Many thanks, R.

Link to comment
Share on other sites

I'm afraid not. You could make a string match two regular expressions, but not to match either one and especially not on conditions.You may try to make this into a single regular expression though, like:

(A1)\?(A2)|(B1)\*(B2)

Replacing A* and B* with the respective regular expressions in a fashion that will allow them to be matched regardless of the posiion of either characers.

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