Essentially I want to know if a specific XSD schema can be replaced by a regular expression or not. I know that XML Schema language can produce XSDs whose set of valid XML instances can be of any type of language (even context-sensitive). I want to identify those schemas that are "regex-equivalent". I came up with this question after tackling the following problem:
I needed to parse a specific text format and I first tried regular expressions and I saw that regexp is sufficient to parse it. I then wanted to make an XML representation for the messages that I received in this format so I mapped regex groups with XML elements. I then created manually an XSD schema based on the structure of the regex. In the end , I had a schema that could replace my regex, in the sense that the original regex was possible to be constructed from the schema. I also managed to do the opposite: Create the schema automatically from the regex. So I could transform the message into XML and validate it on the same time. My questions are:
Can every regex be represented by an XSD schema? (I mean, given a regex to be able to produce an XSD schema)
Given an arbitrary XSD schema is there a way to determine if there is a regex whose representation is the given schema?
EDIT: Probably the answer to 1st question is yes since i did it with my regex in a way that did not depend on the specific regex(This isn't a proof for every regex).