- From: Andrew n marshall <amarshal@usc.edu>
- Date: Mon, 4 May 1998 13:44:12 -0700
- To: "Lauren Wood" <lauren@sqwest.bc.ca>, "W3C DOM List" <www-dom@w3.org>
> -----Original Message----- > From: Lauren Wood > Subject: RE: Error on Element Declaration . . . > The idea behind Attributes having children was to have something to keep the > attribute value in. Attribute values can contain entity references > in XML, so > they can't be simple strings. What else would you suggest? That makes sense. The only complaint I have is with regard to the burden that places on DOM users who have no need for references to the entities. My guess is that covers the majority of DOM users. For example, here is a chunk out of my code. This is from the March spec, so it is slightly out of date: switch( node.getNodeType() ) { case Node.ELEMENT: elem = (Element) node; // Determine if this is a recognized XLink if( (atts = elem.attributes()) != null && (att = atts.getAttribute( "xml:link" )) != null && "simple".equals( ((Text) att.getValue()).getData() ) ) { if( (att = atts.getAttribute( "href" )) != null ) { href = ((Text) att.getValue()).getData(); actuate = show = null; if( (att = atts.getAttribute( "actuate" )) != null ) actuate = ((Text) att.getValue()).getData(); if( (att = atts.getAttribute( "show" )) != null ) show = ((Text) att.getValue()).getData(); if( ( actuate == null || actuate.equals( "user" ) ) && ( show == null || show.equals( "replace" ) ) ) { block = new CSSBlock(); domRef.append( block ); build( (Element) node, block, href ); // Recurse } else if( actuate.equals( "auto" ) ) { // Need to test for embedded images } } else { You can see that this can get really excessive. For that purpose, I would like to recommend the following convience method be added to either Element or AttributeList: wstring getAttributeValue( wstring name ); If the attribute exists, then the the wstring returned would be the value of the attribute with all entities expanded. If it doesn't exist, either explicitly or implicitly, then the method should return null. Andrew n marshall student - artist - programmer http://www.media-electronica.com/anm-bin/anm "Everyone a mentor, Everyone a pupil"
Received on Monday, 4 May 1998 16:36:08 UTC