Here’s a shortened version of the code.  I left out everything that didn’t have to do with the attribute in question.

 

    ConsolePageDocument doc = ConsolePageDocument.Factory.newInstance();

    ConsolePage consolePage = doc.addNewConsolePage();

    Right right = consolePage.addNewRight();

    SectionType section = right.addNewSection();

    section.setName("S/MIME Provider Settings");

    section.setHelp("Settings to enable the use of Secure Multipurpose Internet Mail Extensions");

    section.setStyle(SectionType.Style.FIELDSET);

    section.setForm("setSMIME");

    HTTPMethod.Enum m = section.getMethod(); // getting back HTTPMethod.POST

 

    // serialize document

    ByteArrayOutputStream result = new ByteArrayOutputStream();

    doc.save(result);

 

Here is what the Section node looks like when serialized…

 

<def:Section name="S/MIME Provider Settings" help="Settings to enable the use of Secure Multipurpose Internet Mail Extensions" style="fieldset" form="setSMIME">

 

Thanks,

 

Artem

 


From: Lawrence Jones [mailto:[EMAIL PROTECTED]
Sent: Friday, March 03, 2006 12:57 PM
To: [email protected]
Subject: RE: Default attribute value and serialization

 

Hi Artem

 

Can you send the code you are using to create your document please?

 

Cheers,

 

Lawrence

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, March 03, 2006 9:14 AM
To: [email protected]
Subject: Default attribute value and serialization

 

Hi,

 

There appears to be a problem in XMLBeans with handling of default values for attributes.  I have an attribute in my schema that has a type of enumeration and also has a default value

 

             <xs:attribute name="method" type="com:HTTPMethod" default="POST"/>

 

       <xs:simpleType name="HTTPMethod">

             <xs:restriction base="xs:string">

                    <xs:enumeration value="GET"/>

                    <xs:enumeration value="POST"/>

             </xs:restriction>

       </xs:simpleType>

 

When I create my document using XMLBeans and serialize it via save(OutputStream), I end up with the method attribute having an empty value.  However, if I make a call to getMethod(), I’m getting the expected default value.  What am I doing wrong?

 

Thank you,

 

Artem

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

Reply via email to