Vai indietro   Btre.it > Forum > Forum microsoft.public.it.dotnet.xml
Cerca Messaggi odierni Segna come letti

Forum microsoft.public.it.dotnet.xml Newsgroup microsoft.public.it.dotnet.xml


Rispondi
 
Strumenti della discussione Modalità  di visualizzazione
  #1  
Vecchio 03-23-2007, 08:30 PM
BLUE
Guest
 
Messaggi: n/a
Predefinito XSD newbie: Element based choice.

Suppose I have an XML file like this:

<type>...</type>
<positionID>...</positionID>
<category>...</category>


I want to specify in my XML Schema that:

- if "type" is "One" I must have
<positionID>A_STRING</positionID>

- if "type" is "Two" I must have
<positionID>
<zoneID>A_POSITIVE_NUM</zoneID>
<sectorID>A_POSITIVE_NUM</sectorID>
<cellID>A_POSITIVE_NUM</cellID>
</positionID>

- if "type" is "Three" I must have
no category or empty category

- if "type" is "Four" I must have
the same thing as for case "Two" and "Three"


If this is not possible can I check this from my application or it would be
a semantic error and it would be better to separate the two schemas?


Thank you for any help!
Luigi.


Rispondi citando
Alt Today
Btre.it
Pubblicita' Google Adsense
 
Registrati gratis
e partecipa alle discussioni di
Btre.it
Standard Sponsor Btre.it

  #2  
Vecchio 03-23-2007, 10:15 PM
John Saunders
Guest
 
Messaggi: n/a
Predefinito Re: XSD newbie: Element based choice.

"BLUE" <blue> wrote in message
news:460446d5$0$37193$4fafbaef***reader3.news.tin.it ...
> Suppose I have an XML file like this:
>
> <type>...</type>
> <positionID>...</positionID>
> <category>...</category>


That's not a well-formed XML document. You need root element around all of
those.

> I want to specify in my XML Schema that:
>
> - if "type" is "One" I must have
> <positionID>A_STRING</positionID>
>
> - if "type" is "Two" I must have
> <positionID>
> <zoneID>A_POSITIVE_NUM</zoneID>
> <sectorID>A_POSITIVE_NUM</sectorID>
> <cellID>A_POSITIVE_NUM</cellID>
> </positionID>
>
> - if "type" is "Three" I must have
> no category or empty category
>
> - if "type" is "Four" I must have
> the same thing as for case "Two" and "Three"
>
>
> If this is not possible can I check this from my application or it would
> be a semantic error and it would be better to separate the two schemas?


XML Schema cannot describe this situation. You'll have to check yourself.

John


Rispondi citando
  #3  
Vecchio 03-29-2007, 06:29 PM
Priya Lakshminarayanan
Guest
 
Messaggi: n/a
Predefinito Re: XSD newbie: Element based choice.

These constraints are called co-occurrence constraints and cannot be
specified using XML Schema. You can embed Schematron rules in your schema to
specify the same.
For more information on Schematron, check the following:
http://xml.ascc.net/resource/schematron/
http://www.xml.com/pub/a/2000/11/22/schematron.html

Thanks,
Priya

"BLUE" <blue> wrote in message
news:460446d5$0$37193$4fafbaef***reader3.news.tin.it ...
> Suppose I have an XML file like this:
>
> <type>...</type>
> <positionID>...</positionID>
> <category>...</category>
>
>
> I want to specify in my XML Schema that:
>
> - if "type" is "One" I must have
> <positionID>A_STRING</positionID>
>
> - if "type" is "Two" I must have
> <positionID>
> <zoneID>A_POSITIVE_NUM</zoneID>
> <sectorID>A_POSITIVE_NUM</sectorID>
> <cellID>A_POSITIVE_NUM</cellID>
> </positionID>
>
> - if "type" is "Three" I must have
> no category or empty category
>
> - if "type" is "Four" I must have
> the same thing as for case "Two" and "Three"
>
>
> If this is not possible can I check this from my application or it would
> be a semantic error and it would be better to separate the two schemas?
>
>
> Thank you for any help!
> Luigi.
>



Rispondi citando
 
Rispondi
Tags: , , , ,



Strumenti della discussione
Modalità  di visualizzazione

Regole di scrittura
Tu non puoi inserire i messaggi
Tu non puoi rispondere ai messaggi
Tu non puoi inviare gli allegati
Tu non puoi modificare i tuoi messaggi

codice vB è Attivo
smilies è Attivo
[IMG] il codice è Attivo
Il codice HTML è Disattivato
Vai al forum

Discussioni simili
Discussione Ha iniziato questa discussione Forum Repliche Ultimo messaggio
Html Element Gipos Forum microsoft.public.it.dotnet.csharp 2 10-24-2008 06:10 PM
[semi-OT]Usare choice in un batch joker197cinque Forum microsoft.public.it.winserver 1 12-06-2007 08:47 PM
Win an Xbox 360 game of your choice costabarrett Forum microsoft.public.it.xbox 0 03-05-2006 11:17 AM
Newbie Question Adding and Closing Element. AndyDunning Forum microsoft.public.it.dotnet.xml 0 08-03-2004 11:11 AM
AUTHORIZATION element UGI 7790 Forum microsoft.public.it.dotnet.asp 3 07-31-2004 12:57 PM


Tutti gli orari sono GMT. Attualmente sono le 05:51 PM.


Copyright ©: 2000 - 2010
Forum Url by Zoints
Excel - sql - winserver - dotnet asp - access - dotnet vb - pocketpc - exchange - dotnet csharp - outlook - word - internet explorer - sicurezza - windows - office - pocketpc marketplace - windows vista - win98 - project - windowsforms - dotnet ado - xbox - windowsmedia - frontpage - framework - powerpoint - scripting - vb - vstudio - giochipc - isaserver - bosbs - sharepoint - windows update - outlook express - networking - messenger - foxpro - virtualmachine - smartphone - vc++ - mediacenter - crm - live mail - webservices - xml - publisher - powerpoint - design gallery - live onecare - visio - expression