[jdom-interest] PI.getValue() returning "" [eg]

Wesley Biggs wbiggs at elite.com
Wed Mar 14 10:42:30 PST 2001


I'm confused by your example.  In <?targ quux="a" bar?>, pi.getValue("quux")
should be "a", right?  You meant what should pi.getValue("bar") give you,
I'll assume.

It looks like a classic tri-state problem.

Is it important to be able to distinguish 
<?targ quux="a" bar?>
<?targ quux="a" bar=""?>

If not, both should return "".  If it is important, how about adding a
PI.hasName(name) method (or something similar) and let the former case
return null.


-----Original Message-----
From: Steven D. Keens [mailto:skeens at planetfred.com]
Sent: Wednesday, March 14, 2001 6:35 AM
To: jdom-interest
Subject: RE: [jdom-interest] PI.getValue() returning "" [eg]

Also, in your example

<?targ quux="a" bar?>

If pi.getValue("quux") returned null then we
wouldn't be able to distinguish it from
pi.getValue("bar").  If it's a key-value pair
then we should be allowed to treat it as an
attribute.  If it isn't then returning null
can indicate that we don't have an attribute
like data.

-----Original Message-----
From: jdom-interest-admin at jdom.org
[mailto:jdom-interest-admin at jdom.org]On Behalf Of Jason Hunter
Sent: Wednesday, March 14, 2001 06:59
To: JDOM Interest
Subject: [jdom-interest] PI.getValue() returning "" [eg]

Quick poll.  As many of you know, ProcessingInstruction can parse the PI
data and make it available like attributes as a convenience since that's
so commonly how PI data is written.  I'd like to make sure the end cases
behave correctly.

Given the PI:

<?targ foo="a" bar=""?>

pi.getValue("foo") returns "a"
pi.getValue("bar") returns ""
What should pi.getValue("bogus") return?

And given the PI:

<?targ quux="a" bar?>

What should pi.getValue("quux") return?

Current answers are "" and "".  I'm wondering if they should be null and
null to better match Attribute behavior.  Before we change it, I'm
looking for logical reasons why it's best one way or the other.

FYI, I don't want pi.getValue("quux") to return "a" because I think if
the PI's data doesn't parse completely as attributes then it shouldn't
be treated as attributes.  To do anything more fancy has the potential
to appear nondeterministic.

To control your jdom-interest membership:

To control your jdom-interest membership:

More information about the jdom-interest mailing list