🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by sikorka Thu, 29 Jan 2009 09:24
Warunki w XSD
#10053
Author: sikorka
Date: Thu, 29 Jan 2009 09:24
25 lines
1232 bytes
Hej 

Mam taki xml:
	<mySth>
		<a></a>
		<b></b>
		<c_is_optional></c_is_optional>
   	</mySth>
	
	<otherSth>
		<a></a>
		<b></b>
   	</otherSth>

Jak zrobic do niego xsd z warunkiem pozwalajacym dodac element <c_is_optional>
tylko jesli element nad zawiera na poczatku nazwy 'my'? Jesli element ma na
poczatku nazwy co innego, tak jak tutaj 'other', to element <c_is_optional>
nie jest w nim dozwolony. 

Ktos wie jak to zrobic? 

Ania

-- 
Wysłano z serwisu Usenet w portalu Gazeta.pl -> http://www.gazeta.pl/usenet/
Re: Warunki w XSD
#10054
Author: szomiz
Date: Thu, 29 Jan 2009 10:27
38 lines
2181 bytes
Użytkownik "sikorka" <asikorka.SKASUJ@gazeta.pl> napisał w wiadomości 
news:glrsku$rve$1@inews.gazeta.pl...

> Jak zrobic do niego xsd z warunkiem pozwalajacym dodac element 
> <c_is_optional>
> tylko jesli element nad zawiera na poczatku nazwy 'my'? Jesli element ma 
> na
> poczatku nazwy co innego, tak jak tutaj 'other', to element 
> <c_is_optional>
> nie jest w nim dozwolony.

Nie w ta strone. W schemie zasadniczo nie ma warunkowego definiowania typow. 
Nie da sie rowniez definiowac wzgledem poczatku nazwy. Jezeli juz to calej 
nazwy.

Masz dwa typy zlozone:

1.
<xs:complexType name="myCosTam">
    <xs:sequence>
        <xs: element name="a" .../>
        <xs: element name="b" .../>
        <xs: element name="c"  minOccurs="0" .../>

2.
<xs:complexType name="otherCosTam">
    <xs:sequence>
        <xs: element name="a" .../>
        <xs: element name="b" .../>

A "pietro wyzej" okreslasz, ze moze byc uzyty albo element mySth z 
zawartoscia typu 1. albo otherSth z zawartoscia typu drugiego:

    <xs:choice>
        <xs:element name="mySth" type="myCosTam"/>
        <xs:element name="otherSth" type="otherCosTam"/>

sz. 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads