[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Unspecified #IMPLIED attributes in Java

  • From: Toby Speight <tms@a...>
  • To: "XML developers' list" <xml-dev@i...>
  • Date: 19 Dec 1997 15:31:40 +0000

attributes in java
Mark> Mark L. Fussell <URL:mailto:fussellm@a...>

> In article <Pine.SOL.3.91.971219062223.1470B-100000@alumnae>, Mark
> wrote:

Mark> On 18 Dec 1997, Toby Speight wrote:
>> ... DSSSL's attribute-string function returns #f for [unspecified
>> #IMPLIED attributes]; 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/>.

Mark> I certainly agree that it is useful to tell the difference
Mark> between these two cases, but it does bring up the issue that
Mark> Peter said: do all users understand the issue?

That's up to the application program.  I have no problem with programs
that treat the two examples the same *provided their documentation
says that's what they are doing* (though I'd be more likely to declare
the default value to be the empty string in the DTD).  In DSSSL, this
behaviour would be

 (let ((val (attribute-string "bargh")))
   (if val
       val
     ""))


Mark> Also, null can only be used for 'notSpecified' if null is not an
Mark> acceptable value.  Frequently it is, so it is better to have a
Mark> seperate 'notSpecified' marker or attribute.

Are we talking about the same thing here?  If the parser returns a
string for each attribute value, then the Java null reference is
distinct from any acceptable (i.e. writable in the XML document)
value.  You've confused me with your suggestion that null may be an
acceptable value; would you care to clarify?


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

Mark> Standardizing on a particular interpretation is unfortunately
Mark> much more difficult. ...  The problem is that there are many
Mark> possible and useful interpretations of "missing information":
Mark> ...

I realise this; I was merely attempting to describe what #IMPLIED is
used for in practice, with specific application[*] conventions -
that's why I used the word "often" ;-).

[*] using the word "application" in its SGML sense - argh!

Mark> But it can be convenient to not be so "wordy".  In which case the
Mark> application will have to be very explicit and consistent about what
Mark> 'notSpecified' means (and, for XML, how that relates to #IMPLIED when
Mark> there is a DTD).

Agreed.

Mark> For MONDO, this can be very consistent because 'notSpecified' and
Mark> #IMPLIED are both treated exactly equivalent to the parameter not
Mark> existing.  But other applications may have difficulty with this.

I've been looking at it the other way around - to me, it seemed "obvious"
to return #IMPLIED as null, and then to think about whether the no-DTD
case is equivalent.  [I think that that bias springs from the fact that I
haven't written any DTD-less applications and I generally use traditional
SGML tools (SP, Jade, psgml-mode, etc.).]

FWIW, I concur that DTD-less processing ought to be equivalent to
specifying all attributes as #IMPLIED, but for the parser API, there
is a difference: I think that the parser should return null in the
valid-processing case, but in the well-formed DTD-less case, it cannot
know that the attribute has been omitted, and so will return neither
the name nor the value of the attribute.

If I write a {grove, tree} builder, it would be useful to know whether
a DTD was used, so that it can report an error to an application trying
to access an attribute that was not declared (this may be the symptom
of a typo, perhaps).  If a DTD was not used for the parse, then the
access should return null (as if the attribute were declared #IMPLIED).



-- 

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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.