Total members 9952 | Gratitudes |It is currently Sat Feb 11, 2012 1:45 pm Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 2 posts ] 
Author Article
 Article subject: lesson6: XSD Complex Empty Elements
PostPosted: Fri Mar 06, 2009 12:20 am 
Offline
Mastermind
User avatar

Joined: Tue Mar 27, 2007 10:55 pm
Posts: 2103
Location: Earth
Has thanked: 39 time
Have thanks: 57 time

XSD Complex Empty Elements:
In your XSD schema, you can define empty XSD complex element with no content.
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.

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


XML example:
Code:
<student GPA=3 />


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

_________________
Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )


TOP
 Profile Send private message  
Reply with quote  
 Article subject: Re: lesson6: XSD Complex Empty Elements
PostPosted: 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'?


TOP
  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 2 posts ] 
Quick reply


  


 Similar topics
 Topic title   Forum   Author   Comments 
 [Ajax/PHP] Registration - Check for empty textboxs  AJAX  PF2G  0
 how to load the form elements depending on selection option  Scripting Language  saics  16
 Elements of a Java Program  Java  msi_333  2
 check empty number  Java examples  msi_333  0
 Check empty string  Java examples  msi_333  0

All times are UTC [ DST ]


Users browsing similar posts

Users browsing this forum: No registered users and 1 guest



Jump to:  
Previous Article | Next Article 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team