7 Replies Latest reply on Oct 30, 2007 5:48 PM by kukeltje

    Pvm parser and namespaces

    porcherg

      Th pvm parser currently does not uses namespaces. A binding is registered for a tagName, which is a localname and each xml element with this localname will be parsed by this binding.

      For example, if we have:

      <env:string ... xmlns:env='url1'>
      <db:string ... xmlns:db='url2'>


      With url1 != url2, and a binding for 'string', the two elements are parsed with the same binding.

      In some situations, this can create bugs.
      To fix that, we can change the binding tagname from a string to a QName.
      What do you think of this modification ?

      Maybe we need to create a namespace for environment xml (or use a default null namspace).

      regards,
      Guillaume

        • 1. Re: Pvm parser and namespaces
          tom.baeyens

          never should we have a hard dependency on namespaces.

          but i would like our parser to be able to support namespaces, in case users do want it.

          we should try to make our languages fit together as much as possible without needing namespaces. i believe that should very well be possible.

          • 2. Re: Pvm parser and namespaces
            porcherg

            BPEL defines 5 different namespaces. So we need a parser with namespace support to parse a BPEL file.

            For things such as environment, we may not need to add a specific namespace.

            I've submitted a modification where:
            - by default, a binding is associated with a null namespace (matches only tags with no namespace)
            - you can associate a binding with a QName (matches only tags with the good namespace uri)

            This is a first step to have a namespace aware parser.

            regards,
            Guillaume

            • 3. Re: Pvm parser and namespaces
              tom.baeyens

               

              "porcherg" wrote:
              - by default, a binding is associated with a null namespace (matches only tags with no namespace)


              could you make the default to match with *any* namespace instead of only the null namespace ?

              "porcherg" wrote:
              - you can associate a binding with a QName (matches only tags with the good namespace uri)


              great.

              • 4. Re: Pvm parser and namespaces
                porcherg

                 

                "tom.baeyens@jboss.com" wrote:
                could you make the default to match with *any* namespace instead of only the null namespace ?


                For me, a binding that matches with any namespace is against the concepts of XML:
                - if an element is declared without namespace, then it has a default empty namespace.
                - if an two elements have the same localname but different namespace, they represent different entities and cannot be handled by the same binding.

                Do you have a use case where we need to match with any namespace ?

                Guillaume

                • 5. Re: Pvm parser and namespaces
                  csouillard

                  I agree with Guillaume.
                  I think XML is based on qualified names so we need to handle namespaces.

                  Charles

                  • 6. Re: Pvm parser and namespaces
                    tom.baeyens

                     

                    "porcherg" wrote:
                    Do you have a use case where we need to match with any namespace ?


                    any element might be defined by a given name space. first of all, i would like that element tag to match with unspecified name space usage and specified namespace usage.

                    secondly, there are things such as wiring xml. they appear in configuration xml as well as process xml. and they might appear in many more. ah.. but then you probably have different parsers.

                    in any case, i want users that don't know namespace to be able to work with our XML.

                    e.g. each time when i have to configure the default namespace and use validation (noNamespaceSchemaLocation or something like that) i have to look up the 2 really weird attributes that i have to set. took me quite a while to figure it out the first time.

                    users should not be bothered with this if they don't want to be bothered.

                    on the other hand. again, i agree that it must be possible to support name spaces if people *do* want it.

                    • 7. Re: Pvm parser and namespaces
                      kukeltje

                       


                      secondly, there are things such as wiring xml. they appear in configuration xml as well as process xml. and they might appear in many more. ah.. but then you probably have different parsers.

                      Only if you need a parser for the other namespave. I extended jbpm a little as a triel so the 'jbpm namespace' is the 'default' one (no prefix) and custom elements a user adds are in a specifc namespace. I'm sure together we can come up with a 1 page description of this. So
                      took me quite a while to figure it out the first time.
                      will not happen to you^H^H^H other users.

                      on the other hand. again, i agree that it must be possible to support name spaces if people *do* want it.

                      hahaha.... I do....