Possible bug in behavior of JSimpleXMLElement?

4 views
Skip to first unread message

Paladin

unread,
Nov 6, 2009, 6:09:37 PM11/6/09
to Joomla! Framework Development
When JSimpleXMLElement constructs an element and sets the name, it
forces lowercase.

When getElementByPath searchs for that element, it does *not* force
lowercase while searching the name.

Which means you can create an element named "Arlen" and then search by
path for "Arlen" and not find it.

This is not behavior I'd expect, but it might be wanted, nonetheless.

If this isn't the case, that should be changed either to a case-
insensitive comparison, or we should lowercase the path on entry.

I'm writing the test with mixed cases, so the test will fail, for the
moment.

Let me know which way is the desired behavior and I'll either modify
the test or submit a patch file for the code.

Paladin

unread,
Nov 6, 2009, 8:09:59 PM11/6/09
to Joomla! Framework Development
And another:

If there is data *and* children for a node in a tree passed to
toString, the data will be ignored.

When I'm done with testing this bit of code, I'll submit a patch for
the code to the tracker as well.

Paladin

unread,
Nov 11, 2009, 9:23:43 AM11/11/09
to Joomla! Framework Development
OK, since no one's weighed in on this to tell me I'm wrong, I'm
committing the test. It flags the behavior that seems wrong to me.

Andrew Eddie

unread,
Nov 16, 2009, 7:41:23 AM11/16/09
to joomla-dev...@googlegroups.com
I think we should go with case-insensitive comparison, no?

Regards,
Andrew Eddie
http://www.theartofjoomla.com - the art of becoming a Joomla developer




2009/11/12 Paladin <arlen....@gmail.com>:

Louis Landry

unread,
Nov 17, 2009, 10:48:17 AM11/17/09
to joomla-dev...@googlegroups.com
Great catch Paladin,

I wonder how many people have been frustrated with this in the last couple of years :-)

XML is case sensitive isn't it?  That being the .... case .... wouldn't we want JSimpleXML to be case sensitive as well?  I'm thinking that we most certainly shouldn't force anything to lowercase and should be matching tags as exact matches -- including case.

- Louis
--
Development Coordinator
Joomla! ... because open source matters.
http://www.joomla.org

Paladin

unread,
Nov 17, 2009, 6:03:07 PM11/17/09
to Joomla! Framework Development


On Nov 17, 9:48 am, Louis Landry <louis.lan...@joomla.org> wrote:
> Great catch Paladin,
>
> I wonder how many people have been frustrated with this in the last couple
> of years :-)
>
> XML is case sensitive isn't it?  That being the .... case .... wouldn't we
> want JSimpleXML to be case sensitive as well?  I'm thinking that we most
> certainly shouldn't force anything to lowercase and should be matching tags
> as exact matches -- including case.

XML allows a-z, A-Z, 0-9, plus three "special" chars : -, _, and .
along with special accented characters like the cedilla for I18N
support for element names. For attribute names, I'm a little foggier.

Any XML element may contain data as well as other elements, and in
fact may contain several different "batches" (for lack of a technical
term) of data with elements between them.

I can easily extend JSimpleXMLElement to encompass the first part of
that (expanding allowed element names and attribute names). the
multiple bunches of data is a little harder, so I may approach it in
two stages, grabbing the low-hanging fruit first, then coming back
later for the harder stuff.
Reply all
Reply to author
Forward
0 new messages