Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » 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: Thu Apr 25 04:45:36 GMT 2024

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

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

Back to the top