* accessing xml element attributes in lua, how, if you do not want to use the .at scheme?
@ 2020-06-09 13:31 Gerben Wierda
2020-06-09 13:43 ` mf
0 siblings, 1 reply; 2+ messages in thread
From: Gerben Wierda @ 2020-06-09 13:31 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 577 bytes --]
I’ve been trying to find out how I can access XML node properties/attributes in lua other than via the .at syntactic scheme but using the property/attribute name as a string.
E.g., currently I do:
someVar = someNode.at.someProperty
but I would like to do something like
someVar = someNode[“someProperty”] or someNode.attribute(“someProperty”) or something where I can use the string version of the properties/attribute name.
It’s probably possible (after all these are all dynamic structures that come from data), but how exactly?
Thanks,
G
[-- Attachment #1.2: Type: text/html, Size: 1168 bytes --]
[-- Attachment #2: Type: text/plain, Size: 493 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: accessing xml element attributes in lua, how, if you do not want to use the .at scheme?
2020-06-09 13:31 accessing xml element attributes in lua, how, if you do not want to use the .at scheme? Gerben Wierda
@ 2020-06-09 13:43 ` mf
0 siblings, 0 replies; 2+ messages in thread
From: mf @ 2020-06-09 13:43 UTC (permalink / raw)
To: ntg-context
Il 09/06/20 15:31, Gerben Wierda ha scritto:
> I’ve been trying to find out how I can access XML node
> properties/attributes in lua other than via the .at syntactic scheme but
> using the property/attribute name as a string.
>
> E.g., currently I do:
>
> someVar = someNode.at.someProperty
>
> but I would like to do something /like/
>
> someVar = someNode[“someProperty”] or someNode.attribute(“someProperty”)
> or something where I can use the string version of the
> properties/attribute name.
>
> It’s probably possible (after all these are all dynamic structures that
> come from data), but how exactly?
>
local prop = "someProperty"
someVar = someNode.at[ prop ]
Massi
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-09 13:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-09 13:31 accessing xml element attributes in lua, how, if you do not want to use the .at scheme? Gerben Wierda
2020-06-09 13:43 ` mf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).