Open GoogleCodeExporter opened 9 years ago
One can use Xeger (the reverse of regex) to generate valid string that adhere
to the pattern.
If you want I can provide you with some example code.
Pierre
Original comment by Pierre.v...@gmail.com
on 29 Nov 2013 at 7:59
it supports restrictions.
it supports all facets except pattern;
in your example, you are using pattern facet:
{{{
<xs:pattern value="[0-9]{11}"/>
}}}
Original comment by santhosh.tekuri@gmail.com
on 29 Nov 2013 at 9:15
Hi Pierre,
I looked at Xeger and i liked the project.
there are few concerns in using Xeger:
Concern 1:
given regex, it generates sample string matching that regex.
but it doesn't support generating a sample value of length 11.
because the example provided in issue has:
<xs:maxLength value="11"/>
Concern 2:
I am not sure whether, the regex syntax supported by this library is same as
specified in:
http://www.w3.org/TR/xmlschema-2/#rf-pattern
So I think it is not worth using it.
in case you want to make it work as per your requirements:
you can implement XSInstance.SampleValueGenerator interface and supply it as
below:
XSInstance xsInstance = ...
xsInstance.sampleValueGenerator = new MySampleValueGenerator()
XSInstance.SampleValueGenerator is recently added to jlibs
it is not present in downloads tab. you can get latest build from maven
snapshot repository or from
https://dl.dropboxusercontent.com/u/326301/jlibs-r1774.zip
Original comment by santhosh.tekuri@gmail.com
on 29 Nov 2013 at 9:35
Original issue reported on code.google.com by
kolobo...@gmail.com
on 27 Nov 2013 at 8:37