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




> 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.org
>
> 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



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


Powered by eList eXpress LLC