ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Question about parsing XML and attributes (normally var.at.attrib) with a name with ':' in it
@ 2021-02-14 21:40 Gerben Wierda
  2021-02-14 22:11 ` Gerben Wierda
  0 siblings, 1 reply; 3+ messages in thread
From: Gerben Wierda @ 2021-02-14 21:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 487 bytes --]

If I have an XML element like this:

<A x=“one” attribute:B=“two"/>

and it has been read in a lua variable foo, I can get at attribute x with foo.at.x 

But how do I get at attribute:B?

Gerben Wierda (LinkedIn <https://www.linkedin.com/in/gerbenwierda>)
R&A Enterprise Architecture <https://ea.rna.nl/> (main site)
Book: Chess and the Art of Enterprise Architecture <https://ea.rna.nl/the-book/>
Book: Mastering ArchiMate <https://ea.rna.nl/the-book-edition-iii/>


[-- Attachment #1.2: Type: text/html, Size: 3256 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] 3+ messages in thread

* Re: Question about parsing XML and attributes (normally var.at.attrib) with a name with ':' in it
  2021-02-14 21:40 Question about parsing XML and attributes (normally var.at.attrib) with a name with ':' in it Gerben Wierda
@ 2021-02-14 22:11 ` Gerben Wierda
  2021-02-14 22:31   ` Taco Hoekwater
  0 siblings, 1 reply; 3+ messages in thread
From: Gerben Wierda @ 2021-02-14 22:11 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1692 bytes --]

foo.at[“attribute:B”]

I looked at the code and guessed this. Still haven’t found really good documentation for lua, lua in ConTeXt, and especially theXML stuff (it’s all written as \xmlsomething TeX commands. No idea if this is ConTeXt, lua or whatever but it works.

Gerben Wierda (LinkedIn <https://www.linkedin.com/in/gerbenwierda>)
R&A Enterprise Architecture <https://ea.rna.nl/> (main site)
Book: Chess and the Art of Enterprise Architecture <https://ea.rna.nl/the-book/>
Book: Mastering ArchiMate <https://ea.rna.nl/the-book-edition-iii/>

> On 14 Feb 2021, at 22:40, Gerben Wierda <gerben.wierda@rna.nl> wrote:
> 
> If I have an XML element like this:
> 
> <A x=“one” attribute:B=“two"/>
> 
> and it has been read in a lua variable foo, I can get at attribute x with foo.at <http://foo.at/>.x 
> 
> But how do I get at attribute:B?
> 
> Gerben Wierda (LinkedIn <https://www.linkedin.com/in/gerbenwierda>)
> R&A Enterprise Architecture <https://ea.rna.nl/> (main site)
> Book: Chess and the Art of Enterprise Architecture <https://ea.rna.nl/the-book/>
> Book: Mastering ArchiMate <https://ea.rna.nl/the-book-edition-iii/>
> 
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________


[-- Attachment #1.2: Type: text/html, Size: 7531 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] 3+ messages in thread

* Re: Question about parsing XML and attributes (normally var.at.attrib) with a name with ':' in it
  2021-02-14 22:11 ` Gerben Wierda
@ 2021-02-14 22:31   ` Taco Hoekwater
  0 siblings, 0 replies; 3+ messages in thread
From: Taco Hoekwater @ 2021-02-14 22:31 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2178 bytes --]

Hi Gerben,

Not behind a computer right now, but you should look at the output of 

   table.print(foo)

Best wishes,
Taco

> On 14 Feb 2021, at 23:12, Gerben Wierda <gerben.wierda@rna.nl> wrote:
> 
> 
> foo.at[“attribute:B”]
> 
> I looked at the code and guessed this. Still haven’t found really good documentation for lua, lua in ConTeXt, and especially theXML stuff (it’s all written as \xmlsomething TeX commands. No idea if this is ConTeXt, lua or whatever but it works.
> 
> Gerben Wierda (LinkedIn)
> R&A Enterprise Architecture (main site)
> Book: Chess and the Art of Enterprise Architecture
> Book: Mastering ArchiMate
> 
>> On 14 Feb 2021, at 22:40, Gerben Wierda <gerben.wierda@rna.nl> wrote:
>> 
>> If I have an XML element like this:
>> 
>> <A x=“one” attribute:B=“two"/>
>> 
>> and it has been read in a lua variable foo, I can get at attribute x with foo.at.x 
>> 
>> But how do I get at attribute:B?
>> 
>> Gerben Wierda (LinkedIn)
>> R&A Enterprise Architecture (main site)
>> Book: Chess and the Art of Enterprise Architecture
>> Book: Mastering ArchiMate
>> 
>> ___________________________________________________________________________________
>> 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
>> ___________________________________________________________________________________
> 
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________

[-- Attachment #1.2: Type: text/html, Size: 8679 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] 3+ messages in thread

end of thread, other threads:[~2021-02-14 22:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-14 21:40 Question about parsing XML and attributes (normally var.at.attrib) with a name with ':' in it Gerben Wierda
2021-02-14 22:11 ` Gerben Wierda
2021-02-14 22:31   ` Taco Hoekwater

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).