Hi,

I've been working on a Jaxen Navigator for a library I'm working on. 
The library is for Jabber (http://www.jabber.org), and I have a question
on the way the default namespace is handled.

First, some background.  Jabber is basically a continuous stream of XML,
and uses namespaces everywhere.  For all practical purposes,
"everything" encountered in a Jabber XML stream is namespaced.

So, given the following (full document example) XML:

<stream:stream xmlns:stream='http://etherx.jabber.org/streams'
xmlns='jabber:client' from='outer-planes.net' id='someid'>
  <message from='[EMAIL PROTECTED]/jso-bot'
to='[EMAIL PROTECTED]' type='chat'>
    <thread>12345678</thread>
    <body>This is a test</body>
    <x xmlns='jabber:x:oob'>
      <desc>Test URL</desc>
      <url>http://slashdot.org</url>
    </x>
  </message>
</stream:stream>

I tried to use the XPath "/message/body", and got back nothing (which I
expected).

When I tried setting a mapping for the prefix "" (which is the only way
I see to specify the default namespace) in the NamespaceContext (via
XPath.addNamespace(prefix, uri)), I still got back nothing.

Looking at the code for 1.0-FCS, there seems to be no attempt to even
resolve a default namespace, other than changing the expression to
something like the following:

/*[(local-name()='message')and(namespace-uri()='jabber:client')]/*[(local-name()='body')and(namespace-uri()='jabber:client')]

Which, after talking to a few of my users, would be considered
unacceptable.

I guess what I'm ultimately asking is if there's any plans to specify
and resolve to the default namespace.

I made a hack to the FCS code to look for a namespace URI for the prefix
"", and modified my FunctionContext and VariableContext to "fall-back"
to a null namespace if their lookups fail.  I have a very deep suspicion
I'm going about this all wrong.


Any advice would be greatly appreciative,

-- 

Matt "Linuxwolf" Miller

- Got "JABBER"? (http://www.jabbercentral.org/)

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to