Re: nodesForXPath almost always returns no objects
Re: nodesForXPath almost always returns no objects
- Subject: Re: nodesForXPath almost always returns no objects
- From: Klaus Backert <email@hidden>
- Date: Tue, 9 Jan 2007 21:27:32 +0100
Am 09.01.2007 um 16:03 schrieb Ryan Homer:
<h:table xmlns:h="http://www.w3.org/TR/html4/">
<h:tr>
<h:td>Apples</h:td>
<h:td>Bananas</h:td>
</h:tr>
</h:table
So, they are defining a namespace called "h". In my example, it is:
<FindMembershipResponse xmlns="http://www.msn.com/webservices/
AddressBook">
Does anyone know the difference? If we're not defining a new
namespace, why the xmlns tag?
Ryan
If the attribute is xmlns - and *not* xmlns: followed by an XML name
-, then the namespace name in the attribute value is that of the
default namespace in the scope to which the declaration is attached.
See <http://www.w3.org/TR/1999/REC-xml-names-19990114/>.
An example from this W3C recommendation:
<?xml version="1.0"?>
<!-- elements are in the HTML namespace, in this case by default -->
<html xmlns='http://www.w3.org/TR/REC-html40'>
<head><title>Frobnostication</title></head>
<body><p>Moved to
<a href='http://frob.com'>here</a>.</p></body>
</html>
<FindMembershipResponse xmlns="http://www.msn.com/webservices/
AddressBook">
sets the default namespace name to <http://www.msn.com/webservices/
AddressBook> (angle brackets for readability only). Then all elements
with no prefix within the content of the element
FindMembershipResponse belong to this default namespace.
Klaus
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden