Hmmm.. no namespace is to be considered default
http://www.w3.org/TR/REC-xml-names/
5.2 Namespace Defaulting
A default namespace is considered to apply to the element where it is
declared (if that element has no namespace prefix), and to all
elements with no prefix within the content of that element. If the
URI reference in a default namespace declaration is empty, then
unprefixed elements in the scope of the declaration are not
considered to be in any namespace. Note that default namespaces do
not apply directly to attributes.
I still find it quite interesting why x-path didn't squack on the 5
lines of @DOM inserts without namespace designation and then when I
add one with namespace, it then squacked about the 5 previous inserts.
I'll give that a whirl
Ben
On Jun 11, 2006, at 5:34 AM, Phil Wade wrote:
What good is the <@dom if you can't build xml on the fly? I was
working with Ben on this, and we couldn't find any way to build
with the dom, only by hand. Even pulling in a template into the dom
first.
Actually @DOM is very good when you are using the correct XPath
expression. I believe we covered this ground back in April.
No tricks. No bugs. It is all about the correct XPath statement and
namespace reference, in this case the default namespace.
Try this:
<@assign request$thexml <@dom '<rss xmlns:itunes="http://
www.itunes.com/dtds/podcast-1.0.dtd" version="2.0"></rss>'>>
<@dominsert request$thexml xpath="/*[local-name()='rss' and namespace-
uri()='']">
<channel></channel>
</@dominsert>
<@VAR request$thexml encoding="HTML">
And yes I agree with you, XPath expressions especially with
namespaces can be very frustrating. The more you use them the better
you get.
BTW, this has nothing to do with validation or parsing of the XML or
how DOM is implemented. This is just XPath.
Regards
Phil
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf