473,581 Members | 2,878 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to use restrictions and extensions in XSD simultanously

Guys! I've got 1 more small problem with XSD. It simple and good, but
sometimes disappointing.
For example we have 3 <THtags - only text and 1 attribute.
Then we need <restriction>-<enumerationt o set all <th>'s text values, but
also <extensionto add 1 attribute
How to do it simultanously inside og 1 element?
Here is simple code in XSD:
<xsd:element name="TH" >

<xsd:complexTyp e>

<xsd:simpleCont ent>

<xsd:extensio n base="xsd:strin g">

<!--xsd:restriction base="xsd:strin g">

<xsd:enumeratio n value="Process ID"/>

<xsd:enumeratio n value="Activity ID"/>

<xsd:enumeratio n value="Instance ID"/>

<xsd:enumeratio n value="Process Description"/>

</xsd:restriction-->

<xsd:attribut e name="style" type="xsd:strin g" />

</xsd:extension>
</xsd:simpleConte nt>
</xsd:complexType >

</xsd:element>
--
Thank you,
De Cool,
EPE
Feb 19 '07 #1
5 12502
On 19 Feb, 21:48, "Dmitry Kulinich" <d...@isd.dp.ua wrote:
For example we have 3 <THtags - only text and 1 attribute.
Then we need <restriction>-<enumerationt o set all <th>'s text values, but
also <extensionto add 1 attribute
In XSD schema you have to do it in two stages. Define the body type
of the TH element (as a simple type), and then extend it to add the
attribute. e.g.:

<xsd:simpleTy pe name="THType">
<xsd:restrictio n base="xsd:strin g">
<xsd:enumeratio n value="Process ID"/>
<xsd:enumeratio n value="Activity ID"/>
<xsd:enumeratio n value="Instance ID"/>
<xsd:enumeratio n value="Process Description"/>
</xsd:restriction >
</xsd:simpleType>

<xsd:element name="TH" >
<xsd:complexTyp e>
<xsd:simpleCont ent>
<xsd:extensio n base="THType">
<xsd:attribut e name="style" type="xsd:strin g" />
</xsd:extension>
</xsd:simpleConte nt>
</xsd:complexType >
</xsd:element>

HTH,

