473,320 Members | 1,902 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

XSD - another simple questions

Hello

I've got simpleType restricted by pattern

one element uses this simpleType
and I would like
another element to use this SimpleType
but with one extra pattern.

How to do it?

I don't want to create second simpleType and
use it with union to first simpleType.

Thx for any help
MAciek
Jul 20 '05 #1
3 1492
"Matthet" <ma*****@polbox.com> wrote in message
news:bk**********@foka1.acn.pl...
I've got simpleType restricted by pattern

one element uses this simpleType
and I would like
another element to use this SimpleType
but with one extra pattern.

How to do it?


There are two ways to do this. Derive a second simple type as a restriction
of the first and put the pattern there, then use the second type for the
other element, as in e2 below. Or define the second type anonymously in the
definition of the element, as in e3 below.

<xs:schema elementFormDefault="qualified" xml:lang="EN"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="t1">
<xs:restriction base="xs:string">
<xs:pattern value=".+"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="t2">
<xs:restriction base="t1">
<xs:pattern value="[0-9]*"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="e1" type="t1"/>
<xs:element name="e2" type="t2"/>
<xs:element name="e3">
<xs:simpleType>
<xs:restriction base="t1">
<xs:pattern value="[0-9]*"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:schema>

In the example, type t1 disallows empty string contents, while type t2
additionally restricts contents to the digits 0-9.

Bob Foster
http://www.xmlbuddy.com/
Jul 20 '05 #2
>"Bob Foster" wrote
...
<xs:element name="e3">
<xs:simpleType>
<xs:restriction base="t1">
<xs:pattern value="[0-9]*"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:schema>

Thanks,
I thought I tried that
but I've got problems with schema validation.

Now it works OK.

Thanks again
MAciek
Jul 20 '05 #3
"Matthet" <ma*****@polbox.com> wrote in message
news:bk***********@foka1.acn.pl...
Thanks,
I thought I tried that
but I've got problems with schema validation.


That's easy to do when you're trying out this and that variant trying to get
something to work.

If you want an excellent book on XML Schema I recommend Priscilla Walmsley's
"Definitive XML Schema". Google will find it.

Bob Foster
http://www.xmlbuddy.com/
Jul 20 '05 #4

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

Similar topics

1
by: yiyun | last post by:
Hi, I am new to mysql and I want to ask a simple questions. I would like to initialize my InnoDB table space and I configure like below: ...
18
by: Geoff Cox | last post by:
Hello, I am trying to print out the array values for a second time but get error on page message? Thanks Geoff <html>
1
by: Proteus | last post by:
Any help appreciated on a small perl project I need to write for educator/teaching purposes. I have not programmed perl for some time, need to get up to speed, maybe some kind souls hrere will help...
27
by: one man army | last post by:
Hi All- I am new to PHP. I found FAQTS and the php manual. I am trying this sequence, but getting 'no zip string found:'... PHP Version 4.4.0 $doc = new DomDocument; $res =...
1
by: E.T. Grey | last post by:
I have been busting my nut over this for pretty much most of the day and it is driving me nuts. I posted this to an mySQL ng yesterday and I have not had any response (I'm pulling my hair out...
7
by: javedna | last post by:
Hi guys Ive got a simple problem, im designing an online questionnaire and on submission the coding that I have used to validate whether a user has filled in all the questions is supposed to...
1
by: chelisek | last post by:
I have two simple questions: I am trying to create a document using an excel spreadsheet format. I am trying to create a column that will contain numbers, just plain numbers as in account numbers...
1
by: Itanium | last post by:
Hi all! I'm new to .NET Platform and got some simple questions about efficiency... To put you in situation, to say that I'm involved in the writing of a complex regex based lexer for use over...
17
by: Chris M. Thomasson | last post by:
I use the following technique in all of my C++ projects; here is the example code with error checking omitted for brevity: _________________________________________________________________ /*...
4
by: maheshgupta0248 | last post by:
Hi all, Im a newbie in php, started learning php on my own. I want to create small website using php, that contains links for two simple webpages > C questions > C++ questions C questions...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.