ID:               29243
 Updated by:       [EMAIL PROTECTED]
 Reported By:      jim-bugs dot php dot net at jimdabell dot com
 Status:           Open
 Bug Type:         Feature/Change Request
 Operating System: FreeBSD
 PHP Version:      5.0.0
 New Comment:

What's getElementTypeName() supposed to return? There's no equivalent
in DOM for that... 

If you need more powerful functions/methods/properties, you should
maybe use the DOM Extension (or at least convert the node in question
to a DOMNode, with dom_import_simplexml($node)). The SimpleXML
Extension won't be extended with a lot of new methods/properties,
AFAIK. It's supposed to be simple ;) 

chregu



Previous Comments:
------------------------------------------------------------------------

[2004-07-18 12:54:14] jim-bugs dot php dot net at jimdabell dot com

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 this bug report at http://bugs.php.net/?id=29243&edit=1

Reply via email to