Uploaded image for project: 'XMLBeans'
  1. XMLBeans
  2. XMLBEANS-77

Inconsistent namespace for imported groups

    XMLWordPrintableJSON

    Details

      Description

      Before the long explanation, I'm importing a group from one namespace
      into another, and I'm getting elements in different namespaces
      depending on whether I compile 2 schemas together at once or first one,
      and then the second with the results of the first on the classpath for
      the compilation of the second. The schemas are identical for the two
      compilation methods.

      I'm really mystified by the following behavior and wonder if it is a
      bug.

      I have a small schema geronimo-naming.xsd

      <?xml version="1.0" encoding="UTF-8"?>
      <xsd:schema
      targetNamespace="http://geronimo.apache.org/xml/ns/naming"
      xmlns:gernaming="http://geronimo.apache.org/xml/ns/naming"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      elementFormDefault="qualified"
      attributeFormDefault="unqualified"
      version="1.0">

      <xsd:group name="jndiEnvironmentRefsGroup">
      <xsd:sequence>
      <xsd:element name="ejb-ref"
      type="gernaming:remote-refType"
      minOccurs="0" maxOccurs="unbounded"/>
      <xsd:element name="ejb-local-ref"
      type="gernaming:local-refType"
      minOccurs="0" maxOccurs="unbounded"/>
      <xsd:element name="resource-ref"
      type="gernaming:local-refType"
      minOccurs="0" maxOccurs="unbounded"/>
      <xsd:element name="resource-env-ref"
      type="gernaming:local-refType"
      minOccurs="0" maxOccurs="unbounded"/>
      </xsd:sequence>
      </xsd:group>

      (types for remote and local-ref ommitted)

      </xsd:schema>

      that is imported into another schema

      <xs:import namespace="http://geronimo.apache.org/xml/ns/naming"
      schemaLocation="../../../naming/src/schema/geronimo-naming.xsd"/>

      and referenced like this:

      <xs:complexType name="application-clientType">
      <xs:sequence>
      (some elements ommitted)
      <xs:group ref="naming:jndiEnvironmentRefsGroup"/>
      (more elements ommitted)
      </xs:sequence>
      </xs:complexType>

      I compile types for the geronimo-naming schema separately.
      -----------------------------------

      I can compile the types for the referencing application-client schema
      in two ways, with and without the precompiled geronimo-naming schema
      classes on the classpath.

      If I compile without the separately compiled classes, xmlbeans
      generates additional copies of these classes that behave as I expect,
      namely the resulting document fragments look like this:

      <xml-fragment parentId="parentId" configId="configId"
      xmlns:nam="http://geronimo.apache.org/xml/ns/naming">
      <nam:resource-ref>
      <nam:ref-name>ref</nam:ref-name>
      <nam:target-name>target</nam:target-name>
      </nam:resource-ref>
      </xml-fragment>

      Note that as expected thhe resource-ref element is in the nam namespace.

      However, if I include the precompiled schema classes on the classpath
      when generating xmlbeans code, I get the following fragments:

      <xml-fragment parentId="parentId" configId="configId"
      xmlns:nam="http://geronimo.apache.org/xml/ns/naming">
      <resource-ref>
      <nam:ref-name>ref</nam:ref-name>
      <nam:target-name>target</nam:target-name>
      </resource-ref>
      </xml-fragment>

      Note that resource-ref is in no namespace.

      Can anyone explain this? Is there any way to get the "with-namespace"
      behavior using the separately compiled classes?

      I'm using xbean-1.0-DEV from the ibiblio maven repository.

        Attachments

          Activity

            People

            • Assignee:
              radup Radu Preotiuc
              Reporter:
              radup Radu Preotiuc
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: