Query filter by attributes with Colons

Monday, 15 July 2019 · 2 messages
MH
Martin Honnenin reply to Jordan Castillo, 15 Jul 2019, 18:3515 Jul 2019 16:38 #
Quoted text · Jordan Castillo · 20 lines
On 15.07.2019 16:34, Jordan Castillo wrote: > I am noticing that my queries aren't working when I check the value of > an attribute who has a colon in the name field. Here is an example: > > 1: Yields no results > let $begin := db:open($documentName) > return $begin//packagedElement[@name="auxiliaryResource" and > @xmi:id="_12_1_8f90291_1173963323875_662612_98"] > > 2: Yields no results > return > $begin//packagedElement[@xmi:id="_12_1_8f90291_1173963323875_662612_98"] > > 3: Yields expected result: > return $begin//packagedElement[@name="auxiliaryResource"] > > Example of element I am searching for here: > <packagedElement xsi:type="uml:Stereotype" > xmi:id="_12_1_8f90291_1173963323875_662612_98" > ID="_12_1_8f90291_1173963323875_662612_98" name="auxiliaryResource">
What is the namespace declared for the prefix xmi? You need to declare that in the XQuery code as well.
JC
Jordan Castillo15 Jul 2019 18:35 #
Hello BaseX Staff, I am noticing that my queries aren't working when I check the value of an attribute who has a colon in the name field. Here is an example: 1: Yields no results let $begin := db:open($documentName) return $begin//packagedElement[@name="auxiliaryResource" and @xmi:id="_12_1_8f90291_1173963323875_662612_98"]
2: Yields no results
  return
$begin//packagedElement[@xmi:id="_12_1_8f90291_1173963323875_662612_98"]
3: Yields expected result: return $begin//packagedElement[@name="auxiliaryResource"] Example of element I am searching for here:
<packagedElement xsi:type="uml:Stereotype"
xmi:id="_12_1_8f90291_1173963323875_662612_98"
ID="_12_1_8f90291_1173963323875_662612_98" name="auxiliaryResource">
This particular element has an "ID" attribute but most do not so checking that attribute is not an option. Any hints or tips as to how I can make this work would be greatly appreciated. Thanks! Jordan Castillo

⚡Generated with XQuery