Total members 11890 |It is currently Fri Apr 19, 2024 11:18 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





- XSD simple element :
XSD simple element is the element that don't include any other elements.It can be one of many different types and they are :
xs:string
xs:decimal
xs:integer
xs:boolean
xs:date
xs:time

How to define simple element :

Code:
<xs:element name="studentname" type="string"/>


The name attribute defines the name of the element (which is here "studentname" ), and the type attribute defines the element data type (which is "string" here). The type "string" is a built-in data type from the XML Schema standard. It represents character strings, including letters, digits, and other characters. This element can be added to an XML document, and it can only contain a string value. It's important to notice that if you want to apply any restriction, such as length, or white space handling, you should define the type as a simpleType and include the restriction within it.

Example of XML to this element definition :
Code:
<studentname>
jozeph
</studentname>


Element default values :
You can define a default value for the simple element using the "default" attribute.


Code:
<xs:element name="studentname" type="string"   default="no name"/>

The default value is assigned automatically when you don't put a value. This XSD code defines an element called "studentname" with a specific data type of "string" and with a default value "no name". This means that if the element is not present in the XML document, it will be assumed to have the value "no name" by default.

Code:
<xs:element name="studentname" type="string"   fixed="samy"/>

Automatic value assignment to the element with a value you can't change later.

This XSD code defines an element called "studentname" with a specific data type of "string" and with a fixed value "samy". This means that the element must always have the value "samy" in the corresponding XML document, and a user or application cannot change it. If a different value is provided for the element, it will be considered as an error. It is different from the previous XSD code <xs:element name="studentname" type="string" default="no name"/>, in which the element is optional, and it has a default value "no name".



_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : lesson2 : XSD simple element
 Usage of big element tag.     -  
 Pop the element off the end of array     -  
 lesson1 : <schema> Element     -  
 access element in array C++     -  
 print element in 2d matrix     -  
 UnSet array element     -  
 Array element navigation     -  
 Change and get html content of element     -  
 opacity of HTML element- transparent     -  
 Get the position of HTML element using JQuery     -  



Topic Tags

XSD Elements
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com