What is simple type XML Schema element
Posted in
XML | DTD July 06, 2019
This article describe about simple type XML Schema element
Simple type XML Schema Element
All XML Schema describe the element of XML files. Simple type XML Schema element contain only text. But text can be several type. it does not contain event attributes or Element
Defining a simple element
<xs:element name="pqr" type="xyz"/>
|
Here above declared code "pqr" is the name of element and "xyz" is the data type of element.
There are following type of data type has the XML Schema
- xs:string
- xs:decimal
- xs:date
- xs:interger
- xs:time
- xs:boolean
Example
<name>satya prakash</name>
<age>23</age>
<salary>4000</salary> |
Note: Corresponding the above declared Example create simple element
<xs:element name="name" type="xs:string" />
<xs:element name="age" type="xs:unsignedByte"/>
<xs:element name="salary" type="xs:unsignedShort"/>
|
Note: This is example of simple element
Default and Fixed Values for Simple Elements
When we create simple element and does not define any fixed value then it by default assign default value and we can also define fixed value. Means simple support both default and fixed value.
<xs:element name="color" type="xs:string" default="Green"/> |
Note: In the above example default value "Green" automatically assign
<xs:element name="color" type="xs:string" fixed="Green"/> |
Note: In this example fixed value "Green" assign
Further Readings
You may also want to read these related articles :
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here