[ 
http://issues.apache.org/jira/browse/XMLBEANS-178?page=comments#action_12375575 
] 

Christoph Kutzinski commented on XMLBEANS-178:
----------------------------------------------

I'm experiencing a problem probably cause by this.
I have two schemas with different namespaces e.g.

Schema A:
<xs:schema
  xmlns:myname="http://www.example.com/myname";
  targetNamespace="http://www.example.com/myname";
  elementFormDefault="qualified" attributeFormDefault="unqualified"
  >
  <xs:complexType name="typeA">
    <xs:extension base="abstractTypeA" />
  </xs:complexType>
</xs:schema>

Schema B:
<xs:schema
  xmlns:myname="http://www.example.com/basic/myname";                       <= 
Note the "basic"
  targetNamespace="http://www.example.com/basic/myname";
  elementFormDefault="qualified" attributeFormDefault="unqualified"
  >
  <xs:complexType name="typeB">
    <xs:extension base="abstractTypeB" />
  </xs:complexType>
</xs:schema>

With this schemas XMLBeans will generate XML files which look like these:
<element xmlns:myname="http://www.example.com/myname"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
  <abstractTypeA xsi:type="myname:typeA" />
  <abstractTypeB xsi:type="myname:typeB" />
</element>

I.e. both namespaces are mapped to the same prefix and the second namespace is 
missing from the list of the namespaces!


> Better control of namespace prefixes used
> -----------------------------------------
>
>          Key: XMLBEANS-178
>          URL: http://issues.apache.org/jira/browse/XMLBEANS-178
>      Project: XMLBeans
>         Type: Improvement

>   Components: Cursor
>     Reporter: Radu Preotiuc-Pietro
>      Fix For: TBD

>
> There have been a number of messages asking for a better control of namespace 
> declarations inserted by XmlBeans when saving documents, than offered by 
> XmlOptions.setSaveSuggestedPrefixes().
> One issue is the use of xsi:type: when XmlBeans needs to insert an xsi:type 
> attribute it needs to pick a prefix for the value of xsi:type and at that 
> point the setSaveSuggestedPrefixes() are not available. Once the prefix is 
> part of the attribute value, it can no longer be changed (unless directly by 
> user) so the prefix declaration will end up in the final document, which may 
> be undesireable.
> One other thing that was suggested was to pick the default prefix more  
> intelligently, for example use the prefix used in the Schema to declare 
> components in that namespace, but that's trickier to do (you can declare 
> QNames without using prefixes) and also involves changes in the binary format.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to