Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I use XPath with a default namespace with no prefix?
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. COIt is not clear what you want to achieve exactly. What are the criteria that determine which nodes you are looking for? Are you looking for elements based on their namespace? In that case your code would know the namespace. As for {my uri} being "XPath syntax", where in the XPath 1.0 specification do you think has that syntax been defined? And whether you put the namespace URI in curly brackets or pass the namespace URI to the AddNamespace method shouldn't matter to your C# code, in both cases the namespace URI needs to be available as a string.
      singulars
    2. CO@Martin: I do want to specify the namespace in the XPath, but I have only the namespace URI and no namespace prefix. I looked closer into where I 'invented' the {} from and I might have skimmed incorrectly... I got it from this reference: http://www.jclark.com/xml/xmlns.htm. Thanks for pointing that out. Of course, even if it's not valid, it seems like a useful thing to be able to do easily.. ;)
      singulars
    3. COScott, you will need to choose any allowed prefix you like, associate it with the namespace URI you have using AddNamespace(prefix, namespaceURI), and use the choosen prefix in your XPath expression. That is how XPath works, at least XPath 1.0. The prefix does not have to exist in the input XML at all or can be different to one used in the input XML, the element selection will happen based on the namespace match, not the prefix.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload