It is possible to restrict the values of an element in the XSD, using some specific restriction tags.
Below is a code snippet, which provides an example of how to restrict an attribute value in the xsd. This will lead to restrict the client application from setting up any other values to the restricted attribute.
<? xml version="1.0" encoding="UTF-8"?>
< xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://example.org/prod" elementFormDefault="qualified" targetNamespace="http://example.org/prod">
<xs:element name="transaction" type="TransactionType"/>
<xs:element fixed="10" name="size" type="xs:integer"/>
<xs:complexType name="TransactionType">
<xs:sequence>
<xs:element name="name">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:enumeration value="type1"/>
<xs:enumeration value="type2"/>
<xs:enumeration value="type3"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element minOccurs="0" ref="size"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
If you need any urgent assistance on XSD_Schema_Restriction_for_Simple_Complex_Types, kindly email your requirement to us at : info@javagenious.com or Contact-an-Expert. Our experts will try their best to solve your problem.
You can also subscribe to our newsletters on XSD_Schema_Restriction_for_Simple_Complex_Types, to receive updates on XSD_Schema_Restriction_for_Simple_Complex_Types,via email.Enter you email below:
Keyword Tags: XSD_Schema_Restriction_for_Simple_Complex_Types tutorial,XSD_Schema_Restriction_for_Simple_Complex_Types in java,Concepts of XSD_Schema_Restriction_for_Simple_Complex_Types,Java,J2EE,Interview Questions,XSD_Schema_Restriction_for_Simple_Complex_Types Examples
-
Java Exception Handling,Try Catch block in Java, Tutorials for Exception handling in Java
-
Java Interview Questions And Answers For Freshers Pdf : Free Download
-
XSD to XML,XML TO XSD, Auto Generate XML using XSD Schema using Eclipse IDE
-
IBM BPM Lombardi Tutorial
-
Java Arrays,Arrays in Java, Tutorials for Arrays in Java
-
Hello World Ajax tutorial, Ajax Hello World tutorial, Source code Ajax, Ajax Java JSP Tutorial
-
How to read, write a XML Document using Java API for XML Parsing ( JAXP) | JAXP Tutorials
-
Lifecycle Callbacks for Stateless Session Beans
-
A very Simple Hello World Program in Java
-
Java interview questions - Freshers & Experienced
-
XSLT Tutorial, XML Tutorial, XSD Tutorial
-
Difference between XSD and XSLT.
-
Schematron: What is Schematron & how it is used ?
-
Best PHP Captcha which is FREE and Easy to Use | Open Source PHP Captcha | Free Online Captcha as a
-
Hibernate Cascade Tutorial : What is delete, update,save in Hibernate?
|