[ 
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-unsubscr...@xmlbeans.apache.org
For additional commands, e-mail: dev-h...@xmlbeans.apache.org

Reply via email to