Cannot handle QNames in attribute values correctly
--------------------------------------------------

         Key: XMLBEANS-210
         URL: http://issues.apache.org/jira/browse/XMLBEANS-210
     Project: XMLBeans
        Type: Bug
  Components: XmlObject  
 Environment: XMLBeans 2.0.0
    Reporter: Masahiro Kurosawa


I compiled a XSD file into XMLBeans like this:

- - -
<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"; 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
    xmlns:wsrf-sg="http://docs.oasis-open.org/wsrf/sg-2";
    elementFormDefault="qualified" attributeFormDefault="unqualified" 
    targetNamespace="http://docs.oasis-open.org/wsrf/sg-2";>

    <xsd:simpleType name="ContentElementsType">
        <xsd:list itemType="xsd:QName"/>
    </xsd:simpleType>
    <xsd:element name="MembershipContentRule">
        <xsd:complexType>
            <xsd:attribute name="ContentElements" 
                type="wsrf-sg:ContentElementsType" use="required"/>
        </xsd:complexType>
    </xsd:element>

</xsd:schema>
- - -
(This is a quotation from WS-ServiceGroup spec:
http://docs.oasis-open.org/wsrf/wsrf-ws_service_group-1.2-spec-pr-01.pdf)

and use compiled XMLBeans classes like this:

- - -
// Values of 'ContentElements' attribute of 'MembershipContentRule' element
XmlQName qname1 = XmlQName.Factory.newInstance();
XmlQName qname2 = XmlQName.Factory.newInstance();
qname1.setQNameValue( QName.valueOf( "{http://www.bizgrid.org}first"; ) );
qname2.setQNameValue( QName.valueOf( "{http://www.bizgrid.org}second"; ) );
ArrayList contentElements = new ArrayList();
contentElements.add( qname1 );
contentElements.add( qname2 );

// Construct a 'MembershipContentRule' element
MembershipContentRuleDocument membershipContentRuleDocument =
  MembershipContentRuleDocument.Factory.newInstance();
MembershipContentRuleDocument.MembershipContentRule membershipContentRule =
  membershipContentRuleDocument.addNewMembershipContentRule();
                
// Set values of attributes created above
membershipContentRule.setContentElements( contentElements );

// Output the XML text of 'MembershipContentRule' element to console 
System.out.println( membershipContentRuleDocument.xmlText() );
- - -

Result of last line is:

- - -
<wsrf:MembershipContentRule
  ContentElements="biz:first biz:second" 
    xmlns:wsrf="http://docs.oasis-open.org/wsrf/sgw-1"/>
- - -

Values of 'ContentElements' attribute of 'MembershipContentRule' element seem 
be just a set of return value of XmlQName.xmlText() method without 
consideration of collision of prefixes and namespace URIs seem be lost.

-- 
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