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

Steven D. Keens skeens at planetfred.com
Wed Mar 14 06:34:47 PST 2001

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:

More information about the jdom-interest mailing list