XML DOM problem with getAttribute(string)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hullo!

I'm having a pig of a time trying to figure this one out:  I have an
XHTML document which I've loaded into a DOMDocument because I want to
add more tags to it.  However, since I live in a bilingual country, I
want to get the document's xml:lang attribute so I know what language
to add my new tags in.

I want to write

$lang = $page->documentElement->getAttribute('xml:lang');
OR
$lang = $page->documentElement->getAttributeNS('xml', 'lang');

but both of these return empty strings, indicating that it cannot find
the xml:lang attribute.  And yet,
$page->documentElement->hasAttributes() returns true and

$page->documentElement->attributes->getNamedItem('xml:lang')->nodeValue;

works correctly.  So why doesn't my preferred code?

With thanks,

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux