<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: PHP Trivia Contest: DOM + Default Namespaces</title>
	<atom:link href="http://www.trachtenberg.com/blog/2006/09/26/php-trivia-contest-dom-default-namespaces/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.trachtenberg.com/blog/2006/09/26/php-trivia-contest-dom-default-namespaces/</link>
	<description>Thoughts on PHP, eBay, and too many technical topics for my family's liking.</description>
	<lastBuildDate>Tue, 29 Mar 2011 16:05:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: StephenB</title>
		<link>http://www.trachtenberg.com/blog/2006/09/26/php-trivia-contest-dom-default-namespaces/comment-page-1/#comment-183764</link>
		<dc:creator>StephenB</dc:creator>
		<pubDate>Sat, 12 Jan 2008 18:48:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.trachtenberg.com/blog/2006/09/26/php-trivia-contest-dom-default-namespaces/#comment-183764</guid>
		<description>xmlns is not the prefix name. It is the default namespace identifier. Which in case of the default namespace has an empty prefix. So getAttributeNS(â€™http://www.w3.org/2000/xmlns/â€™,â€) would work, as it should. If the namespace was xmlns:prefix then correctly, &#039;prefix&#039; would be the argument to getAttributeNS.

The php5 DOM implementation is a leap over php4 and I&#039;m looking forward to namespace implementation in php5.3+ &amp; php6.

Not perfect though, Just logged a bug for createAttributeNS.
S</description>
		<content:encoded><![CDATA[<p>xmlns is not the prefix name. It is the default namespace identifier. Which in case of the default namespace has an empty prefix. So getAttributeNS(â€™http://www.w3.org/2000/xmlns/â€™,â€) would work, as it should. If the namespace was xmlns:prefix then correctly, &#8216;prefix&#8217; would be the argument to getAttributeNS.</p>
<p>The php5 DOM implementation is a leap over php4 and I&#8217;m looking forward to namespace implementation in php5.3+ &amp; php6.</p>
<p>Not perfect though, Just logged a bug for createAttributeNS.<br />
S</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Sklar</title>
		<link>http://www.trachtenberg.com/blog/2006/09/26/php-trivia-contest-dom-default-namespaces/comment-page-1/#comment-13655</link>
		<dc:creator>David Sklar</dc:creator>
		<pubDate>Wed, 27 Sep 2006 17:15:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.trachtenberg.com/blog/2006/09/26/php-trivia-contest-dom-default-namespaces/#comment-13655</guid>
		<description>Ooh, that&#039;s kooky. I can see why getAttributeNS(â€™http://www.w3.org/2000/xmlns/â€™,&#039;&#039;) works over &#039;xmlns&#039; as the second argument -- if &#039;xmlns&#039; is the &quot;namespace prefix&quot;, as it is obviously with something like xmlns:pants=&quot;http://whatever/&quot;. you&#039;d want to call getAttributeNS(â€™http://www.w3.org/2000/xmlns/â€™,&#039;pants&#039;), but the special case of prefix-but-no-localname is weird.
</description>
		<content:encoded><![CDATA[<p>Ooh, that&#8217;s kooky. I can see why getAttributeNS(â€™http://www.w3.org/2000/xmlns/â€™,&#8221;) works over &#8216;xmlns&#8217; as the second argument &#8212; if &#8216;xmlns&#8217; is the &#8220;namespace prefix&#8221;, as it is obviously with something like xmlns:pants=&#8221;http://whatever/&#8221;. you&#8217;d want to call getAttributeNS(â€™http://www.w3.org/2000/xmlns/â€™,&#8217;pants&#8217;), but the special case of prefix-but-no-localname is weird.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam Trachtenberg</title>
		<link>http://www.trachtenberg.com/blog/2006/09/26/php-trivia-contest-dom-default-namespaces/comment-page-1/#comment-13647</link>
		<dc:creator>Adam Trachtenberg</dc:creator>
		<pubDate>Wed, 27 Sep 2006 15:51:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.trachtenberg.com/blog/2006/09/26/php-trivia-contest-dom-default-namespaces/#comment-13647</guid>
		<description>Yea, XPath is cheating. That&#039;s why I called out getAttributeNS().

But you&#039;re close enough, as:

getAttributeNS(â€™http://www.w3.org/2000/xmlns/â€™,&#039;&#039;)

Does work. However, I&#039;m not sure if it&#039;s supposed to. :)</description>
		<content:encoded><![CDATA[<p>Yea, XPath is cheating. That&#8217;s why I called out getAttributeNS().</p>
<p>But you&#8217;re close enough, as:</p>
<p>getAttributeNS(â€™http://www.w3.org/2000/xmlns/â€™,&#8221;)</p>
<p>Does work. However, I&#8217;m not sure if it&#8217;s supposed to. :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Sklar</title>
		<link>http://www.trachtenberg.com/blog/2006/09/26/php-trivia-contest-dom-default-namespaces/comment-page-1/#comment-13605</link>
		<dc:creator>David Sklar</dc:creator>
		<pubDate>Wed, 27 Sep 2006 02:10:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.trachtenberg.com/blog/2006/09/26/php-trivia-contest-dom-default-namespaces/#comment-13605</guid>
		<description>I suppose it&#039;s cheating to suggest:

[code]
$xpath = new DOMXPath($xml);
echo $xpath-&gt;query(&#039;/*[local-name(.)=&quot;r&quot;]&#039;)-&gt;item(0)-&gt;namespaceURI;
[code]

Section 3 of http://www.w3.org/TR/xml-names/ says:

The prefix xmlns is used only to declare namespace bindings and is by definition bound to the namespace name http://www.w3.org/2000/xmlns/.

Which implies that:

$xml-&gt;documentElement-&gt;getAttributeNS(&#039;http://www.w3.org/2000/xmlns/&#039;,&#039;xmlns&#039;) should work, but it doesn&#039;t.

</description>
		<content:encoded><![CDATA[<p>I suppose it&#8217;s cheating to suggest:</p>
<p>[code]<br />
$xpath = new DOMXPath($xml);<br />
echo $xpath-&gt;query('/*[local-name(.)="r"]')-&gt;item(0)-&gt;namespaceURI;<br />
[code]</p>
<p>Section 3 of <a href="http://www.w3.org/TR/xml-names/" rel="nofollow">http://www.w3.org/TR/xml-names/</a> says:</p>
<p>The prefix xmlns is used only to declare namespace bindings and is by definition bound to the namespace name <a href="http://www.w3.org/2000/xmlns/" rel="nofollow">http://www.w3.org/2000/xmlns/</a>.</p>
<p>Which implies that:</p>
<p>$xml-&gt;documentElement-&gt;getAttributeNS('http://www.w3.org/2000/xmlns/','xmlns') should work, but it doesn't.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

