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

Namespaces in QName is not preserved after copy of the XMLBeans from one tree to anoter.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • Version 2.1
    • None
    • None
    • None

    Description

      I parse a schema file to XMLBeans, the schema defines the "impl" namespace. I then parse another document, which is also a schema file that uses "impl" namespace but is set to a different namespace than the orignial schema.

      WHen I copy the XMLObjects from one schema to the other, the QNames of the schema objects are not updated to reflect the new namespaces.

      I have attached a simple program to reproduce the problem. Notice that the Person element in the "s2" uses <xsd:element name=\"addr\" type=\"impl:Address\"/> after it is copied to the "s1" i expect the "impl" be changed to "tns1" but it remains "impl" which is not the correct namespace in the target schema.

      The output of my attached code is:

      After add the schema: <xsd:schema elementFormDefault="qualified" targetNamespace="http://byXmlBeanNS" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://web" xmlns:intf="http://web" xmlns:tns1="http://byXmlBeanNS" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <xsd:element name="Person">
      <xsd:complexType>
      <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
      <xsd:element name="addr" type="impl:Address"/> <---------------------
      </xsd:sequence>
      </xsd:complexType>
      </xsd:element>
      </xsd:schema>

      But I expected

      After add the schema: <xsd:schema elementFormDefault="qualified" targetNamespace="http://byXmlBeanNS" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://web" xmlns:intf="http://web" xmlns:tns1="http://byXmlBeanNS" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <xsd:element name="Person">
      <xsd:complexType>
      <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
      <xsd:element name="addr" type="tns1:Address"/> <------------------
      </xsd:sequence>
      </xsd:complexType>
      </xsd:element>
      </xsd:schema>

      Attachments

        1. CopyTest.java
          2 kB
          daryoush mehrtash

        Activity

          People

            Unassigned Unassigned
            dmehrtash daryoush mehrtash
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: