cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Difference between element and attributes while creating data types

Former Member
0 Likes
6,348

Hi Gurus,

Please provide me the difference between element and attribute.

It would be great,if I can get some example with exact usage.

Regards,

MohanRaj

View Entire Topic
Former Member
0 Likes

Hi Mohan,

Elements and Attributes

You create complex data types using elements and attributes in the XSD editor:

Node Type

Use

Example Instance

Element

Create structured data types. Elements that have a type cannot contain subelements.

<myElem>

<f1> Value of f1 </f1>

<f2> Value of f2 </f2>

</myElem>

Attribute

Add attributes to elements. Attributes cannot usually have subnodes.

<myElem myAttr="AttributeValue">

Element Value

</myElem>

You can flag an attribute as optional or required in the Occurrence column. These values mean the same for elements with an occurrence of 0..1 or 1. The only difference between elements and attributes is that attributes cannot have subnodes and that the same attribute cannot be used more than once in an element.

Regards,

Phani

Reward points if Helpful