Hi Flibbles,

Oh now I see, thank you for your explanation! Your quote of the MDN
documentation is very telling indeed :-(

After all, writing templates dedicated to retrieving data deeply hidden in
an XML file is normally a one-time task: once written, a given path should
apply to any instance of the same schema. With the current features of your
plugin, it is already handy to write collections of such templates.

Thanks again,
-- Xavier.


On Sun, May 3, 2020 at 4:54 PM Flibbles <[email protected]>
wrote:

> Xavier, I totally agree. Having to prefix those default namespaces in your
> queries is not optimal.
>
> My last message may have given the impression that my current solution was
> my choice, but it was a choice the same way saying you quit right after
> your boss fires you is a choice. The browsers are all limited to XPath 1.0,
> and this is taken straight from the MDN documentation:
>
> XPath defines QNames without a prefix to match only elements in the null
>> namespace. There is no way in XPath to pick up the default namespace as
>> applied to a regular element reference (e.g., p[@id='_myid'] for xmlns='
>> http://www.w3.org/1999/xhtml'). To match default elements in a non-null
>> namespace, you either have to refer to a particular element using a form
>> such as ['namespace-uri()='http://www.w3.org/1999/xhtml' and name()='p'
>> and @id='_myid'] (this approach
>> <https://developer.mozilla.org/en-US/docs/Web/XPath/Introduction_to_using_XPath_in_JavaScript#Using_XPath_functions_to_reference_elements_with_a_default_namespace>
>> works well for dynamic XPath's where the namespaces might not be known) or
>> use prefixed name tests, and create a namespace resolver mapping the prefix
>> to the namespace.
>>
>
> If I wanted to allow implied default namespaces in the queries possible,
> I'd either need to dynamically remove namespaces from the XML document (my
> first few attempts at this didn't work). Or dynamically add the namespace
> prefixes to the queries (I... I really don't want to do this. This is one
> step below reimplementing XPath for myself.)
>
> I'll continue to look into ways to improve default namespace support; I'll
> try scrubbing namespaces from the DOM again, but for now, the current
> implementation may be what we get.
>
> -Flibbles
>
> --
> You received this message because you are subscribed to the Google Groups
> "TiddlyWiki" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywiki/b74da421-a4ff-45b6-8258-dd3c31d1e10f%40googlegroups.com
> <https://groups.google.com/d/msgid/tiddlywiki/b74da421-a4ff-45b6-8258-dd3c31d1e10f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/CADeSwYMc2FocNAT6US98%2BdhknSdpLg4f2bMSHXFu1KBF8sdL9A%40mail.gmail.com.

Reply via email to