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

Jason Hunter jhunter at collab.net
Wed Mar 14 03:58:30 PST 2001


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.

-jh-



More information about the jdom-interest mailing list