Possible solution to default namespace problem

View: New views
2 Messages — Rating Filter:   Alert me  

Possible solution to default namespace problem

by Gustavo Sverzut Barbieri-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I sent a mail before asking how to solve the problem with:

<doc xmlns="/space"><a>t</a></doc>

not working with XPath: /doc/a.

After some reseach I found out that it's a problem with XPath specification,
and that it's the correct behaviour
(http://mail.gnome.org/archives/xml/2002-December/msg00186.html).

As said in the thread, one must register a prefix to the default namespace by
means of xmlXPathRegisterNs(), but I cannot do that in my own program because
Gdome isolates it.

As xmlXPathRegisterNs() operates on a xmlXPathContext and it's created and
destroyed on gdome_xpeval_evaluate() (or gdome_xpath_xpeval_evaluate()), I
cannot operate on such thing.

I have some proposals to fix the problem, and require some feedback on Gdome
core developers on what's the preferred:

 * add an extra field to GdomeXPathNSResolver with the xmlXPathContext, reuse
this context later. Then add a GdomeXPathNSResolver function to bind prefixes
to URIs. This is more general approach.

 * add another function gdome_xpeval_evaluateDefaultNS( ...,
default_ns_prefix, default_ns_uri, ... ) or even avoid default_ns_uri,
looking for NS with NULL prefix. This is more hack, but will work.

 * add another function gdome_xpeval_evaluateWithNSList( ..., nsList, ... )
that gets a list of pairs of prefix and uri to use.

I would go with the first solution, but if you have any better idea, tell me
ASAP. I should have a patch to the first solution tomorrow.


--
Gustavo Sverzut Barbieri
------------------------
Instituto Nokia de Tecnologia - INdT

Jabber: barbieri@...
   MSN: barbieri@...
  ICQ#: 17249123
 Skype: gsbarbieri
Mobile: +55 (81) 9927 0010
 Phone:  +1 (347) 624 6296; 08122692@...
   GPG: 0xB640E1A2 @ wwwkeys.pgp.net
_______________________________________________
gdome mailing list
gdome@...
http://mail.gnome.org/mailman/listinfo/gdome

Re: Possible solution to default namespace problem

by Luca Padovani-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear Gustavo,

On 31/mar/06, at 01:59, Gustavo Sverzut Barbieri wrote:
> I have some proposals to fix the problem, and require some feedback  
> on Gdome
> core developers on what's the preferred:
[...]

The GDome XPath module was entirely developed by T. J. Mather and I  
am not confident enough with it to evaluate and compare your  
proposals in a competent way. I am not sure T.J. is still willing to  
maintain it the XPath module.

As far as I'm concerned, if you come up with a patch that only  
concerns the XPath module and noone objects, I'd be happy to apply it.

Thanks!

--luca
_______________________________________________
gdome mailing list
gdome@...
http://mail.gnome.org/mailman/listinfo/gdome