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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Unspecified #IMPLIED attributes in Java (was: Goals: XML ...)

[ Lists Home | Date Index | Thread Index ]
  • From: Toby Speight <tms@ansa.co.uk>
  • To: "XML developers' list" <xml-dev@ic.ac.uk>
  • Date: 18 Dec 1997 16:32:39 +0000

Peter> Peter Murray-Rust <URL:mailto:peter@ursus.demon.co.uk>

> In article <3.0.1.16.19971218152122.29672990@pop3.demon.co.uk>,
> Peter wrote:

Peter> Is it the question of the return value of a non-existent
Peter> attribute.  IOW what does
Peter>
Peter> <!ATTLIST FOO PLUGH CDATA #IMPLIED>
Peter>
Peter> <FOO BAR="baz" XYZZY="" BLORT="six      spaces"/>
Peter>
Peter> return for
Peter> String s = element.getAttval("PLUGH");// could be "", or null

David has answered the original question (what is isSpecified() for in the
Java simple API?), but I thought I'd mention that DSSSL's attribute-string
function returns #f for PLUGH; the Java equivalent of this is of course,
null.  I think this is the Right Thing to do; it's sometimes important to
tell the difference between <Fu bargh=""/> and <Fu/>.

The first case is often used to mean a known, empty value; the second
to mean "not known" or "not applicable".

Concrete example: I'm a rock climber, and I keep a record of all my
climbing in XML format.  Climbs are defined as

climbs.dtd>   <!ELEMENT climb (#PCDATA)>
climbs.dtd>   <!ATTLIST climb
climbs.dtd>      grade CDATA ""
climbs.dtd>      stars CDATA #IMPLIED
climbs.dtd>      style (l|2|al|s|tr|mt) #IMPLIED
climbs.dtd>      with CDATA #IMPLIED
climbs.dtd>      >

Note the "stars" attribute, which is used for a climb's star rating
(an indication of quality).  An instance looks like

climbs.xml>  <climb grade="VD" stars="" style="2"
climbs.xml>   with="&p-hkm;">Difficult Crack</climb>

Here, the lack of stars is explicit - it's not a high-quality climb.
Whereas

climbs.xml> <climb grade="D" with="&p-ejk;, &p-dmj;"
climbs.xml>  style="l">King's Chimney</climb>

is a climb in a part of Britain where the star system isn't used, and
so I omitted the attribute - even though it probably deserves a star
or two.

I would not want these two values confused!

-- 

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS