Possible to get line number of node?
Wednesday, 21 December 2022 · 7 messages · last reply 22 Dec 2022
EK
Eliot Kimber21 Dec 2022 23:13 #
I’m pretty sure the answer is “no”, but is there any way from BaseX 9.6 to get the source line number a given node starts on?
My use case is I’m looking for specific elements and making a report of documents that contain them and identifying information about the elements to help with finding them outside of BaseX (i.e., in Oxygen where the authoring happens). I’m parsing with the “trim whitespace” option turned off and I’m not doing any DTD-aware parsing, so the elements as loaded into the database will match the source (no additional attributes or anything). So at least in theory BaseX could maintain accurate line numbers.
These elements don’t have @id attributes so no natural way to identify them, so it would be useful to be able to report the source line number as a guide to people fixing these elements.
I didn’t see anything in the docs so I thought I’d ask just in case I’ve missed some trick.
Thanks,
E.
_____________________________________________
Eliot Kimber
Sr Staff Content Engineer
O: 512 554 9368
M: 512 554 9368
servicenow.com<https://www.servicenow.com>
LinkedIn<https://www.linkedin.com/company/servicenow> | Twitter<https://twitter.com/servicenow> | YouTube<https://www.youtube.com/user/servicenowinc> | Facebook<https://www.facebook.com/servicenow>
ZD
Zimmel, Daniel22 Dec 2022 11:21 #
I can’t answer anything helpful for the reliability of line numbers, but can tell you how we are doing this in a similar use case: we make use of what Oxygen calls “simplified XPath index path” (https://www.oxygenxml.com/doc/versions/25.0/ug-editor/topics/opening-document-from-cli.html)
Roughly:
* we write out that path (“#element(1/2/6/15)”) to a Schematron diagnostics element
* in our frontend to Schemaron we generate a button which will take you directly to Oxygen
So, if you don’t have to care about other editors than Oxygen, this might be a simple and reliable way. At least to us, works like a charm.
Best, Daniel
Quoted text · BaseX-Talk · 16 lines
Von: BaseX-Talk <basex-talk-bounces at mailman.uni-konstanz.de> Im Auftrag von Eliot Kimber Gesendet: Mittwoch, 21. Dezember 2022 23:14 An: basex-talk at mailman.uni-konstanz.de Betreff: [basex-talk] Possible to get line number of node? I’m pretty sure the answer is “no”, but is there any way from BaseX 9.6 to get the source line number a given node starts on? My use case is I’m looking for specific elements and making a report of documents that contain them and identifying information about the elements to help with finding them outside of BaseX (i.e., in Oxygen where the authoring happens). I’m parsing with the “trim whitespace” option turned off and I’m not doing any DTD-aware parsing, so the elements as loaded into the database will match the source (no additional attributes or anything). So at least in theory BaseX could maintain accurate line numbers. These elements don’t have @id attributes so no natural way to identify them, so it would be useful to be able to report the source line number as a guide to people fixing these elements. I didn’t see anything in the docs so I thought I’d ask just in case I’ve missed some trick. Thanks, E. Eliot Kimber Sr Staff Content Engineer O: 512 554 9368 M: 512 554 9368 servicenow.com<https://www.servicenow.com> LinkedIn<https://www.linkedin.com/company/servicenow> | Twitter<https://twitter.com/servicenow> | YouTube<https://www.youtube.com/user/servicenowinc> | Facebook<https://www.facebook.com/servicenow>
EK
Eliot Kimber22 Dec 2022 15:01 #
Interesting—I did not know Oxygen provided this option.
I’m wondering what I could put in an Excel spreadsheet that would make this work on a user’s machine…
Cheers,
E.
_____________________________________________
Eliot Kimber
Sr Staff Content Engineer
O: 512 554 9368
M: 512 554 9368
servicenow.com<https://www.servicenow.com>
LinkedIn<https://www.linkedin.com/company/servicenow> | Twitter<https://twitter.com/servicenow> | YouTube<https://www.youtube.com/user/servicenowinc> | Facebook<https://www.facebook.com/servicenow>
Quoted text · Zimmel, Daniel · 28 lines
From: Zimmel, Daniel <D.Zimmel at ESVmedien.de> Date: Thursday, December 22, 2022 at 4:21 AM To: Eliot Kimber <eliot.kimber at servicenow.com>, basex-talk at mailman.uni-konstanz.de <basex-talk at mailman.uni-konstanz.de> Subject: AW: Possible to get line number of node? [External Email] I can’t answer anything helpful for the reliability of line numbers, but can tell you how we are doing this in a similar use case: we make use of what Oxygen calls “simplified XPath index path” (https://www.oxygenxml.com/doc/versions/25.0/ug-editor/topics/opening-document-from-cli.html<https://www.oxygenxml.com/doc/versions/25.0/ug-editor/topics/opening-document-from-cli.html>) Roughly: * we write out that path (“#element(1/2/6/15)”) to a Schematron diagnostics element * in our frontend to Schemaron we generate a button which will take you directly to Oxygen So, if you don’t have to care about other editors than Oxygen, this might be a simple and reliable way. At least to us, works like a charm. Best, Daniel Von: BaseX-Talk <basex-talk-bounces at mailman.uni-konstanz.de> Im Auftrag von Eliot Kimber Gesendet: Mittwoch, 21. Dezember 2022 23:14 An: basex-talk at mailman.uni-konstanz.de Betreff: [basex-talk] Possible to get line number of node? I’m pretty sure the answer is “no”, but is there any way from BaseX 9.6 to get the source line number a given node starts on? My use case is I’m looking for specific elements and making a report of documents that contain them and identifying information about the elements to help with finding them outside of BaseX (i.e., in Oxygen where the authoring happens). I’m parsing with the “trim whitespace” option turned off and I’m not doing any DTD-aware parsing, so the elements as loaded into the database will match the source (no additional attributes or anything). So at least in theory BaseX could maintain accurate line numbers. These elements don’t have @id attributes so no natural way to identify them, so it would be useful to be able to report the source line number as a guide to people fixing these elements. I didn’t see anything in the docs so I thought I’d ask just in case I’ve missed some trick. Thanks, E. Eliot Kimber Sr Staff Content Engineer O: 512 554 9368 M: 512 554 9368 servicenow.com<https://www.servicenow.com> LinkedIn<https://www.linkedin.com/company/servicenow> | Twitter<https://twitter.com/servicenow> | YouTube<https://www.youtube.com/user/servicenowinc> | Facebook<https://www.facebook.com/servicenow>
ZD
Zimmel, Daniel22 Dec 2022 17:14 #
If you are allowed to include macros, there should be a way to use some VBA scripting for providing a launcher for Oxygen... but you don’t want to ask me about VBA :-)
Over here we run a self-built NodeJS-webapp, where we can display an “Open in Oxygen” button next to the message.
Quoted text · Eliot Kimber · 42 lines
Von: Eliot Kimber <eliot.kimber at servicenow.com> Gesendet: Donnerstag, 22. Dezember 2022 15:01 An: Zimmel, Daniel <D.Zimmel at ESVmedien.de>; basex-talk at mailman.uni-konstanz.de Betreff: Re: Possible to get line number of node? Interesting—I did not know Oxygen provided this option. I’m wondering what I could put in an Excel spreadsheet that would make this work on a user’s machine… Cheers, E. Eliot Kimber Sr Staff Content Engineer O: 512 554 9368 M: 512 554 9368 servicenow.com<https://www.servicenow.com> LinkedIn<https://www.linkedin.com/company/servicenow> | Twitter<https://twitter.com/servicenow> | YouTube<https://www.youtube.com/user/servicenowinc> | Facebook<https://www.facebook.com/servicenow> From: Zimmel, Daniel <D.Zimmel at ESVmedien.de<mailto:D.Zimmel at ESVmedien.de>> Date: Thursday, December 22, 2022 at 4:21 AM To: Eliot Kimber <eliot.kimber at servicenow.com<mailto:eliot.kimber at servicenow.com>>, basex-talk at mailman.uni-konstanz.de<mailto:basex-talk at mailman.uni-konstanz.de> <basex-talk at mailman.uni-konstanz.de<mailto:basex-talk at mailman.uni-konstanz.de>> Subject: AW: Possible to get line number of node? [External Email] I can’t answer anything helpful for the reliability of line numbers, but can tell you how we are doing this in a similar use case: we make use of what Oxygen calls “simplified XPath index path” (https://www.oxygenxml.com/doc/versions/25.0/ug-editor/topics/opening-document-from-cli.html) Roughly: * we write out that path (“#element(1/2/6/15)”) to a Schematron diagnostics element * in our frontend to Schemaron we generate a button which will take you directly to Oxygen So, if you don’t have to care about other editors than Oxygen, this might be a simple and reliable way. At least to us, works like a charm. Best, Daniel Von: BaseX-Talk <basex-talk-bounces at mailman.uni-konstanz.de<mailto:basex-talk-bounces at mailman.uni-konstanz.de>> Im Auftrag von Eliot Kimber Gesendet: Mittwoch, 21. Dezember 2022 23:14 An: basex-talk at mailman.uni-konstanz.de<mailto:basex-talk at mailman.uni-konstanz.de> Betreff: [basex-talk] Possible to get line number of node? I’m pretty sure the answer is “no”, but is there any way from BaseX 9.6 to get the source line number a given node starts on? My use case is I’m looking for specific elements and making a report of documents that contain them and identifying information about the elements to help with finding them outside of BaseX (i.e., in Oxygen where the authoring happens). I’m parsing with the “trim whitespace” option turned off and I’m not doing any DTD-aware parsing, so the elements as loaded into the database will match the source (no additional attributes or anything). So at least in theory BaseX could maintain accurate line numbers. These elements don’t have @id attributes so no natural way to identify them, so it would be useful to be able to report the source line number as a guide to people fixing these elements. I didn’t see anything in the docs so I thought I’d ask just in case I’ve missed some trick. Thanks, E. Eliot Kimber Sr Staff Content Engineer O: 512 554 9368 M: 512 554 9368 servicenow.com<https://www.servicenow.com> LinkedIn<https://www.linkedin.com/company/servicenow> | Twitter<https://twitter.com/servicenow> | YouTube<https://www.youtube.com/user/servicenowinc> | Facebook<https://www.facebook.com/servicenow>
CG
We don’t store any node locations in the database, that’s correct.
fn:path may be helpful to generate the Oxygen node path.Quoted text · Daniel · 62 lines
On Thu, Dec 22, 2022 at 11:21 AM Zimmel, Daniel <D.Zimmel at esvmedien.de> wrote: > > I can’t answer anything helpful for the reliability of line numbers, but can tell you how we are doing this in a similar use case: > > we make use of what Oxygen calls “simplified XPath index path” (https://www.oxygenxml.com/doc/versions/25.0/ug-editor/topics/opening-document-from-cli.html) > > > > Roughly: > > * we write out that path (“#element(1/2/6/15)”) to a Schematron diagnostics element > > * in our frontend to Schemaron we generate a button which will take you directly to Oxygen > > > > So, if you don’t have to care about other editors than Oxygen, this might be a simple and reliable way. At least to us, works like a charm. > > > > Best, Daniel > > > > Von: BaseX-Talk <basex-talk-bounces at mailman.uni-konstanz.de> Im Auftrag von Eliot Kimber > Gesendet: Mittwoch, 21. Dezember 2022 23:14 > An: basex-talk at mailman.uni-konstanz.de > Betreff: [basex-talk] Possible to get line number of node? > > > > I’m pretty sure the answer is “no”, but is there any way from BaseX 9.6 to get the source line number a given node starts on? > > My use case is I’m looking for specific elements and making a report of documents that contain them and identifying information about the elements to help with finding them outside of BaseX (i.e., in Oxygen where the authoring happens). I’m parsing with the “trim whitespace” option turned off and I’m not doing any DTD-aware parsing, so the elements as loaded into the database will match the source (no additional attributes or anything). So at least in theory BaseX could maintain accurate line numbers. > > These elements don’t have @id attributes so no natural way to identify them, so it would be useful to be able to report the source line number as a guide to people fixing these elements. > > > > I didn’t see anything in the docs so I thought I’d ask just in case I’ve missed some trick. > > > > Thanks, > > > > E. > > _____________________________________________ > > Eliot Kimber > > Sr Staff Content Engineer > > O: 512 554 9368 > > M: 512 554 9368 > > servicenow.com > > LinkedIn | Twitter | YouTube | Facebook
EK
Eliot Kimber22 Dec 2022 17:37 #
In our Mirabel web application I generate an “Open in Oxygen” button for all the maps and topics where appropriate (although we haven’t yet implemented named users so it’s not quite ready for use).
This current challenge is where I’m generating a CSV file as a one-off report using BaseX locally and then just providing the resulting spreadsheet to the user who requested the report.
Excel macros is not an option for me.
I suppose I could just generate the command line value to be pasted into a terminal—that should work, if not maximally convenient for the user.
Cheers,
E.
_____________________________________________
Eliot Kimber
Sr Staff Content Engineer
O: 512 554 9368
M: 512 554 9368
servicenow.com<https://www.servicenow.com>
LinkedIn<https://www.linkedin.com/company/servicenow> | Twitter<https://twitter.com/servicenow> | YouTube<https://www.youtube.com/user/servicenowinc> | Facebook<https://www.facebook.com/servicenow>
Quoted text · Christian Grün · 70 lines
From: Christian Grün <christian.gruen at gmail.com> Date: Thursday, December 22, 2022 at 10:20 AM To: Zimmel, Daniel <D.Zimmel at ESVmedien.de> Cc: Eliot Kimber <eliot.kimber at servicenow.com>, basex-talk at mailman.uni-konstanz.de <basex-talk at mailman.uni-konstanz.de> Subject: Re: [basex-talk] Possible to get line number of node? [External Email] We don’t store any node locations in the database, that’s correct. fn:path may be helpful to generate the Oxygen node path. On Thu, Dec 22, 2022 at 11:21 AM Zimmel, Daniel <D.Zimmel at esvmedien.de> wrote: > > I can’t answer anything helpful for the reliability of line numbers, but can tell you how we are doing this in a similar use case: > > we make use of what Oxygen calls “simplified XPath index path” (https://www.oxygenxml.com/doc/versions/25.0/ug-editor/topics/opening-document-from-cli.html<https://www.oxygenxml.com/doc/versions/25.0/ug-editor/topics/opening-document-from-cli.html>) > > > > Roughly: > > * we write out that path (“#element(1/2/6/15)”) to a Schematron diagnostics element > > * in our frontend to Schemaron we generate a button which will take you directly to Oxygen > > > > So, if you don’t have to care about other editors than Oxygen, this might be a simple and reliable way. At least to us, works like a charm. > > > > Best, Daniel > > > > Von: BaseX-Talk <basex-talk-bounces at mailman.uni-konstanz.de> Im Auftrag von Eliot Kimber > Gesendet: Mittwoch, 21. Dezember 2022 23:14 > An: basex-talk at mailman.uni-konstanz.de > Betreff: [basex-talk] Possible to get line number of node? > > > > I’m pretty sure the answer is “no”, but is there any way from BaseX 9.6 to get the source line number a given node starts on? > > My use case is I’m looking for specific elements and making a report of documents that contain them and identifying information about the elements to help with finding them outside of BaseX (i.e., in Oxygen where the authoring happens). I’m parsing with the “trim whitespace” option turned off and I’m not doing any DTD-aware parsing, so the elements as loaded into the database will match the source (no additional attributes or anything). So at least in theory BaseX could maintain accurate line numbers. > > These elements don’t have @id attributes so no natural way to identify them, so it would be useful to be able to report the source line number as a guide to people fixing these elements. > > > > I didn’t see anything in the docs so I thought I’d ask just in case I’ve missed some trick. > > > > Thanks, > > > > E. > > _____________________________________________ > > Eliot Kimber > > Sr Staff Content Engineer > > O: 512 554 9368 > > M: 512 554 9368 > > servicenow.com > > LinkedIn | Twitter | YouTube | Facebook
BD
Bridger Dyson-Smith22 Dec 2022 22:08 #
Hi Eliot,
Apologies for the mobile guesswork, but what about serializing a temporary document to look up line number? I'm probably missing something obvious and/or misunderstanding your challenge, but if I'm not it seems like a temporary document (in memory? On the filesystem?) might let you get at the appropriate line numbers.
In any case, good luck!
Best wishes,
Bridger
Quoted text · Eliot Kimber · 142 lines
On Thu, Dec 22, 2022, 11:38 AM Eliot Kimber <eliot.kimber at servicenow.com> wrote: > In our Mirabel web application I generate an “Open in Oxygen” button for > all the maps and topics where appropriate (although we haven’t yet > implemented named users so it’s not quite ready for use). > > > > This current challenge is where I’m generating a CSV file as a one-off > report using BaseX locally and then just providing the resulting > spreadsheet to the user who requested the report. > > > > Excel macros is not an option for me. > > > > I suppose I could just generate the command line value to be pasted into a > terminal—that should work, if not maximally convenient for the user. > > > > Cheers, > > > > E. > > _____________________________________________ > > *Eliot Kimber* > > Sr Staff Content Engineer > > O: 512 554 9368 > > M: 512 554 9368 > > servicenow.com <https://www.servicenow.com> > > LinkedIn <https://www.linkedin.com/company/servicenow> | Twitter > <https://twitter.com/servicenow> | YouTube > <https://www.youtube.com/user/servicenowinc> | Facebook > <https://www.facebook.com/servicenow> > > > > *From: *Christian Grün <christian.gruen at gmail.com> > *Date: *Thursday, December 22, 2022 at 10:20 AM > *To: *Zimmel, Daniel <D.Zimmel at ESVmedien.de> > *Cc: *Eliot Kimber <eliot.kimber at servicenow.com>, > basex-talk at mailman.uni-konstanz.de <basex-talk at mailman.uni-konstanz.de> > *Subject: *Re: [basex-talk] Possible to get line number of node? > > [External Email] > > We don’t store any node locations in the database, that’s correct. > fn:path may be helpful to generate the Oxygen node path. > > > On Thu, Dec 22, 2022 at 11:21 AM Zimmel, Daniel <D.Zimmel at esvmedien.de> > wrote: > > > > I can’t answer anything helpful for the reliability of line numbers, but > can tell you how we are doing this in a similar use case: > > > > we make use of what Oxygen calls “simplified XPath index path” ( > https://www.oxygenxml.com/doc/versions/25.0/ug-editor/topics/opening-document-from-cli.html > ) > > > > > > > > Roughly: > > > > * we write out that path (“#element(1/2/6/15)”) to a Schematron > diagnostics element > > > > * in our frontend to Schemaron we generate a button which will take you > directly to Oxygen > > > > > > > > So, if you don’t have to care about other editors than Oxygen, this > might be a simple and reliable way. At least to us, works like a charm. > > > > > > > > Best, Daniel > > > > > > > > Von: BaseX-Talk <basex-talk-bounces at mailman.uni-konstanz.de> Im Auftrag > von Eliot Kimber > > Gesendet: Mittwoch, 21. Dezember 2022 23:14 > > An: basex-talk at mailman.uni-konstanz.de > > Betreff: [basex-talk] Possible to get line number of node? > > > > > > > > I’m pretty sure the answer is “no”, but is there any way from BaseX 9.6 > to get the source line number a given node starts on? > > > > My use case is I’m looking for specific elements and making a report of > documents that contain them and identifying information about the elements > to help with finding them outside of BaseX (i.e., in Oxygen where the > authoring happens). I’m parsing with the “trim whitespace” option turned > off and I’m not doing any DTD-aware parsing, so the elements as loaded into > the database will match the source (no additional attributes or anything). > So at least in theory BaseX could maintain accurate line numbers. > > > > These elements don’t have @id attributes so no natural way to identify > them, so it would be useful to be able to report the source line number as > a guide to people fixing these elements. > > > > > > > > I didn’t see anything in the docs so I thought I’d ask just in case I’ve > missed some trick. > > > > > > > > Thanks, > > > > > > > > E. > > > > _____________________________________________ > > > > Eliot Kimber > > > > Sr Staff Content Engineer > > > > O: 512 554 9368 > > > > M: 512 554 9368 > > > > servicenow.com > > > > LinkedIn | Twitter | YouTube | Facebook >
Written for BaseX 10.4. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery