Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Attribute Declarations

 
Nagendra Inuguri
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following declaration of the attribute is under a complexType:

<xsd:attribute name="country" type="xsd:NMTOKEN" use="fixed" value="US"/>

Is this a valid declaration? I have got this snippet from xyzws mock exam and the answer says this is a valid attribute declaration. But I understand that use attribute can have only following values: optional | required | prohibited. I suppose fixed is another attribute of xsd:attribute element which is used to give the attribute being declared a fixed value. And also there is no attribute called value for xsd:attribute element.

I am confused here. Can some one explain me how this is a valid attribute declaration ? I appreciate any links that gives some good examples about attribute declarations.

I have another question. Are Applets part of J2EE specification ?

Thanks,
Nagendra
 
Karthik Rajendiran
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Attributes declaration
xsd:attribute Tags has the following arguments(i.e attibutes for this "xsd:attribute " tag)

For Ex
xsd:attribute name="test" type="string"
use="required|optional|fixed|default|prohibited"

Valid values for use attribute are required|optional|fixed|default|prohibited

If we use required or fixed or default, the value should be given

Unless it is specified in the shchema that element should have attribute, the occurence of attribute is optional(i.e if it is specified required ,then attribute should be specified for the element)

EXAMPLE
<XSD:ATTRIBUTE NAME="COUNTRY" TYPE="XSD:NMTOKEN" USE="FIXED" VALUE="US"/>

1. Appearance of the country attribute is optional
2. Its value must be US if it appears
3. If it doesnot appear the parser creates an attribute with name country and assign value to it as US

Hope you are clear with the explanations
 
Nagendra Inuguri
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I read in a book that fixed and default are themselves as attributes rather than options for use attribute. (OReilly's XML in a Nutshell). Then, are we talking about different versions?

Thanks,
Nagendra
 
Karthik Rajendiran
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friend,
I am sorry, As you said it was mentioned in w3c schools too.
But in www.javapassion.com, i read in one pdf like default and fixed are values of use

BUT IF WE SEE W3C.. what you said is very much rite..I think simulator exam might be wrong...

Refer this
http://www.w3schools.com/schema/el_attribute.asp
 
Nagendra Inuguri
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. Thanks any way. Do you know whether Applets are part of J2EE specification ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic