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?)
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.
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
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.)
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
xmlns:ds='http://www.w3.org/2000/09/xmldsig#'
ns="http://www.w3.org/2001/04/xmlenc#"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<start>
<choice>
<ref name="EncryptedData"/>
<ref name="EncryptedKey"/>
</choice>
<define name="EncryptedData">
<ref name="EncryptedType"/>
</define>
<define name="EncryptedKey">
<ref name="EncryptedType"/>
<optional><ref name='xenc:ReferenceList' minOccurs='0'/></optional>
<optional><element name='CarriedKeyName'><data
type="string"/></element></optional>
<optional><attribute name='Recipient'> <data
type="string"/></attribute></optional>
</define>
<define name="EncryptedType">
<ref name="EncryptionMethod"/>
<optional>
<ref name="ds:KeyInfo"/>
</optional>
<optional>
<ref name="CipherData"/>
</optional>
<optional>
<ref name="EncryptionProperties"/>
</optional>
<optional>
<ref name="EncryptionProperties"/>
</optional>
<optional>
<attribute name="ID">
<data type="ID"/>
</attribute>
</optional>
<optional>
<attribute name="Type">
<data type="anyURI"/>
</attribute>
</optional>
<optional>
<attribute name="MimeType">
<data type="string"/>
</attribute>
</optional>
<optional>
<attribute name="Encoding">
<data type="anyURI"/>
</attribute>
</optional>
</define>
--
Joseph Reagle Jr. http://www.w3.org/People/Reagle/
W3C Policy Analyst mailto:reagle@w3.org
IETF/W3C XML-Signature Co-Chair http://www.w3.org/Signature/
W3C XML Encryption Chair http://www.w3.org/Encryption/2001/