Uploaded image for project: 'yangtools'
  1. yangtools
  2. YANGTOOLS-1571

RegexUtils does not convert all XSD specifics to Java-compatible regex

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Medium Medium
    • None
    • None
    • parser

      Processing of the pattern argument in yangtools fails for some valid XML schema regular expressions as required by RFC 7950.

      For example, yangtools failed to process the following pattern:

       pattern '[\i-[:]][\c-[:]]*';
      

      It appears that yangtools do not recognize the following multi-character escape sequences:

      • \c
      • \C
      • \i
      • \I

      And also it does not interpret character class subtraction correctly and pattern matching does not work.

      For example, the following pattern should not match 'c' but it does:

      pattern '[a-z-[c]]'
      

       

      Proposal solution:

      Implement logic in the RegexUtils class to translate XSD patterns into Java-compatible regex. This can be achieved similarly to the method shown in this code:

      https://github.com/apache/netbeans/blob/e8fb660e9fe47f14991e46a22ffcb38bf37bab75/ide/schema2beans/src/org/netbeans/modules/schema2beansdev/SchemaRep.java#L1624

            PeterSuna Peter Suna
            PeterSuna Peter Suna
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: