473,657 Members | 2,453 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

whats wrong with this schema ...

Hi ALL

Just started to learm Schemas and I am stuck with this
=============== =============== =============== =============== ======
<xs:complexType >
.......
<xs:sequence>
......
<xs:element name="ABNFRULES ET" type="xs:token" maxOccurs="1">
<xs:simpleTyp e>
<xs:list itemType="xs:to ken">
<xs:restricti on base="xs:token" >
<xs:pattern value="\p{IsBas icLatin}*"/>
</xs:restriction>
</xs:list>
</xs:simpleType>
</xs:element>
......
</xs:sequence>
.......
</xs:complexType>

=============== =============== =============== =============== ======

The validator says

"The 'http://www.w3.org/2001/XMLSchema:restr iction' element is not
supported in this context."

Basically what I intend to do is to have it accept list of tokens with
the restriction that the tokens should be of english language
characters

for example

<ABNFRULESET>
"hello" world / [ are u there ]
</ABNFRULESET>

I am not able to figure out how to put this restriction in the list in
another way

thanks
Shyam

Jun 14 '06 #1
3 1543
Hi,

You almost had it. You need an extra xs:simpleType element in there.
Also, you don't want to use itemType - it's an either/or thing - either
you specify the itemType attribute OR a simpleType child.

<xs:element name="ABNFRULES ET" type="xs:token" maxOccurs="1">
<xs:simpleTyp e>
<xs:list>
<xs:simpleTyp e>
<xs:restricti on base="xs:token" >
<xs:pattern value="\p{IsBas icLatin}*"/>
</xs:restriction>
</xs:simpleType>
</xs:list>
</xs:simpleType>
</xs:element>

Some more examples of list types are at:

http://www.datypic.com/books/defxmls...chapter11.html

Hope that helps,
Priscilla

----------------------------------
Priscilla Walmsley
Author, Definitive XML Schema
XQuery
http://www.datypic.com
----------------------------------

*** Sent via Developersdex http://www.developersdex.com ***
Jun 14 '06 #2

Priscilla Walmsley wrote:
Hi,

You almost had it. You need an extra xs:simpleType element in there.
Also, you don't want to use itemType - it's an either/or thing - either
you specify the itemType attribute OR a simpleType child.

<xs:element name="ABNFRULES ET" type="xs:token" maxOccurs="1">
<xs:simpleTyp e>
<xs:list>
<xs:simpleTyp e>
<xs:restricti on base="xs:token" >
<xs:pattern value="\p{IsBas icLatin}*"/>
</xs:restriction>
</xs:simpleType>
</xs:list>
</xs:simpleType>
</xs:element>

Some more examples of list types are at:

http://www.datypic.com/books/defxmls...chapter11.html

Hope that helps,
Priscilla

----------------------------------
Priscilla Walmsley
Author, Definitive XML Schema
XQuery
http://www.datypic.com
----------------------------------


Thanks Priscilla Actually I figured this out before I saw your post but
now I have a bigger problem

I have now fully composed my xsd which is as follows

=============== =============== =============== =============== ====
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace ="http://www.w3schools.c om"
xmlns="http://www.w3schools.c om" elementFormDefa ult="qualified" >
<xs:element name="PROTOHEAD ERENTRY">
<xs:complexType >
<xs:sequence>
<xs:element name="ABNFGRAMM ER" minOccurs="1" maxOccurs="1">
<xs:complexType >
<xs:sequence>
<xs:element name="ABNFRULES ET" maxOccurs="1">
<xs:simpleTyp e>
<xs:list>
<xs:simpleTyp e>
<xs:restricti on base="xs:token" >
<xs:pattern value="\p{IsBas icLatin}*"/>
</xs:restriction>
</xs:simpleType>
</xs:list>
</xs:simpleType>
</xs:element>
<xs:element name="ABNFEXCEP TION" maxOccurs="unbo unded">
<xs:complexType >
<xs:attribute name="RULENAME" type="xs:token"/>
<xs:attribute >
<xs:simpleTyp e>
<xs:restricti on base="xs:token" >
<xs:enumerati on value="MANDATOR Y"/>
<xs:enumerati on value="IGNORESE Q"/>
<xs:enumerati on value="IGNORECA SE"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="NAME" type="xs:token"/>
<xs:attribute name="HEADERSEQ NUM" type="positiveI nteger"/>
</xs:complexType>
</xs:element>
<xs:element name="ABNFBASIC ">
<xs:complexType >
<xs:sequence>
<xs:element name="RULESTRIN G" type="xs:string " maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="ABNFBASIC NAME" type="NMTOKEN"/>
</xs:complexType>
</xs:element>
<xs:element name="ABNFRULE" >
<xs:complexType >
<xs:sequence>
<xs:element name="RULESTRIN G" type="xs:string " maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="RULENAME" type="NMTOKEN"/>
</xs:complexType>
</xs:element>
<xs:element name="PROTOHEAD ER">
<xs:complexType >
<xs:attribute name="PROTOHEAD ERNAME" type="xs:token"/>
<xs:attribute name="ENTRYSEQN UM" type="xs:positi veInteger"/>
</xs:complexType>
</xs:element>
<xs:element name="PROTODEF" >
<xs:complexType >
<xs:sequence>
<xs:element name="PROTOTABL E">
<xs:complexType >
<xs:sequence>
<xs:element ref="PROTOHEADE R" maxOccurs="unbo unded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element ref="PROTOHEADE RENTRY" maxOccurs="unbo unded"/>
<xs:element ref="ABNFRULE" maxOccurs="unbo unded"/>
<xs:element ref="ABNFBASIC" maxOccurs="unbo unded"/>
</xs:sequence>
<xs:attribute name="PROTOCOLN AME" type="xs:token"/>
<xs:attribute name="PROJECTNA ME" type="xs:string "/>
</xs:complexType>
<xs:key name="KEYHEADER NUM">
<xs:selector xpath="PROTOHEA DERENTRY"/>
<xs:field xpath="HEADERSE QNUM"/>
</xs:key>
<xs:keyref name="KEYENTRYN UM">
<xs:selector xpath="PROTOHEA DER"/>
<xs:field xpath="ENTRYSEQ NUM"/>
</xs:keyref>
</xs:element>
</xs:schema>
=============== =============== =============== =============== ===

