You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Dirk Lattermann (JIRA)" <ji...@apache.org> on 2011/08/11 11:22:27 UTC

[jira] [Created] (CXF-3732) xjc generates no JAXBElement for nillable element with required attribute

xjc generates no JAXBElement for nillable element with required attribute 
--------------------------------------------------------------------------

                 Key: CXF-3732
                 URL: https://issues.apache.org/jira/browse/CXF-3732
             Project: CXF
          Issue Type: Bug
          Components: JAXB Databinding
    Affects Versions: 2.3.4
            Reporter: Dirk Lattermann


Please consider the following schema:

{quote}
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.example.org" targetNamespace="http://www.example.org" elementFormDefault="qualified">
  <xsd:element name="root">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="eal" nillable="true">
          <xsd:complexType>
            <xsd:simpleContent>
              <xsd:extension base="xsd:string">
                <xsd:attribute name="att" type="xsd:string" use="required"/>
              </xsd:extension>
            </xsd:simpleContent>
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
{quote}

Running this through xjc generates a member {{eal}} of type {{Root.Eal}} in {{Root}}, not of type {{JAXBElement<Root.Eal>}}.
This makes it impossible to unmarshal a document like

{quote}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root xmlns="http://www.example.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <eal att="j" xsi:nil="true"/>
</root>
{quote}

and obtain the value for attribute {{att}} in {{eal}}, since {{eal}} is null. The above XML document cannot be represented in the classes generated by xjc.


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (CXF-3732) xjc generates no JAXBElement for nillable element with required attribute

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3732?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-3732.
------------------------------

       Resolution: Won't Fix
    Fix Version/s: Invalid
         Assignee: Daniel Kulp


This is not a CXF bug but is a JAXB bug.  I've gone ahead and logged an issue with them:

http://java.net/jira/browse/JAXB-858



> xjc generates no JAXBElement for nillable element with required attribute 
> --------------------------------------------------------------------------
>
>                 Key: CXF-3732
>                 URL: https://issues.apache.org/jira/browse/CXF-3732
>             Project: CXF
>          Issue Type: Bug
>          Components: JAXB Databinding
>    Affects Versions: 2.3.4
>            Reporter: Dirk Lattermann
>            Assignee: Daniel Kulp
>             Fix For: Invalid
>
>
> Please consider the following schema:
> {quote}
> <?xml version="1.0" encoding="UTF-8" ?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.example.org" targetNamespace="http://www.example.org" elementFormDefault="qualified">
>   <xsd:element name="root">
>     <xsd:complexType>
>       <xsd:sequence>
>         <xsd:element name="eal" nillable="true">
>           <xsd:complexType>
>             <xsd:simpleContent>
>               <xsd:extension base="xsd:string">
>                 <xsd:attribute name="att" type="xsd:string" use="required"/>
>               </xsd:extension>
>             </xsd:simpleContent>
>           </xsd:complexType>
>         </xsd:element>
>       </xsd:sequence>
>     </xsd:complexType>
>   </xsd:element>
> {quote}
> Running this through xjc generates a member {{eal}} of type {{Root.Eal}} in {{Root}}, not of type {{JAXBElement<Root.Eal>}}.
> This makes it impossible to unmarshal a document like
> {quote}
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <root xmlns="http://www.example.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>     <eal att="j" xsi:nil="true"/>
> </root>
> {quote}
> and obtain the value for attribute {{att}} in {{eal}}, since {{eal}} is null. The above XML document cannot be represented in the classes generated by xjc.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira