|
Hi Artem Ah – so it’s not that the
attribute has a empty value (i.e. <def:Section … method=””
>) - rather that the attribute is missing altogether. In that case I think
what you are seeing is the expected behavior. If you fail to set an attribute
but that attribute has a default value then for infoset validation purposes
that attribute is present (see http://www.w3.org/TR/xmlschema-1/#sic-attrDefault)
and hence if you call getMethod() you will get back the default value even
though the attribute is not present. If you explicitly want it to be present
you can simply call setMethod() – after that the attribute (and its
value) will show up in the output XML. If you simply want to check whether it
is actually present or not you can use the isSetMethod() method. Cheers, From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 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] Hi Artem Can you send the code you are using to
create your document please? Cheers, From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 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. _______________________________________________________________________ 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. |
- Default attribute value and serialization Artem_Portnoy
- RE: Default attribute value and serialization Lawrence Jones
- RE: Default attribute value and serialization Artem_Portnoy
- RE: Default attribute value and serialization Lawrence Jones
- RE: Default attribute value and serialization Artem_Portnoy
- RE: Default attribute value and serialization Lawrence Jones
- RE: Default attribute value and serialization Artem_Portnoy

