XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] RELAX question re: required value

Thanks Maik - I don't think that works since we want to require the presence of the all collection?

On 01/22/2014 01:00 PM, Maik Stührenberg wrote:
As a follow up, this may work for you:

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
    <start>
        <element name="root">
            <oneOrMore>
                <choice>
                    <element name="collection">
                        <value>all</value>
                    </element>
                    <zeroOrMore>
                        <element name="collection">
                            <text/>
                        </element>
                    </zeroOrMore>
                    <zeroOrMore>
                        <text/>
                    </zeroOrMore>
                </choice>
            </oneOrMore>
        </element>
    </start>
</grammar>

Best,

Maik


2014/1/22 Maik Stührenberg <maik.stuehrenberg@uni-bielefeld.de>
Hi Mike,

as far as I can see, there is no way to define this in RNG, since the same element or pattern cannot appear more than once in an interleave (see http://books.xmlschemata.org/relaxng/relax-CHP-6-SECT-9.html).
With choice it wouldn't be a problem (if I've understood your question correctly):

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
    <start>
        <element name="root">
            <choice>
                <element name="collection">
                    <value>all</value>
                </element>
                <zeroOrMore>
                    <element name="collection">
                        <text/>
                    </element>
                </zeroOrMore>
            </choice>
        </element>
    </start>
</grammar>

Best,

Maik



2014/1/22 Michael Sokolov <msokolov@safaribooksonline.com>
I have a schema that allows a bunch of different elements to be interleaved in any order; one of them is <collection>;  I want to require that a collection with value "all" be present, as well as allowing any number of other collections, in any order, using RELAX -- is that possible?  I can't seem to work out how, if it is.  For now I'm just using

element collection { text }+ &

Thanks

-Mike

_______________________________________________________________________

XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
subscribe: xml-dev-subscribe@lists.xml.org
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php



--
Dr. Maik Stührenberg

Universität Bielefeld
Fakultät für Linguistik und Literaturwissenschaft
Universitätsstraße 25
33615 Bielefeld

Telefon: +49 (0)521/106-2534
E-Mail: maik.stuehrenberg@uni-bielefeld.de

http://www.maik-stuehrenberg.de
http://www.xstandoff.net



--
Dr. Maik Stührenberg

Universität Bielefeld
Fakultät für Linguistik und Literaturwissenschaft
Universitätsstraße 25
33615 Bielefeld

Telefon: +49 (0)521/106-2534
E-Mail: maik.stuehrenberg@uni-bielefeld.de

http://www.maik-stuehrenberg.de
http://www.xstandoff.net



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS