Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » Proper way to get the default value for an attribute
Proper way to get the default value for an attribute [message #602630] Fri, 28 September 2007 14:27
Richard Gregory is currently offline Richard GregoryFriend
Messages: 13
Registered: July 2009
Junior Member
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
Previous Topic:idrefs and holders
Next Topic:Proper way to get the default value for an attribute
Goto Forum:
  


Current Time: Mon Nov 24 01:38:51 GMT 2014

Powered by FUDForum. Page generated in 0.01597 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software