You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by "zoheb patankar (JIRA)" <xm...@xml.apache.org> on 2009/11/23 14:59:40 UTC

[jira] Created: (XMLBEANS-424) XMLBeans fail to honour elements which has default attribute value as well as mandatory in schema.

XMLBeans fail to honour elements which has default attribute value as well as mandatory in schema.
--------------------------------------------------------------------------------------------------

                 Key: XMLBEANS-424
                 URL: https://issues.apache.org/jira/browse/XMLBEANS-424
             Project: XMLBeans
          Issue Type: Bug
          Components: XmlObject
    Affects Versions: Version 2
         Environment: Windows XP,Sun solaris 2.5.1, Weblogic 9.2
            Reporter: zoheb patankar


Hi,

Consider following schema example :-

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/" xmlns:tns="http://www.example.org/">
<complexType name="Employee">
<sequence>
	<element name="name" type="string"/>
	<element name="country" type="string" default="India"/>
</sequence>
</complexType>
<element name="emp" type="tns:Employee"/> 
</schema>

>From above schema i generated schema type jar and populated XMLBean object "EmpDocument" setting only the name property of it.
The resultant xml that i got from above contains only name element as given below:-

<emp xmlns="http://www.example.org/">
  <name>zoheb</name>
</emp>

As can be seen from generated xml it only contains "name" element skipping the"country"
element. 
Although i did not set the country element but xmlbean parser should honour the default attribute value defined for the country element in schema instead it skips the element if code doesnt sets it .

Same is the issue other way around as well i.e XML to XMLObject.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (XMLBEANS-424) XMLBeans fail to honour elements which has default attribute value as well as mandatory in schema.

Posted by "zoheb patankar (JIRA)" <xm...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XMLBEANS-424?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

zoheb patankar updated XMLBEANS-424:
------------------------------------

    Description: 
Hi,

Consider following schema example :-

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/" xmlns:tns="http://www.example.org/">
<complexType name="Employee">
<sequence>
	<element name="name" type="string"/>
	<element name="country" type="string" default="India"/>
</sequence>
</complexType>
<element name="emp" type="tns:Employee"/> 
</schema>

>From above schema i generated schema type jar and populated XMLBean object "EmpDocument" setting only the name property of it.
The resultant xml that i got from above object contains only name element as given below:-

<emp xmlns="http://www.example.org/">
  <name>zoheb</name>
</emp>

As can be seen from generated xml it only contains "name" element skipping the"country"
element. 
Although i did not set the country element but xmlbean parser should honour the default attribute value defined for the country element in schema instead it skips the element if code doesnt sets it .

Same is the issue other way around as well i.e XML to XMLObject.



  was:
Hi,

Consider following schema example :-

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/" xmlns:tns="http://www.example.org/">
<complexType name="Employee">
<sequence>
	<element name="name" type="string"/>
	<element name="country" type="string" default="India"/>
</sequence>
</complexType>
<element name="emp" type="tns:Employee"/> 
</schema>

>From above schema i generated schema type jar and populated XMLBean object "EmpDocument" setting only the name property of it.
The resultant xml that i got from above contains only name element as given below:-

<emp xmlns="http://www.example.org/">
  <name>zoheb</name>
</emp>

As can be seen from generated xml it only contains "name" element skipping the"country"
element. 
Although i did not set the country element but xmlbean parser should honour the default attribute value defined for the country element in schema instead it skips the element if code doesnt sets it .

Same is the issue other way around as well i.e XML to XMLObject.




> XMLBeans fail to honour elements which has default attribute value as well as mandatory in schema.
> --------------------------------------------------------------------------------------------------
>
>                 Key: XMLBEANS-424
>                 URL: https://issues.apache.org/jira/browse/XMLBEANS-424
>             Project: XMLBeans
>          Issue Type: Bug
>          Components: XmlObject
>    Affects Versions: Version 2
>         Environment: Windows XP,Sun solaris 2.5.1, Weblogic 9.2
>            Reporter: zoheb patankar
>
> Hi,
> Consider following schema example :-
> <?xml version="1.0" encoding="UTF-8"?>
> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/" xmlns:tns="http://www.example.org/">
> <complexType name="Employee">
> <sequence>
> 	<element name="name" type="string"/>
> 	<element name="country" type="string" default="India"/>
> </sequence>
> </complexType>
> <element name="emp" type="tns:Employee"/> 
> </schema>
> From above schema i generated schema type jar and populated XMLBean object "EmpDocument" setting only the name property of it.
> The resultant xml that i got from above object contains only name element as given below:-
> <emp xmlns="http://www.example.org/">
>   <name>zoheb</name>
> </emp>
> As can be seen from generated xml it only contains "name" element skipping the"country"
> element. 
> Although i did not set the country element but xmlbean parser should honour the default attribute value defined for the country element in schema instead it skips the element if code doesnt sets it .
> Same is the issue other way around as well i.e XML to XMLObject.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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