Pete.
=============== =============== ===============
Pete Cordell
Tech-Know-Ware Ltd
for XML to C++ data binding visit
http://www.tech-know-ware.com/lmx
(or http://www.xml2cpp.com)
=============== =============== ===============

Feb 20 '07 #2
Original Message From: "Dmitry Kulinich"
>
Thank you, Pete! It's really simple )))
Could you answer one more question please - how to define few <tdtags with
different types
(means - tags with the same name but with the different type. A've tried to
set node type in restrictions but it doesn't works )

If the types are all simple types, then you can use schema's xs:union
construct. e.g.:

<xs:simpleTyp e name="TDType">
<xs:union memberTypes="xs :float xs:int xs:string"/>
</xs:simpleType>

Normally you would put the most restricted type first, followed by
progressively less restricted types. i.e. all integers could be
represented in a string, but not all strings are valid integers.

If you want different complex types, thn I'm afraid you are out of
luck with XSD schema as it is defined today!

HTH,

Pete.
--
=============== =============== ===============
Pete Cordell
Tech-Know-Ware Ltd
for XML to C++ data binding visit
http://www.tech-know-ware.com/lmx
(or http://www.xml2cpp.com)
=============== =============== ===============

Feb 20 '07 #3
On 20 Feb, 15:29, use...@tech-know-ware.com wrote:
Original Message From: "Dmitry Kulinich"
Thank you, Pete! It's really simple )))
Could you answer one more question please - how to define few <tdtags with
different types
(means - tags with the same name but with the different type. A've tried to
set node type in restrictions but it doesn't works )

If the types are all simple types, then you can use schema's xs:union
construct. e.g.:

<xs:simpleTyp e name="TDType">
<xs:union memberTypes="xs :float xs:int xs:string"/>
</xs:simpleType>

Normally you would put the most restricted type first, followed by
progressively less restricted types. i.e. all integers could be
represented in a string, but not all strings are valid integers.
Ooops - which means I should flip xs:int and xs:float around! e.g.

<xs:simpleTyp e name="TDType">
<xs:union memberTypes="xs :int xs:float xs:string"/>
</xs:simpleType>

Just testing!!!

Pete.
=============== =============== ===============
Pete Cordell
Tech-Know-Ware Ltd
for XML to C++ data binding visit
http://www.tech-know-ware.com/lmx
(or http://www.xml2cpp.com)
=============== =============== ===============

Feb 20 '07 #4
unfortunately I needed this solution 4 the complex type
anyhow, thank you very mush!!!
<us****@tech-know-ware.comwrote in message
news:11******** *************@q 2g2000cwa.googl egroups.com...
On 20 Feb, 15:29, use...@tech-know-ware.com wrote:
>Original Message From: "Dmitry Kulinich"
Thank you, Pete! It's really simple )))
Could you answer one more question please - how to define few <tdtags
with
different types
(means - tags with the same name but with the different type. A've
tried to
set node type in restrictions but it doesn't works )

If the types are all simple types, then you can use schema's xs:union
construct. e.g.:

<xs:simpleTyp e name="TDType">
<xs:union memberTypes="xs :float xs:int xs:string"/>
</xs:simpleType>

Normally you would put the most restricted type first, followed by
progressivel y less restricted types. i.e. all integers could be
represented in a string, but not all strings are valid integers.

Ooops - which means I should flip xs:int and xs:float around! e.g.

<xs:simpleTyp e name="TDType">
<xs:union memberTypes="xs :int xs:float xs:string"/>
</xs:simpleType>

Just testing!!!

Pete.
=============== =============== ===============
Pete Cordell
Tech-Know-Ware Ltd
for XML to C++ data binding visit
http://www.tech-know-ware.com/lmx
(or http://www.xml2cpp.com)
=============== =============== ===============

Feb 21 '07 #5
On 21 Feb, 08:31, "Dmitry Kulinich" <d...@isd.dp.ua wrote:
unfortunately I needed this solution 4 the complex type
anyhow, thank you very mush!!!
Original Message From: "Dmitry Kulinich"
Thank you, Pete! It's really simple )))
Could you answer one more question please - how to define few <tdtags
with
different types
(means - tags with the same name but with the different type. A've
tried to
set node type in restrictions but it doesn't works )
Then I'm afraid, as far as XSD schema is concerned, you are left with
defining the superset of all the types.

Some people add schematron constraints to the XSD definition to select
the correct forms at runtime, but I'm not sure many tools support that
approach.

Relax-NG, an alternative schema language, has support for this sort of
thing, but I'm not sure how widely supported that is either (libxml2
has some support for it).

HTH,

Pete.
--
=============== =============== ===============
Pete Cordell
Tech-Know-Ware Ltd
for XML to C++ data binding visit
http://www.tech-know-ware.com/lmx
(or http://www.xml2cpp.com)
=============== =============== ===============

Feb 21 '07 #6

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

Similar topics

0
565
by: Tom Dearst | last post by:
Gentlemen/Ladies, Is it common for a host to be so restrictive. http://ftphelp.secureserver.net/linux-phpinfo.html Linux http://ftphelp.secureserver.net/win-phpinfo.html Windows GoDaddy is the firm that is hosting my website. They are and have been fantastic in regards to their feature base and technical support. However, After tightly...
2
9221
by: Shailendra Batham | last post by:
Hello Gurus, I want to put some restrictions on my attribute tag in my XML Schema, anyone out there have any idea how to do that. here is my XML and the XML Schema <?xml version="1.0" encoding="utf-8"?> <Book ID="1000000000"> <Name>XML Basic</Name> <Comments>Whatever</Comments>
5
1348
by: Sivaraman.S | last post by:
Hi friends, How to execute a aspx page more than once simultanously without using threading? regards, Sivaraman.S
1
1654
by: Michael Dovel | last post by:
I am looking for what the server requirements and client restrictions will be for applications run from a web server using web forms. (I have not upgraded yet, am still using VB 6 Professional Ediiton). For example, in VB 6 you have either DHTML or IIS internet applications. DHTML runs on the client, so I presume it requires low security...
10
2518
by: musosdev | last post by:
Hi guys I'm trying to migrate to VS2005... I've managed to do that, but realised I'd opened my web projects as file projects, and I'm getting the error about network BIOS command limit. Anyway, I decided to have a go at loading them as web projects from our Win2k3 server. It gets so far and then says "The web server does not appear to...
5
2159
by: Pete C | last post by:
I was looking at Section 17.4.3.1 and I can't work out whether macro names are also covered by Section 17.4.3.1.2 ("Global names"). I often see preple chastised for using include guards like _INCLUDED_BLAH_H (and I avoid them myself "just to be on the safe side"). But if this is a mistake, then it is an astonishingly common one. There are...
6
1887
by: Jess | last post by:
Hello, I learned that we are not allowed to add any new templates or classes or functions or anything else to std namespace. Does it mean that "std" can never be extended? I can't even add any simple function or class? Thanks, Jess
1
2434
by: Paul van Brouwershaven | last post by:
Hi All, I'm struggling with the WDSL restrictions in PHP/SOAP for a while know. I would like to create some simple restrictions in my WDSL file. The script are running both on the same server with PHP Version 5.2.6 with the official soap extension. On both my client and server there is some error configuration:
1
2514
by: Yan | last post by:
Hi, I'm apparently far from being the 1st one to meet this error... My asp.net ajax page requires ScriptManager.axd but gets a 404. following a lot of "This is how I solved it" posts, I : - checked my web.config (copied below) - re-installed the ajax.net extensions - ran aspnet_regiis my application
0
7876
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...
0
8310
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7910
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...
0
6563
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5681
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...
0
3832
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2307
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1409
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1144
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...

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.