Total members 11895 |It is currently Tue Dec 03, 2024 5:47 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





XSD Complex Text-Only Elements:
If your Complex type have only text and attributes .In this case you use SimpleContent tag. You must use extension OR a restriction within the simpleContent element.

Code:
<xs:element name="ID">
  <xs:complexType>
    <xs:simpleContent>
      <xs:extension base="xs:integer">
        <xs:attribute name=" nationality" type="xs:string" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
</xs:element>


This is an example of an XSD document that defines the structure of an XML element called "ID". The "xs:element" element is used to define an element in the XML document and the "name" attribute specifies the name of the element. The "xs:complexType" element is used to define the type of the "ID" element. Inside the complexType, an "xs:simpleContent" element is defined, which is used to hold the actual value of the "ID" element. The "xs:extension" element is used to define an extension of a simple type. The "base" attribute specifies the base type, in this case, "xs:integer", which means the ID element is an integer. The "xs:attribute" element is used to define an attribute for the "ID" element, in this case, "nationality" with the data type "xs:string". So this XSD defines an "ID" element with a base type of integer and an attribute called "nationality" of type string. The "ID" element can contain an integer value and also a "nationality" attribute that contains a string value. This can be useful in case you want to include additional information about the ID, like the nationality of the person the ID belongs to.

In addition to what I've mentioned before, it's also worth noting that the "xs:extension" element allows you to add additional information to a simple type, in this case, the integer ID, by adding a new attribute. This can be useful when you need to add extra information to an element, such as a label or an identifier, without changing the underlying data type of the element. This XSD document ensures that the XML document adheres to the structure defined in it and that the data contained in the "ID" element is of the correct data type. This can be useful for ensuring data integrity and consistency when exchanging information between systems.



XML example:
Code:
<ID nationality="Egyptian" >32</ID>


This is an example of an XML document conforming to the structure defined by the earlier XSD document. The "ID" element is the root element, and it contains an attribute called "nationality" with the value "Egyptian" and also a text node with the value "32", which represents the ID number. The "nationality" attribute provides additional information about the "ID" element, which tells us that the ID belongs to an Egyptian person. The text node "32" is the value of the ID element, and it should be an integer as defined in the base attribute of the xs:extension element in the XSD document. This XML document provides specific information about an ID, such as the person's nationality and the ID's value. It adheres to the structure and data types defined in the XSD document, ensuring that the information is organized and consistent.



_________________
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 : lesson7: XSD Complex Text-Only Elements
 lesson5: XSD Complex elements     -  
 lesson6: XSD Complex Empty Elements     -  
 Complex Numbers     -  
 Complex numbers calculator (C++)     -  
 Able to Copy Text from Uneditable Text Boxes(JTextfields)     -  
 lesson9: XSD Complex Types Indicators     -  
 solve the complex numbers and do operations on it     -  
 lesson8: XSD Complex Type Mixed Content     -  
 Java- Copy text area into disabled text area     -  
 Add elements to the end of an array     -  



Topic Tags

XSD Elements






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