Public identifiers, parsing

You can parse a XML/SGML public identifier into its constituent parts using the following pattern. It is sometimes necessary to decode a public identifier when resolving an entity.

     match ("+//" any** => registered-owner-identifier "//" |
            "-//" any** => unregistered-owner-identifier "//" |
            any** => iso-owner-identifier "//" 
           )
           any** => public-text-class "%_"
           ("-//" => unavailable-text-indicator)?
           any** => public-text-description "//"
           (letter{2} => public-text-language value-end |
            ((any** => public-text-designating-sequence 
              ("//" | value-end))
             (any* => public-text-display-version)?
            )
           )