xsd:SimpleType: How to restrict attribute to list of specific values with concatenations


I have 10 "bracketed" variables ("[EVENT]", "[PROTOCOL]", "[SESSION]", etc...) I need to restrict an attribute. Valid cases are:

<ol><li>Any string without brackets </li> <li>Mentioned 10 "bracketed" variables</li> <li>Any bracketed variable(s) concatenated with regular strings, for example: My[EVENT]<em>for</em>[PROTOCOL]@google.com</li> <li>Empty string</li> </ol>

Non-valid cases:

<ol><li>Any string inside brackets, except 10 predefined</li> <li>The same with concatenations </li> <li>Strings with only opening or closing bracket </li> </ol>

To be short - inside brackets only predefined variables are allowed and they can be concatenated with any string.

Thanks in advance


Read the regular expression as follows: <strong><em>The concatenation of one or more substrings containing no brackets except for those surrounding EVENT, PROTOCOL, or SESSION.</em></strong> This is trivially extended to additional acceptable bracketed variables.

<?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="root"> <xs:complexType> <xs:attribute name="attr"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:pattern value="[^\[\]]*"/> <xs:pattern value="([^\[\]]*\[(EVENT|PROTOCOL|SESSION)\][^\[\]]*)+"/> </xs:restriction> </xs:simpleType> </xs:attribute> </xs:complexType> </xs:element> </xs:schema>


  • How to write a parameterized SQL query?
  • Error when trying to test an async Dart ajax HttpRequest
  • Find string to regular expression programmatically?
  • How to Convert IList to IList where SomeObject implements ISomeInterface using covariance in C# 4.0
  • iOS 64-bit app Doubles in Size
  • ASP.NET SQLMembershipProvider - email as username
  • Can Java comments be seen by decompiling?
  • doesn't quotename work inside of exec?
  • PHP FTP directory listing error
  • Updating app on device with .xib removed crashes app
  • how can i generate ssis packages from biml using commandline and deploy ssis on server
  • javascript use var value as name for new var
  • Swift 3 - Pass struct by reference via UnsafeMutableRawPointer?
  • How can I install Lib::XML on ActiveState Perl 5.20?
  • AWS S3 implementation for serving private files
  • EF6 and pre-generated views
  • Sun.security couldn't find after upgrading Java
  • How to discover a file is changed in GIT during a push
  • Cannot update firebase version [duplicate]
  • Send the string to its hex equivalent
  • Autohotkey script running program with command line arguments
  • Is there a way to choose which files are displayed to the user via the standard OPENFILE dialogs?
  • Loop through each key and value of php multidimensional array
  • How to search a CSV file with php by checking if a date falls between 2 ranges
  • Setting WPF Window Background to Resource Dictionary Brush User Setting
  • several dataProvider per one Test in TestNG
  • How to specify input and output paths from cmd.exe for a PowerShell script?
  • Symfony 2. CSRF token is invalid
  • What does 'Language neutral' mean with regard to MAKELANGID?
  • Unable to decode certificate at client new X509Certificate2()
  • Seeking advice on Jetty HttpClient Hang
  • Apache 2.4 and php-fpm does not trigger apache http basic auth for php pages
  • When should I choose bucket sort over other sorting algorithms?
  • Release, debug version and Authorization Google?
  • Google cloud sdk not working when python points python3
  • Is there a mandatory requirement to switch app.yaml?
  • using HTMLImports.whenReady not working in chrome
  • Memory offsets in inline assembly
  • How can I remove ASP.NET Designer.cs files?
  • Android Heatmap on canvas or ImageView