[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: RELAX question re: required value

  • From: Michael Sokolov <msokolov@safaribooksonline.com>
  • To: Maik St��nberg<maik.stuehrenberg@uni-bielefeld.de>
  • Date: Wed, 22 Jan 2014 14:14:03 -0500

Re:  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]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.