I am parsing a XML file against a XSD containing some regex patterns used for checking input data, but only this regex generates an error, even if it passes into the Eclipse XSD plugin:
InvalidRegex: Pattern value
'(((com|org)\.)+(\b[a-z]+[.]{1}\b)+)?[A-Z]{1}[A-Za-z]+'
is not a valid regular expression. The reported error was:
'This expression is not supported in the current option setting.'.
So even if the problem is caused by the \b boundary which I can safely remove, with SAX validator where can I find the fatal "current option setting"?
RegEx pattern validation can be added to text input type questions. To add validation, click on the Validation icon on the text input type question.
XML schema always implicitly anchors the entire regular expression. The regex must match the whole element for the element to be considered valid. If you have the pattern regexp, the XML schema validator will apply it in the same way as say Perl, Java or . NET would do with the pattern ^regexp$.
Reference the XSD schema in the XML document using XML schema instance attributes such as either xsi:schemaLocation or xsi:noNamespaceSchemaLocation. Add the XSD schema file to a schema cache and then connect that cache to the DOM document or SAX reader, prior to loading or parsing the XML document.
\b
is not supported by the XML Schema regex flavor as specified by the W3C. The error message implies that you can use it anyway by changing a setting, but then you would be using a non-standard feature, which would defeat the purpose of using XML.
I'm not sure that's what the error message really means, but it would have been more helpful if it had just the regex was invalid. Do yourself a favor and forget about using \b
in your XSD's. And check out the rest of the regular-expressions.info site if you haven't already--it's a great resource.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With