Total members 11621 |It is currently Wed Mar 29, 2017 7:55 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka

All times are UTC [ DST ]



  lesson6: XSD Complex Empty Elements
Fri Mar 06, 2009 12:20 am 

XSD Complex Empty Elements:

In your XSD schema, you can define empty XSD complex element with no content.
xml code
<xs:element name="student">
<xs:complexType>
<xs:complexContent>
<xs:restriction base="xs:integer">
<xs:attribute name="GPA" type="xs:positiveInteger"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:element>


The above Complex element type don't have any content elements.

xml code
<xs:element name="student">
<xs:complexType>
<xs:attribute name="GPA" type="xs:positiveInteger"/>
</xs:complexType>
</xs:element>

XML example:
xml code
<student GPA=3 />


Also remember, you can also can define you type by reference to complex type.
xml code
<xs:element name="student" type="studentType" />
<xs:complexType name="studentType" >
<xs:attribute name="GPA" type="xs:positiveInteger"/>
</xs:complexType>




Author:
Mastermind
User avatar Posts: 2704
Have thanks: 74 time
  Re: lesson6: XSD Complex Empty Elements
Mon Jan 09, 2012 2:46 pm 

Using your first code snipped, I get this error on validation:

[Xerces-J 2.7.1] Validating "zzz-text.xml" against "file://zzz-text.xsd" ...
Ln 9 Col 45 - src-ct.1: Complex Type Definition Representation Error for type '#AnonType_studenttest'. When <complexContent> is used, the base type must be a complexType. 'integer' is a simpleType.
1 Errors

The second code is working. Should 'above' read 'below'?


Author:
Post new topic Reply to topic  [ 2 posts ] 

  Related Posts  to : lesson6: XSD Complex Empty Elements
 lesson5: XSD Complex elements     -  
 lesson7: XSD Complex Text-Only Elements     -  
 Check empty string     -  
 check empty number     -  
 [Ajax/PHP] Registration - Check for empty textboxs     -  
 Complex Numbers     -  
 Complex numbers calculator (C++)     -  
 lesson9: XSD Complex Types Indicators     -  
 solve the complex numbers and do operations on it     -  
 lesson8: XSD Complex Type Mixed Content     -  

All times are UTC [ DST ]



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