You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by Fady Moussallam <fa...@legsem.com> on 2007/06/05 15:35:43 UTC

[XmlSchema] issue with annotations: markup attributes and elements are not processed by XmlSchemaSerializer

Hi,

 

It seems there is a bug in XmlSchemaSerializer from version 1.3.1 when
dealing with appInfo annotations which markup contains attributes and
sub-elements.

 

Instead of getting a serialized XML fragment like so:

 

<xs:annotation>

   <xs:appinfo>

      <jaxb:globalBindings generateIsSetMethod="true"/>

      <jaxb:schemaBindings>

          <jaxb:package  name="com.legstar.test.coxb.lsfileal"/>

      </jaxb:schemaBindings>

    </xs:appinfo>

</xs:annotation>

 

I am getting this:

 

<xs:annotation>

   <xs:appinfo>

      <jaxb:globalBindings/>

      <jaxb:schemaBindings/>

    </xs:appinfo>

</xs:annotation>

 

As you can see, attributes and inner-elements are not processed.

 

I traced back the issue to appendElement method where the following code:

 

        parent.appendChild(el);

        NamedNodeMap attributes = el.getAttributes();

        //check if child node has attribute  

        //create new element and append it if found

        int attributeLength = attributes.getLength();

        for (int i = 0; i < attributeLength; i++) {

            Node n = attributes.item(i);

            //assuming attributes got to throw exception if not later

            el.setAttribute(n.getNodeName(),

                    n.getNodeValue());

        }

 

        //check any descendant of this node

        //if there then append its child

        NodeList decendants = el.getChildNodes();

        int decendantLength = decendants.getLength();

 

should probably read like this:

 

        parent.appendChild(el);

        NamedNodeMap attributes = elTmp.getAttributes();

        //check if child node has attribute  

        //create new element and append it if found

        int attributeLength = attributes.getLength();

        for (int i = 0; i < attributeLength; i++) {

            Node n = attributes.item(i);

            //assuming attributes got to throw exception if not later

            el.setAttribute(n.getNodeName(),

                    n.getNodeValue());

        }

 

        //check any descendant of this node

        //if there then append its child

        NodeList decendants = elTmp.getChildNodes();

        int decendantLength = decendants.getLength();

 

Can anyone confirm if this is a known issue and how to get it fixed?

 

Thanks.

 

Fady

 

 

 


Re: [XmlSchema] issue with annotations: markup attributes and elements are not processed by XmlSchemaSerializer

Posted by Davanum Srinivas <da...@gmail.com>.
Fady,

Looks like it was marked as fixed. But another user has complained
that it is still not fixed. Can you please do me a favor and upload
our schema to the JIRA below:
https://issues.apache.org/jira/browse/WSCOMMONS-153

i'll reopen the bug.

thanks,
dims

On 6/5/07, Fady Moussallam <fa...@legsem.com> wrote:
> Hi,
>
>
>
> It seems there is a bug in XmlSchemaSerializer from version 1.3.1 when
> dealing with appInfo annotations which markup contains attributes and
> sub-elements.
>
>
>
> Instead of getting a serialized XML fragment like so:
>
>
>
> <xs:annotation>
>
>    <xs:appinfo>
>
>       <jaxb:globalBindings generateIsSetMethod="true"/>
>
>       <jaxb:schemaBindings>
>
>           <jaxb:package  name="com.legstar.test.coxb.lsfileal"/>
>
>       </jaxb:schemaBindings>
>
>     </xs:appinfo>
>
> </xs:annotation>
>
>
>
> I am getting this:
>
>
>
> <xs:annotation>
>
>    <xs:appinfo>
>
>       <jaxb:globalBindings/>
>
>       <jaxb:schemaBindings/>
>
>     </xs:appinfo>
>
> </xs:annotation>
>
>
>
> As you can see, attributes and inner-elements are not processed.
>
>
>
> I traced back the issue to appendElement method where the following code:
>
>
>
>         parent.appendChild(el);
>
>         NamedNodeMap attributes = el.getAttributes();
>
>         //check if child node has attribute
>
>         //create new element and append it if found
>
>         int attributeLength = attributes.getLength();
>
>         for (int i = 0; i < attributeLength; i++) {
>
>             Node n = attributes.item(i);
>
>             //assuming attributes got to throw exception if not later
>
>             el.setAttribute(n.getNodeName(),
>
>                     n.getNodeValue());
>
>         }
>
>
>
>         //check any descendant of this node
>
>         //if there then append its child
>
>         NodeList decendants = el.getChildNodes();
>
>         int decendantLength = decendants.getLength();
>
>
>
> should probably read like this:
>
>
>
>         parent.appendChild(el);
>
>         NamedNodeMap attributes = elTmp.getAttributes();
>
>         //check if child node has attribute
>
>         //create new element and append it if found
>
>         int attributeLength = attributes.getLength();
>
>         for (int i = 0; i < attributeLength; i++) {
>
>             Node n = attributes.item(i);
>
>             //assuming attributes got to throw exception if not later
>
>             el.setAttribute(n.getNodeName(),
>
>                     n.getNodeValue());
>
>         }
>
>
>
>         //check any descendant of this node
>
>         //if there then append its child
>
>         NodeList decendants = elTmp.getChildNodes();
>
>         int decendantLength = decendants.getLength();
>
>
>
> Can anyone confirm if this is a known issue and how to get it fixed?
>
>
>
> Thanks.
>
>
>
> Fady
>
>
>
>
>
>
>
>


-- 
Davanum Srinivas :: http://davanum.wordpress.com

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org