Re: isWhitespaceInElementContent method

Philippe Le Hegaret wrote:

>On Fri, 2003-08-01 at 00:29, Curt Arnold wrote:
>  
>
>>This would be more appropriate as an read-only attribute.
>>    
>>
>
>It has been the case in the past, until someone realized that the Java
>binding contained the following method:
>
>boolean getWhitespaceInElementContent()
>
>In the Java beans world, boolean attributes are mapped to setX() and
>isX(), instead of of setX() and getX().
>

Section 8.3.2 of the Java Beans Specs 
http://java.sun.com/products/javabeans/docs/spec.html allows boolean 
is<Property Name>() as an alternative or in addition to boolean 
get<Property Name>().   Several existing boolean properties are mapped 
to get<Property Name>(), such as Attr.getSpecified().

There are a few boolean properties in the HTML (HTMLInputElement.isMap), 
Views (VisualImage.isLoaded, VisualFormButton.isPressed)  and Validation 
(CharacterDataEditVAL.isWhitespaceOnly) that start with "is" and are 
presumably mapped to getIs<Property Name>() in the Java binding, however 
I suspect the Java bindings are rarely used.

Using a <method> with a name starting with "is" generates a method in 
the Java binding that is recognized as a boolean property accessor, but 
makes it look like a method call in those bindings (like ECMAScript) 
that actually support properties.

I would suggest enhancing the stylesheet that generate the binding to 
suppress the "get" when the property name starts with "is" and the type 
is boolean.  An exception could be made for HTMLInputElement.isMap to 
avoid breaking the existing interface definition.

>
>  
>
>>  The 
>>description is insufficient since it doesn't explicitly explain under 
>>what conditions the implementation is able and required to determine 
>>that the content model only contains elements.
>>    
>>
>
>The description says:
>[[
>The text node is determined to contain whitespace in element content
>during the load of the document or if validation occurs while using
>Document.normalizeDocument().
>]]
>
>isn't that sufficient?
>
>Philippe
>
>
>
>  
>
MSXML.preserveWhitespace and JAXP's isIgnoringElementContentWhitespace() 
had different interpretations of when whitespace should be preserved.  
MSXML would discard whitespace without requiring a Document Type 
Declaration which would result in whitespace being lost in the rare case 
that the content model was mixed and only whitespace appeared in 
addition to elements.  JAXP implementations would require a DTD and 
validation (at least when the DTD was in an external subset) to be sure 
that the content model was explicitly element-only.

In addition, we have the example of Xerces's implying the need to load 
an external subset DTD in order to provide default attribute values.  
Similarly, you could imply that you need to load an external subset DTD 
to determine if the content model was element-only or mixed so you could 
properly determine this property.

However, all this would be moot if "isWhitespace" and "isElementContent" 
are separated.

Received on Tuesday, 5 August 2003 23:57:04 UTC