And now when I give it to the validator I get the following

=============== =============== =============== =============== =
For attribute '???', either the name or the ref attribute must be
present, but not both.

If ref is present, all of 'simpleType', 'form', 'type', and 'use' must
be absent.

The referring attribute must be present.
=============== =============== =============== =============== =
This is the web based validator at the w3school site and it doesnt show
the line numbers so I cant figure out where exactly is the problem.

Ant help will be appreciated

Also can someone point me to a good freeware which can validate xsd

thanks
Shyam

Jun 15 '06 #3
Hi Shyam,

The second attribute of ABNFEXCEPTION doesn't have a name, only a
simpleType child. That must be the problem.

Hope that helps,
Priscilla

----------------------------------
Priscilla Walmsley
Author, Definitive XML Schema
XQuery
http://www.datypic.com
----------------------------------

*** Sent via Developersdex http://www.developersdex.com ***
Jun 15 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1800
by: kk | last post by:
I have this portion in my schema definition: <xsd:simpleType name="MyTimeType"> <xsd:restriction base="xsd:dateTime"> <xsd:pattern value="\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}-Z"/> <xsd:pattern value="\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}+\d{2}:\d{2}"/> <xsd:pattern value="\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}-\d{2}:\d{2}"/> </xsd:restriction>
3
2388
by: Chris Geerdink | last post by:
combo with PHP. what is wrong with the Javascript? else { include("mysql.php"); $query1 = mysql_query("INSERT INTO gbook (naam, email, text) VALUES ('".$_POST."', '".$_POST."', '".$_POST."')"); ?> <script language="JavaScript"> <!--
2
6896
by: joewhitehair | last post by:
Using the XSD.exe tool, I created a number of classes from my XSD file. When I generate the WSDL for my web service, the schema does not have the proper Occurance constraints for the attributes. In this example, the MessageID element should always occur (minOccur=1, maxOccur=1), but the WSDL generates minOccur=0. I can't pinpoint why this is happening and I can't find a may to force this in the code either. Anyone have any insight? This...
28
72456
by: mooreit | last post by:
The purpose for my questions is accessing these technologies from applications. I develop both applications and databases. Working with Microsoft C#.NET and Microsoft SQL Server 2000 Production and 2005 Test Environments. What is the purpose of a view if I can just copy the vode from a view and put it into a stored procedure? Should I be accessing views from stored procedures?
7
2226
by: Mike Barnard | last post by:
It's a simple test... VERY SIMPLE. But... In an external stlyesheet some attributes don't show. With the same styles cut and pasted to the test internally it works as expected. Anyone tell me why? Its probably sooooooo obvious, but it is 1.19 am! Thanks. www.thunderin.co.uk/
0
1049
by: Bob | last post by:
I used the Vb.Net 2005 settings designer to create user settings in my app.config file, abunch of them. Then as I go and use VS 2005 on that project I get about 200 messages all saying something like the one below. Always could not find schema Information for the element etc... and the maximun number of errors or warnings has been reached _ great I follow Microsoft recomendation and I get SH.... I just love these SOBS. Message 1 Could...
1
1439
by: Ganesh Muthuvelu | last post by:
Hello, I have a simple schema as shown below. When I validate it, I get the error "Type 'http://www.w3.org/2001/XMLSchema:emptype' is not declared. An error occurred at , (6, 12)." *************** <?xml version="1.0" encoding="utf-16"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="Employee">
3
2185
by: uridor | last post by:
Hello, I've been trying to make my XSD work, but I'm stuck. I did manage to narrow it down to a simple use case, so I'd appreciate it if someone could load these and see what's wrong: It's basically one XML file and two XSDs, listed below. Thanks in advance for any suggestions. Uri XML FILE
5
2314
by: islayer | last post by:
can someone tell me what is wrong with the bold code? i am just learning perl. the program should create a perl file with a random name (5 letters, followed by a number), but the name is always just the number. whats wrong with my code? #!/usr/bin/perl use Fcntl; @array = (a..z); srand; foreach (1..5) { $name = int(rand scalar(@array));
0
8420
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8324
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8516
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8617
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.