🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

3 total messages Started by Filip Rembiałkowski Tue, 30 Sep 2008 11:13
"Invalid value for maxOccurs (must be 0 or 1)." -- wtf?
#10007
Author: Filip Rembiałkowski
Date: Tue, 30 Sep 2008 11:13
45 lines
2184 bytes
witam

chciałbym napisać xsd który zezwoli na taki xml:

::::::::::::::
owoce.xml
::::::::::::::
<skrzynka>
  <jablko/>
  <gruszka/>
  <jablko/>
</skrzynka>

skrzynka ma zawierać dowolną ilość jablek i gruszek w dowolnej kolejnosci.


myślałem że tak będzie ok:
::::::::::::::
owoce.xsd
::::::::::::::
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="skrzynka" type="skrzynka"/>
<xs:complexType name="skrzynka">
  <xs:all>
    <xs:element name="jablko" type="owoc" maxOccurs="unbounded" />
    <xs:element name="gruszka" type="owoc" maxOccurs="unbounded" />
  </xs:all>
</xs:complexType>
</xs:schema>


ale chyba czegoś nie rozumiem bo
$ xmllint --noout --schema owoce.xsd owoce.xml
owoce.xsd:6: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element': Invalid value for maxOccurs (must be 0 or 1).
owoce.xsd:7: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element': Invalid value for maxOccurs (must be 0 or 1).
WXS schema owoce.xsd failed to compile


co jest dla mnie dziwne: w dokumentacji na w3 (http://www.w3schools.com/Schema/el_element.asp) piszą,
 że maxOccurs może być "unbounded", a mój xmllint najwyraźniej myśli inaczej...


pomocy :)
Re: "Invalid value for maxOccurs (must be 0 or 1)." -- wtf?
#10008
Author: Andrew Cohen
Date: Tue, 30 Sep 2008 16:14
15 lines
1545 bytes
Filip Rembiałkowski pisze:
> ale chyba czegoś nie rozumiem bo
> $ xmllint --noout --schema owoce.xsd owoce.xml
> owoce.xsd:6: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element': Invalid value for maxOccurs (must be 0 or 1).
> owoce.xsd:7: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element': Invalid value for maxOccurs (must be 0 or 1).
> WXS schema owoce.xsd failed to compile

http://www.w3.org/TR/xmlschema-1/#cos-all-limited

When a model group has {compositor} all, then all of the following must be true:
[...]
The {max occurs} of all the particles in the {particles} of the group must be 0 or 1.

--
Andrew Cohen
Re: "Invalid value for maxOccurs (must be 0 or 1)." -- wtf?
#10009
Author: szomiz
Date: Tue, 30 Sep 2008 16:27
14 lines
1479 bytes
Użytkownik "Filip Rembiałkowski" <plk.zuber@gmail.com> napisał w wiadomości 
news:gbt1tf$6ed$1@nemesis.news.neostrada.pl...

>  <xs:all>
>    <xs:element name="jablko" type="owoc" maxOccurs="unbounded" />
>    <xs:element name="gruszka" type="owoc" maxOccurs="unbounded" />


<xs:choice maxOccurs="unbounded">
    <xs:element name="jablko" type="owoc" />
    <xs:element name="gruszka" type="owoc" />

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