From:             jim-bugs dot php dot net at jimdabell dot com
Operating system: FreeBSD
PHP version:      5.0.0
PHP Bug Type:     Feature/Change Request
Bug description:  SimpleXML additions

Description:
------------
Right now, I don't think it's possible to retrieve the element type name
of a simplexml_element instance.  A getElementTypeName() method would be
useful.

It would also be useful to have an easier way of retrieving the XML
language information, as described in the XML 1.0 specification.


Reproduce code:
---------------
Right now I am using a helper function like this to get xml:lang
attributes:

function getLanguage($element)
{
        /* Returns the value of any xml:lang attribute when passed an element or
null if there isn't one. */
        $language = null;
        foreach($element->attributes('http://www.w3.org/XML/1998/namespace') as
$attributeName => $attribute) {
                if ($attributeName == 'lang') {
                        $language = (string)$attribute;
                }
        }

        return $language;
}

Obviously, that's a little unwieldy, and since the xml:lang attribute is
defined in the XML 1.0 specification, it would be nice to have better
support for it in PHP.  Right now, as long as they are in the default
namespace, it's much easier to get information about arbitrary, undefined
attributes than it is about XML 1.0 standard attributes!


-- 
Edit bug report at http://bugs.php.net/?id=29243&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=29243&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=29243&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=29243&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=29243&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=29243&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=29243&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=29243&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=29243&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=29243&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=29243&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=29243&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=29243&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29243&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=29243&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=29243&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=29243&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29243&r=float

Reply via email to