OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

relax-ng-comment message

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


Subject: RE: [relax-ng-comment] Fwd: SIlly newbie questions


Joseph, 
	For better RELAX NG viewing, you could also use the attached pretty
printer stylesheet.  It reduced the vertical space of the rng4rng schema by
about 40%. (See attached rng4rng.html) 

tom

-----Original Message-----
From: James Clark [mailto:jjc@jclark.com]
Sent: Sunday, March 31, 2002 10:23 PM
To: relax-ng-comment@lists.oasis-open.org
Cc: Joseph Reagle
Subject: Re: [relax-ng-comment] Fwd: SIlly newbie questions




> Date: Fri, 29 Mar 2002 11:32:34 -0500
> From: Joseph Reagle <reagle@w3.org>
> Subject: SIlly newbie questions
> To: relax-ng-comment@lists.oasis-open.orgEL
>
> Hello, I have some silly newbie questions about Relax NG -- I'm
> documenting these for myself as much as asking the question. (Is this the
> appropriate list, is there a relax-ng-dev forum?)

The comment list is appropriate.  Alternatively, you could try xml-dev.

> Given the incomplete rng below:
>
> 1. The *only* thing I've discovered that I don't like in rng so far is
> that it is "vertically verbose."  Are there any conventions for trying to
> make the presentation a bit more compact and vertically "striped". I can
> take in a lot more information with my (admittedly more practiced) schema
> eye than in a couple of pages of rng. I tried to do it in the
> EncryptedKey below, but it's probably not a good idea and the word
> wrapping will make it a confused mess in email.

There are several possible solutions:

- Use the non-XML syntax 
(http://www.thaiopensource.com/relaxng/nonxml/syntax.html)

- Use an XML shorthand and transform to real RELAX NG 
(http://www.kohsuke.org/relaxng/shorthand/ShortRNG.html)

- View the RELAX NG using something other than a plain text editor (eg IE)

- Use definitions appropriately.  For example,

<define name="optionalIdAttribute">
  <optional>
    <attribute name="id">
      <data type="ID"/>
    </attribute>
  </optional>
</define>

<define name="EncryptedType">
  ...
  <ref name="optionalIdAttribute"/>
  ...
</define>

> 2. In schema, I made most every structure a global type to aid in its
> reuse. While I plan emulating the same for EncryptedType (as an abstract
> type) in rng because the EncryptedData and EnryptedKey genuinely share a
> lot of structure, I don't think all of those other intermediate types [1]
> will be necessary in rng.
>
> [1] http://www.w3.org/TR/xmlenc-core/xenc-schema.xsd

I don't know what sort of reuse you contemplate so it's hard to comment.

> 3. Since so many of my elements and attributes are optional (and this
> leads to the vertical verbosity) is there a means to say "all patterns in
> this sequence are optional"? (I don't want to say the whole sequence is
> optional.)

For attributes, you can use the following trick:

<zeroOrMore>
  <choice>
    <attribute name="foo"/>
    <attribute name="bar"/>
  </choice>
</zeroOrMore>

This is equivalent to optional foo and optional bar, since RELAX NG and XML 
do not allow multiple attributes with the same name. I don't like this 
myself; I think it's rather obfuscatory.

James


----------------------------------------------------------------
To subscribe or unsubscribe from this elist use the subscription
manager: <http://lists.oasis-open.org/ob/adm.pl>

Attachment: prettyPrintRNG.xsl
Description: Binary data

    grammar

<grammar
  datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
  ns="http://relaxng.org/ns/structure/1.0"
>
pattern
</grammar>

    pattern

choice
element element
choice
attribute name : QName
element attribute
choice
attribute name : QName
interleave
optional
element group
element interleave
element choice
element optional
element zeroOrMore
element oneOrMore
element mixed
element ref
attribute name : NCName
element parentRef
attribute name : NCName
element empty
element text
element value
optional
attribute type : NCName
<text/>
element data
attribute type : NCName
interleave
group
zeroOrMore
element param
attribute name : NCName
<text/>
optional
element except
element notAllowed
element externalRef
attribute href : anyURI
element grammar

    grammar-content

interleave
zeroOrMore
choice
element include
attribute href : anyURI

    include-content

interleave

    start-element

element start

    define-element

element define
attribute name : NCName

    combine-att

optional
attribute combine
choice
"choice"
"interleave"

    open-patterns

interleave
oneOrMore

    open-pattern

interleave

    name-class

choice
element name
data type=QName

    except-name-class

interleave
optional
element except

    open-name-classes

interleave
oneOrMore

    open-name-class

interleave

    common-atts

optional
attribute ns
optional
attribute datatypeLibrary : anyURI
zeroOrMore
attribute
anyName
except
nsName
nsName ns=""

    other

zeroOrMore
element
anyName
except
nsName
zeroOrMore
choice
attribute
anyName
<text/>
any

    any

element
anyName
zeroOrMore
choice
attribute
anyName
<text/>
any



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


Powered by eList eXpress LLC