ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* \xmlload not understood
@ 2017-05-12 16:00 dr. Hans van der Meer
  2017-05-15 14:22 ` Hans Hagen
  0 siblings, 1 reply; 2+ messages in thread
From: dr. Hans van der Meer @ 2017-05-12 16:00 UTC (permalink / raw)
  To: NTG ConTeXt


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

I did load an xml data file containing
  <nodes><subnode>...</subnode></nodes>
with:
  \xmlload{Data}{data.xml}

Then correctly find the number of data from \xmlcount{Data}{subnode}
however \xmlflush{Data} is not giving me the processed nodes from
  \startxmlsetups do:subnode
    doing something with xmlflysh{#1}
  \stopxmlsetups
but only the raw input <nodes><subnode>...</subnode></nodes>

Do I err in my understanding? And if so, how to do it better?

Below a minimal example and its output.



\startxmlsetups load:setups
  \xmlsetsetup{#1}{root|nodes|subnode}{load:*}
\stopxmlsetups
\xmlregistersetup{load:setups}

\startxmlsetups load:root
  \xmlloadbuffer{Data}{dataset}
  Number of <subnodes> = \xmlcount{Data}{subnode}\blank
  \xmlflush{Data}
\stopxmlsetups

\startxmlsetups load:subnode
  Content <subnode> \xmlflush{#1}\par
\stopxmlsetups

\startbuffer[test]
<?xml version="1.0" encoding="UTF-8"?>
<root></root>
\stopbuffer

\startbuffer[dataset]
<?xml version="1.0" encoding="UTF-8"?>
<nodes>
  <subnode>this is subnode-1</subnode>
  <subnode>this is subnode-2</subnode>
  <subnode>this is subnode-3</subnode>
</nodes>
\stopbuffer

\starttext
\xmlprocessbuffer{root}{test}{}
\hairline
\stoptext


[-- Attachment #1.2.1: Type: text/html, Size: 2608 bytes --]

[-- Attachment #1.2.2: subnodes.jpeg --]
[-- Type: image/jpeg, Size: 27579 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 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: \xmlload not understood
  2017-05-12 16:00 \xmlload not understood dr. Hans van der Meer
@ 2017-05-15 14:22 ` Hans Hagen
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2017-05-15 14:22 UTC (permalink / raw)
  To: ntg-context

On 5/12/2017 6:00 PM, dr. Hans van der Meer wrote:
> I did load an xml data file containing
>   <nodes><subnode>...</subnode></nodes>
> with:
>   \xmlload{Data}{data.xml}
>
> Then correctly find the number of data from \xmlcount{Data}{subnode}
> however \xmlflush{Data} is not giving me the processed nodes from
>   \startxmlsetups do:subnode
>     doing something with xmlflysh{#1}
>   \stopxmlsetups
> but only the raw input <nodes><subnode>...</subnode></nodes>
>
> Do I err in my understanding? And if so, how to do it better?
>
> Below a minimal example and its output.
>
>
> \startxmlsetups load:setups
>   \xmlsetsetup{#1}{root|nodes|subnode}{load:*}
> \stopxmlsetups
> \xmlregistersetup{load:setups}
>
> \startxmlsetups load:root
>   \xmlloadbuffer{Data}{dataset}
>   Number of <subnodes> = \xmlcount{Data}{subnode}\blank
>   \xmlflush{Data}

you need to apply document setups

     \xmlregistereddocumentsetups{Data}{Data}
     \xmlmain{Data}


> \stopxmlsetups
>
> \startxmlsetups load:subnode
>   Content <subnode> \xmlflush{#1}\par
> \stopxmlsetups
>
> \startbuffer[test]
> <?xml version="1.0" encoding="UTF-8"?>
> <root></root>
> \stopbuffer
>
> \startbuffer[dataset]
> <?xml version="1.0" encoding="UTF-8"?>
> <nodes>
>   <subnode>this is subnode-1</subnode>
>   <subnode>this is subnode-2</subnode>
>   <subnode>this is subnode-3</subnode>
> </nodes>
> \stopbuffer
>
> \starttext
> \xmlprocessbuffer{root}{test}{}
> \hairline
> \stoptext
>
>
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
>


-- 

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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:[~2017-05-15 14:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-12 16:00 \xmlload not understood dr. Hans van der Meer
2017-05-15 14:22 ` Hans Hagen

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