[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Subject: Re: Comments about the spec
James Clark wrote: > > I was at first puzzled, but you are right. > > > > <element name="foo"><list><empty/></list></element> > > matches <foo> </foo>, but <attribute > > name="foo"><list><empty/></list></element> does not match foo=" ". > > I think you meant to say: Sorry. I was not really awake. > <attribute name="foo"><list><empty/></list></attribute> matches foo=" ", > but <attribute name="foo"><empty/></attribute> does not. The semantic rule for <element> applies "stripSpace" to the content, but that for <attribute> does not. (As we have agreed long time ago.) "stripSpace" removes whitespace strings from normalized strings (i.e., no adjacent strings). The semantic rule for <list> uses "split", which returns a sequence of tokens. "split" eats intervening whitespace characters. I suppose that it also eats trailing and leading whitespace characters (this is not completely clear from the spec). 1) <element name="foo"><list><empty/></list></element> and <foo> </foo> Two space characters between <foo> and </foo> are removed by "stripSpace". Then, an empty mixed-sequence is compared against <list><empty/></list>. By applying "split", we have an empty sequence of strings. This matches <empty/> (6.2.3). 2) <attribute name="foo"><list><empty/></list></element> and foo=" " A sequence of strings (" ") is compared against <list><empty/></list>. "split" eats whitespace characters, and returns an empty sequence of strings. This matches <empty/> 3) <attribute name="foo"><empty/></element> and foo=" " Neither "stripSpace" nor "split" is applied. Thus, we examine " ". This does not match <empty/>. > On the other hand <element name="foo"><empty/></element> does match > > <foo> </foo> 4) <element name="foo"><empty/></element> and <foo> </foo> "stripSpace" removes " ". Thus, we have an empty mixed-sequence. Boy, we have many normalizations 1) normalization by the XML processor (end-of-line and attribute value normalization), 2) normalized(m) which concatenate adjacent strings, 3) stripSpace(m), and 4) split(m) I now think that some examples in the spec is helpful. Let me try. Cheers, Makoto
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Powered by eList eXpress LLC