Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-5799

Axis2 xsd2java - namespace prefix added to inherited attributes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.7.3
    • 1.7.4
    • adb
    • None
    • Axis2 1.7.3
      Windows
      Maven 3.3+

    Description

      We have recently migrated from Axis2 1.6.2 to 1.7.3.

      We have multiple XSDs that extend complex-type elements from a common parent XSD.

      After the migration, we now have different namespace prefixes on our attributes.

      For example:
      1.6.2 <child:Object id="1234" name="JohnDoe".../>
      1.7.3 <child:Object child:id="1234" parent:name="JohnDoe".../>

      According to the namespace spec ():
      "Default namespace declarations do not apply directly to attribute names; the interpretation of unprefixed attributes is determined by the element on which they appear."

      In the generated Java code, for example the parse methods now have fully qualified attribute names:

      if (localName != null){
        writeAttribute("http://www.example.org/core", "name", org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localName), xmlWriter);
      }
      ...
      if (localId != null){
        writeAttribute("http://www.example.org/child", "id", org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localId), xmlWriter);
      }
      

      Previously I believe, the given attribute namespace was null.

      The serialized XML generated with this approach does not validate in AltovaXML editor. (The attribute 'core:name' is not permitted in the element <child:Object>).

      I will attach an example with two XSDs and the Axis 1.7.3 generated source-code.

      Attachments

        1. AXIS2-5799_Example.zip
          12 kB
          Jeff Thomas

        Issue Links

          Activity

            People

              veithen Andreas Veithen
              JWT007 Jeff Thomas
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: