Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
 

Go Back   XSL - XML - RSS Forums > XSLForum: Main > XSL-XSD-XML and more

Tags:



Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-08-2008, 01:55 PM
Martin Honnen
 
Posts: n/a

Default Re: Noob XSD question



Alfie Noakes wrote:
> I've been wrestling with this all today and just can't crack it! It's
> driving me mad. Arggghhh.
>
> Given a very simple "database type" XML file....
>
> <database name="mydatabase">
> <table name="fruit">
> <row>
> <field name="name">Kumquat</field>
> <field name="colour">Kind of orangey</field>
> </row>
> <row>
> <field name="name">Lychee</field>
> <field name="colour">Reddish</field>
> </row>
> </table>
> </database>
>
>
> I simply cant get the XSD right to validate when the text part of the
> <field> element is missing ( i.e. Kumquat or Lychee)



Well what exactly do you want to specify in your schema? A minimum
length? Then define a simpleType with the minimum length and use that
simple type name

> <xs:complexType name="fieldtype">
> <xs:simpleContent>
> <xs:extension base="xs:string">


here instead of xs:string as the base type.



--

Martin Honnen
http://JavaScript.FAQTs.com/
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-09-2008, 12:06 PM
Martin Honnen
 
Posts: n/a

Default Re: Noob XSD question

Alfie Noakes wrote:

> I don't suppose you could give me some pointers regarding how to
> approach making sure the field element name attribute is unique within
> a table? Looks like I'm in for a fun evening trying to sort that one
> out.


Use an xs:unique constraint on the table, see
http://www.w3.org/TR/xmlschema-0/#specifyingUniqueness

--

Martin Honnen
http://JavaScript.FAQTs.com/
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Contact Us -|- XSL - XML - RSS Forums -|- Archive -|- Top -|-Rules/Disclaimer-|-Help/Support -|-Advertise
© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
All times are GMT. The time now is 01:51 PM.
Style Developed by Epic Designz