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

 


Help: OASIS Mailing Lists Help | MarkMail Help

cgmo-webcgm message

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


Subject: RE: [cgmo-webcgm] Problem: about empty/null node lists


Lofton,

In our implementation if a function returns a WebCGMString or a WebCGMNode,
and there is nothing to return, we return NULL.
If a function returns a WebCGMNodeList and there are no nodes, we return an
empty string.

Regards,
Forrest



-----Original Message-----
From: Lofton Henderson [mailto:lofton@rockynet.com] 
Sent: Friday, September 02, 2005 6:10 PM
To: cgmo-webcgm@lists.oasis-open.org
Subject: [cgmo-webcgm] Problem: about empty/null node lists

Implementors, et al --

Your prompt attention and feedback is needed...

I had trouble interpreting and implementing some bits of the spec, while 
writing the Text Node test.  Specifically, with the 'hasChildNodes()' and 
'childNodes' sub-test (see 5.7.4, WebCGMNode interface).

The spec says:  "If there are no children, this returns an empty 
WebCGMNodeList".  Nodes of type TEXT_NODE never have any children.

So the problem I had -- what is an "empty WebCGMNodeList"?  If 
hasChildNodes() is false, then which of the following is meant?

1.) myTextNode.childNodes.count==0 ?
2.) or, myTextNode.childNodes==null  ?

It is a subtle difference -- if the meaning and the implementation is #2, 
then #1 results in JS throwing an "object error".

I have talked some with Benoit about it.  Part of that dialog is below.  I 
would like to hear from other implementors (and Benoit, of course).  This 
may seem a small question, but as Ben says, its impact on implementations 
is not small.  We need to resolve it *quickly*.

For reference, I scanned the spec for all things that can return a 
WebCGMNodeList.  Here is what the spec says:

WebCGMNode.childnodes:  says "returns an empty WebCGMNodeList"
WebCGMNode.attributes:  says "or null if the WebCGMNode doesn't have any 
attributes"
WebCGMNode.getElementsByTagNameNS:  says nothing.
WebCGMPicture.getAppStructureById: says "..returns empty WebCGMNodeList."
WebCGMPicture.getAppStructuresByName:  says "...returns null."

(Consistency would be nice!)

Note that there are two similar/related questions:
i.) empty/null WebCGMString.
ii.) "null" WebCGMNode.
As I recall, we decided these a while ago:
i.) always empty string (JS:  myString.length==0,  myString=="" are both
true)
ii.) null (JS:  myObject==null)

The spec text does *not* reflect these decisions (at least I can't find it) 
-- that will be fixed.  (E.g., namespaceURI, which is type WebCGMString, 
still talks about "null").  Let's stick with the WebCGMNodeList problem for 
this thread.

Here are some of Benoit's comments about the empty/null WebCGMNodeList 
question, by reference to the list of 5 cases above:

At 01:07 PM 9/2/2005 -0400, Benoit Bezaire wrote:
>[...]
>I've raised this kind of issue 3 months ago; and it's still
>not fixed, see: 
>http://lists.oasis-open.org/archives/cgmo-webcgm/200506/msg00036.html
>... the other
>implementers ... [should] have commented on this a loooooong time ago
>while writing test files or sending implementation feedback.
>
>LH> WebCGMNode.childnodes says "returns an empty WebCGMNodeList"
>Here, from my perspective, saying "or null if the WebCGMNode doesn't
>have any children" would simplify my life (but we would be diverging
>from the XML DOM spec). Or maybe Forrest and Ulrich are returning NULL
>as well, I have no idea.
>
>LH> WebCGMNode.attributes says "or null if the WebCGMNode doesn't have any
>LH> attributes"
>This is fine with me.
>
>LH> WebCGMNode.getElementsByTagNameNS says nothing.
>LH> WebCGMPicture.getAppStructureById says "..returns empty
WebCGMNodeList."
>Here, our implementation returns null (like the XML DOM).
>
>LH> WebCGMPicture.getAppStructuresByName says "...returns null."
>These three (getElementsByTagNameNS, getAppStructureById,
>getAppStructuresByName), should, in my opinion, behave the same way.
>Again, I have no idea what other implementers are doing.
>
>The reason I'm frustrated is that these changes even though they seem
>simple are not simple (because of the Live Node concept, reference
>counting etc...).
>Any change to the wording means that the tests have to be revisited
>and everyone has to regenerate an implementation matrix. (How long
>have you been running after implementation matrices). We need to
>resolve this ASAP (like early next week)! Note: Monday is a Canadian
>public holiday.
>
>LH> So ... is 'null' (maps to JS 'null' keyword) synonymous with empty
>LH> list, or not?
>In my opinion, an empty list is not null, it's an object (a list) with
>no references inside the list.

This should be on the Wednesday Agenda, and we need some attention and 
feedback before then.

Regards,
-Lofton.




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