Uploaded image for project: 'XMLBeans'
  1. XMLBeans
  2. XMLBEANS-424

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • Version 2
    • None
    • XmlObject
    • None
    • Windows XP,Sun solaris 2.5.1, Weblogic 9.2

    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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            zoheb zoheb patankar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: