Subject: [VCARDDAV] RelaxNG unordered list (fwd)

From: Chris Newman <[email-masked]>
Date: Wed, 19 Nov 2008 15:00:40 -0600

Cyrus and I were discussing the problem with the interleave problem in 
RelaxNG and it came up during the meeting.  So I'm forwarding his 
explanation.

My suggestion is we use the interleave pattern anyway, but accept the 
RelaxNG doesn't detect invalid nesting.  The interleave pattern makes it 
extensible.

		- Chris

------------ Forwarded Message ------------
Date: November 19, 2008 9:59:44 -0600
From: Cyrus Daboo <[email-masked]>
To: Chris Newman <[email-masked]>
Subject: RelaxNG unordered list

Hi Chris,
> From the O'Reilly book:

    6.10. A Missing Pattern: Unordered Group
    We have seen that the interleave pattern associates two different
    features and is both an unordered group and something that alters the
    way subgroups can be combined. These two features aren't totally
    independent because mixing child nodes is meaningful only when the
    order of the subgroups isn't maintained, but they aren't totally
    dependent either. In theory, it's possible to define a pattern with a
    meaning of "unordered group" that doesn't interleave child nodes and
    keeps groups unaltered.

    This pattern doesn't exist in RELAX NG for two reasons. First, it helps
    keep the language as simple as possible. Also, although it is built on
    top of an abstract mathematical model, RELAX NG is also built on top of
    the experience of its authors who have wanted to focus on general
    usages and best practices amongst the XML community. The lack of a
    "unordered group with no interleaving" hasn't been reported as a
    real-world limitation so far.

Also, the previous section gives an example of the <interleave> '&'
behavior that makes it clear that this causes "mixing" of elements within
each other:

Example XML to validate:

<title xml:lang="en">Being a
 <a href="http://dmoz.org/Recreation/Pets/Dogs/">Dog</a>
    Is a <b>Full-Time</b>
 <a href="http://dmoz.org/Business/Employment/Job_Search/">Job</a>
</title>

Schema definition:

element title {
  attribute xml:lang {text}
  & text
  & element a {attribute href {text}, text} *
  & element b {text} *
 }

So the key thing to note here is that the "b" element can occur inside of
the "a" element even though they appear at the same "level" inside the
RelaxNG's "title" element.

-- 
Cyrus Daboo

---------- End Forwarded Message ----------

_______________________________________________
VCARDDAV mailing list
[email-masked]
https://www.ietf.org/mailman/listinfo/vcarddav

---

From: Simon Perreault <[email-masked]>
Date: Wed, 19 Nov 2008 17:09:17 -0600

> RelaxNG's "title" element.

I tried to "implement" that test case. See attached files.

The "text.xml" file doesn't validate with the "test.rng" file although 
it should from my understanding so far. I tried with LibXML and SaxonSA.

Is this a problem with the validators I tried or with the O'Reilly book?

Thanks,
Simon

-- 
Please try Numb, a STUN/TURN server implementation.
Free access at http://numb.viagenie.ca/.
<?xml version="1.0" encoding="UTF-8"?>
<grammar 
    xmlns="http://relaxng.org/ns/structure/1.0"
    datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <start>
    <element name="title">
      <interleave>
        <element name="a"><text/></element>
        <element name="b"><text/></element>
      </interleave>
    </element>
  </start>
</grammar>

<?xml version="1.0" encoding="UTF-8"?>
<?oxygen RNGSchema="test.rng" type="xml"?>
<title>
  <a>blah <b>blah</b> blah</a>
</title>

---

From: Simon Perreault <[email-masked]>
Date: Wed, 19 Nov 2008 17:10:00 -0600

> Is this a problem with the validators I tried or with the O'Reilly book?

...or, of course, with my understanding.