Update of arbitrarily selected elements?
Friday, 31 May 2019 · 3 messages · last reply 3 Jun 2019
JK
Joshua Kordani31 May 2019 20:14 #
Greetings all.
I am curious about how basex supports the idea of modifying any given (or set of given) elements, say a user makes a query to select a bunch of elements for editing and wishes to add an attribute to an arbitrary subset (as in, not selectable with a query), how do I reference a particular element for later updating?
Sincerely,
Josh
DISCLAIMER: This email communication and any attached files are Speedcast Wireless proprietary and may be legally privileged. Export-controlled information shall not be disseminated without proper authorization and proper export-control markings, per Speedcast Wireless export policy. If you have received this transmission in error please notify the sender immediately and then delete this email and all its attachments. If you are not the addressee, any disclosure, reproduction, copying, distribution, or any other dissemination or use of this communication is strictly prohibited. Thank you.
MS
Michael Seiferle3 Jun 2019 09:46 #
Hi Josh,
I think the most widely used approach would be addressing items via ID — just as you would in a traditional database approach — this might involve adding IDs to all elements.
Quoted text · Joshua Kordani · 1 line
>> (as in, not selectable with a query)
With XPath you can select arbitrary parts of your document, maybe using XPath expressions would be helpful?
Hope this helps a bit, feel free to ask for more specific information :)
Best
Michael
Quoted text · Joshua Kordani · 8 lines
> Am 31.05.2019 um 20:14 schrieb Joshua Kordani <joshua.kordani at speedcastwireless.com>: > > Greetings all. > > I am curious about how basex supports the idea of modifying any given (or set of given) elements, say a user makes a query to select a bunch of elements for editing and wishes to add an attribute to an arbitrary subset (as in, not selectable with a query), how do I reference a particular element for later updating? > > Sincerely, > Josh
ML
Marco Lettere3 Jun 2019 09:49 #
Yes. In addition, if you don't have IDs in place and elements are all in the same container, you could maybe use their position. Or a combination of an XPAT selector for the contianer root and then a sequence of positions for the elements to be updated.
M.
Quoted text · Michael Seiferle · 37 lines
On 03/06/19 09:46, Michael Seiferle wrote: > Hi Josh, > > I think the most widely used approach would be addressing items via ID > — just as you would in a traditional database approach — this might > involve adding IDs to all elements. > >>> (as in, not selectable with a query) > With XPath you can select arbitrary parts of your document, maybe > using XPath expressions would be helpful? > > > Hope this helps a bit, feel free to ask for more specific information :) > > Best > > Michael > > > > > > > >> Am 31.05.2019 um 20:14 schrieb Joshua Kordani >> <joshua.kordani at speedcastwireless.com >> <mailto:joshua.kordani at speedcastwireless.com>>: >> >> Greetings all. >> I am curious about how basex supports the idea of modifying any given >> (or set of given) elements, say a user makes a query to select a >> bunch of elements for editing and wishes to add an attribute to an >> arbitrary subset (as in, not selectable with a query), how do I >> reference a particular element for later updating? >> Sincerely, >> Josh >
Written for BaseX 9.2. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery