On Tue, 26 Aug 2003, Robin Berjon wrote:

> When you call findnodes, you are not providing the necessary namespace
> context, which is why it works when you remove the namespace but not
> when it's there.

Allow me to rephrase to help make this painfully clear:

The xmlns= means 'put everything not explicitly qualified by a namespace
into this namespace', or if you want to put it like this 'you know,
between this tag and the corrisponding closing tag if I haven't specified
a namespace on anything rather than putting it in the empty namespace, put
it in this namespace instead'.

Now, when you're searching with XPath you're looking for the meta tag in
the empty namespace, but since the xmlns statment is in effect the meta
tag in your document isn't in there, it's in the
'http://www.w3.org/2001/vxml' namespace instead.

I'm not sure if this helps or not, but your document could be written like
this:

<?xml version="1.0" encoding="UTF-8"?>
<mynamespace:vxml xmlns:mynamespace="http://www.w3.org/2001/vxml";
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
 xsi:schemaLocation="http://www.w3.org/2001/vxml
 http://www.w3.org/TR/voicexml20/vxml.xsd"; version="2.0"
>
  <mynamespace:meta name="author" content="Toby Corkindale"/>
</mynamespace:vxml>

Note that 'name' and 'content' are still, confusingly, in the empty
namespace (as xmlns doesn't effect them.)  Qudos for Dom for drilling this
into me at a tech meet.

Hmm, I'm bound to have made a stupid mistake in this post somewhere.
Please point it out.

Mark.

-- 
#!/usr/bin/perl -T
use strict;
use warnings;
print q{Mark Fowler, [EMAIL PROTECTED], http://twoshortplanks.com/};

Reply via email to