Proper way to get the default value for an attribute [message #602630] |
Fri, 28 September 2007 14:27 |
Eclipse User |
|
|
|
Hi,
I have this code to get the default value that works fine for an
XSDElementDeclaration:
XSDElementDeclaration.getLexicalValue();
However, when I call get XSDAttributeDeclaration.getLexicalValue(), it
always returns null, for example with this XSD:
<xsd:complexType name="HasDefault">
<xsd:sequence>
<xsd:element minOccurs="0" name="field1" type="xsd:string"
default="some default value" />
</xsd:sequence>
<xsd:attribute name="attr" type="xsd:int" default="123"/>
</xsd:complexType>
I see from introspecting the XSDAttributeDeclaration at runtime that the
default value is in XSDAttributeDeclaration.eContainer.lexicalValue and
in .value, where eContainer is an XSDAttributeUse.
So I can write code to get it from there, but is that the right way? I
would expect a more direct way.
Thanks,
Rich
|
|
|
Powered by
FUDForum. Page generated in 0.03239 seconds