473,849 Members | 1,757 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 12524
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 integrating PHP/MySql into my website I come across several issues. I've just come to find out that...
2
9241
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
1367
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
1664
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 restrictions on the client because of downloading activeX documents (applications)? IIS which runs on the...
10
2546
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 have FrontPage server extensions installed".
5
2177
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 dozens of well-known libraries in my /usr/include that do it. Is this technically a mistake that...
6
1895
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
2458
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
2532
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
9893
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
9738
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,...
0
11005
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9501
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7894
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
5735
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5921
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4139
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3177
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.