ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* XML Namespaces and XML Setups
@ 2020-11-16 13:31 Christoph Reller
  2022-05-23  8:07 ` Duncan Hothersall via ntg-context
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Reller @ 2020-11-16 13:31 UTC (permalink / raw)
  To: ntg-context


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

Dear List,

Consider the following MWE:

\startxmlsetups xml:demo:base
  \xmlsetsetup{#1}{tag}{xml:demo:tag}
\stopxmlsetups
\xmlregisterdocumentsetup{demo}{xml:demo:base}
\startxmlsetups xml:demo:tag
  %\doif{\xmlnamespace{#1}}{o}{NameSpaceO:}
  \xmlflush{#1}
\stopxmlsetups
\starttext
\startbuffer[test]
<?xml version="1.0"?>
<root xmlns="NameSpaceA"
      xmlns:o="NameSpaceO">
  <tag>text</tag> <o:tag>text</o:tag>
</root>
\stopbuffer
\xmlprocessbuffer{demo}{test}{}
\stoptext

My questions:
- Is there a good way to have a separate XML setup for each XML namespace?
- Alternatively, one has to do the distinction within the same XML setup.
In this case, how do we get the complete namespace? (In this example:
"NameSpaceA" and "NameSpaceO")

Thanks in advance for your help!

Cheers, Christoph

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

* Re: XML Namespaces and XML Setups
  2020-11-16 13:31 XML Namespaces and XML Setups Christoph Reller
@ 2022-05-23  8:07 ` Duncan Hothersall via ntg-context
  2022-05-23 20:14   ` Bruce Horrocks via ntg-context
  0 siblings, 1 reply; 5+ messages in thread
From: Duncan Hothersall via ntg-context @ 2022-05-23  8:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Duncan Hothersall


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

I found this unanswered question on the list from November 2020 and find
today that I have the same question. How can one handle elements with the
same name but in different namespaces? How should the different
\startxmlsetups commands be written?

Thanks.

Duncan

On Mon, 16 Nov 2020 at 13:37, Christoph Reller <christoph.reller@gmail.com>
wrote:

> Dear List,
>
> Consider the following MWE:
>
> \startxmlsetups xml:demo:base
>   \xmlsetsetup{#1}{tag}{xml:demo:tag}
> \stopxmlsetups
> \xmlregisterdocumentsetup{demo}{xml:demo:base}
> \startxmlsetups xml:demo:tag
>   %\doif{\xmlnamespace{#1}}{o}{NameSpaceO:}
>   \xmlflush{#1}
> \stopxmlsetups
> \starttext
> \startbuffer[test]
> <?xml version="1.0"?>
> <root xmlns="NameSpaceA"
>       xmlns:o="NameSpaceO">
>   <tag>text</tag> <o:tag>text</o:tag>
> </root>
> \stopbuffer
> \xmlprocessbuffer{demo}{test}{}
> \stoptext
>
> My questions:
> - Is there a good way to have a separate XML setup for each XML namespace?
> - Alternatively, one has to do the distinction within the same XML setup.
> In this case, how do we get the complete namespace? (In this example:
> "NameSpaceA" and "NameSpaceO")
>
> Thanks in advance for your help!
>
> Cheers, Christoph
>
> ___________________________________________________________________________________
> 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: 3069 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] 5+ messages in thread

* Re: XML Namespaces and XML Setups
  2022-05-23  8:07 ` Duncan Hothersall via ntg-context
@ 2022-05-23 20:14   ` Bruce Horrocks via ntg-context
  2022-05-24  8:50     ` Duncan Hothersall via ntg-context
  0 siblings, 1 reply; 5+ messages in thread
From: Bruce Horrocks via ntg-context @ 2022-05-23 20:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Bruce Horrocks

Does this help?

\startxmlsetups xml:demo:base
  \xmlsetsetup{#1}{tag}{xml:demo:tag}
  \xmlsetsetup{#1}{o:tag}{xml:demo:otag} %% <---
\stopxmlsetups
\xmlregisterdocumentsetup{demo}{xml:demo:base}
\startxmlsetups xml:demo:tag
  \xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:demo:otag   %% <---
  {\bf \xmlflush{#1}}
\stopxmlsetups
\starttext
\startbuffer[test]
<?xml version="1.0"?>
<root xmlns="NameSpaceA"
      xmlns:o="NameSpaceO">
  <tag>text</tag> <o:tag>text</o:tag>
</root>
\stopbuffer
\xmlprocessbuffer{demo}{test}{}
\stoptext

> On 23 May 2022, at 09:07, Duncan Hothersall via ntg-context <ntg-context@ntg.nl> wrote:
> 
> I found this unanswered question on the list from November 2020 and find today that I have the same question. How can one handle elements with the same name but in different namespaces? How should the different \startxmlsetups commands be written?
> 
> Thanks.
> 
> Duncan
> 
> On Mon, 16 Nov 2020 at 13:37, Christoph Reller <christoph.reller@gmail.com> wrote:
> Dear List,
> 
> Consider the following MWE:
> 
> \startxmlsetups xml:demo:base
>   \xmlsetsetup{#1}{tag}{xml:demo:tag}
> \stopxmlsetups
> \xmlregisterdocumentsetup{demo}{xml:demo:base}
> \startxmlsetups xml:demo:tag
>   %\doif{\xmlnamespace{#1}}{o}{NameSpaceO:}
>   \xmlflush{#1}
> \stopxmlsetups
> \starttext
> \startbuffer[test]
> <?xml version="1.0"?>
> <root xmlns="NameSpaceA"
>       xmlns:o="NameSpaceO">
>   <tag>text</tag> <o:tag>text</o:tag>
> </root>
> \stopbuffer
> \xmlprocessbuffer{demo}{test}{}
> \stoptext
> 
> My questions:
> - Is there a good way to have a separate XML setup for each XML namespace?
> - Alternatively, one has to do the distinction within the same XML setup. In this case, how do we get the complete namespace? (In this example: "NameSpaceA" and "NameSpaceO")
> 
> Thanks in advance for your help!
> 
> Cheers, Christoph
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________

—
Bruce Horrocks
Hampshire, UK

___________________________________________________________________________________
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] 5+ messages in thread

* Re: XML Namespaces and XML Setups
  2022-05-23 20:14   ` Bruce Horrocks via ntg-context
@ 2022-05-24  8:50     ` Duncan Hothersall via ntg-context
  2022-05-24 15:40       ` Bruce Horrocks via ntg-context
  0 siblings, 1 reply; 5+ messages in thread
From: Duncan Hothersall via ntg-context @ 2022-05-24  8:50 UTC (permalink / raw)
  To: Bruce Horrocks; +Cc: Duncan Hothersall, mailing list for ConTeXt users


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

Yes, it does! Thanks Bruce. Is this documented somewhere already and I
missed it?

Cheers.

Duncan

On Mon, 23 May 2022 at 21:14, Bruce Horrocks <ntg@scorecrow.com> wrote:

> Does this help?
>
> \startxmlsetups xml:demo:base
>   \xmlsetsetup{#1}{tag}{xml:demo:tag}
>   \xmlsetsetup{#1}{o:tag}{xml:demo:otag} %% <---
> \stopxmlsetups
> \xmlregisterdocumentsetup{demo}{xml:demo:base}
> \startxmlsetups xml:demo:tag
>   \xmlflush{#1}
> \stopxmlsetups
> \startxmlsetups xml:demo:otag   %% <---
>   {\bf \xmlflush{#1}}
> \stopxmlsetups
> \starttext
> \startbuffer[test]
> <?xml version="1.0"?>
> <root xmlns="NameSpaceA"
>       xmlns:o="NameSpaceO">
>   <tag>text</tag> <o:tag>text</o:tag>
> </root>
> \stopbuffer
> \xmlprocessbuffer{demo}{test}{}
> \stoptext
>
> > On 23 May 2022, at 09:07, Duncan Hothersall via ntg-context <
> ntg-context@ntg.nl> wrote:
> >
> > I found this unanswered question on the list from November 2020 and find
> today that I have the same question. How can one handle elements with the
> same name but in different namespaces? How should the different
> \startxmlsetups commands be written?
> >
> > Thanks.
> >
> > Duncan
> >
> > On Mon, 16 Nov 2020 at 13:37, Christoph Reller <
> christoph.reller@gmail.com> wrote:
> > Dear List,
> >
> > Consider the following MWE:
> >
> > \startxmlsetups xml:demo:base
> >   \xmlsetsetup{#1}{tag}{xml:demo:tag}
> > \stopxmlsetups
> > \xmlregisterdocumentsetup{demo}{xml:demo:base}
> > \startxmlsetups xml:demo:tag
> >   %\doif{\xmlnamespace{#1}}{o}{NameSpaceO:}
> >   \xmlflush{#1}
> > \stopxmlsetups
> > \starttext
> > \startbuffer[test]
> > <?xml version="1.0"?>
> > <root xmlns="NameSpaceA"
> >       xmlns:o="NameSpaceO">
> >   <tag>text</tag> <o:tag>text</o:tag>
> > </root>
> > \stopbuffer
> > \xmlprocessbuffer{demo}{test}{}
> > \stoptext
> >
> > My questions:
> > - Is there a good way to have a separate XML setup for each XML
> namespace?
> > - Alternatively, one has to do the distinction within the same XML
> setup. In this case, how do we get the complete namespace? (In this
> example: "NameSpaceA" and "NameSpaceO")
> >
> > Thanks in advance for your help!
> >
> > Cheers, Christoph
> >
> ___________________________________________________________________________________
> > 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
> >
> ___________________________________________________________________________________
>
> —
> Bruce Horrocks
> Hampshire, UK
>
>

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

* Re: XML Namespaces and XML Setups
  2022-05-24  8:50     ` Duncan Hothersall via ntg-context
@ 2022-05-24 15:40       ` Bruce Horrocks via ntg-context
  0 siblings, 0 replies; 5+ messages in thread
From: Bruce Horrocks via ntg-context @ 2022-05-24 15:40 UTC (permalink / raw)
  To: Duncan Hothersall; +Cc: Bruce Horrocks, mailing list for ConTeXt users

I haven't seen it explicitly documented - my cue to add it to the Wiki I guess!

I work with XML a fair bit and, IMHO, the WWW consortium docs do a very poor job of explaining namespaces because they make them seem much more complicated than they are. Essentially, a tag with a namespace identifier is just another tag i.e. treat all the characters, including the colon, as the tag name. Armed with that knowledge I just created a second tag definition in the sample code you posted.

> On 24 May 2022, at 09:50, Duncan Hothersall <dh@capdm.com> wrote:
> 
> Yes, it does! Thanks Bruce. Is this documented somewhere already and I missed it?
> 
> Cheers.
> 
> Duncan
> 
> On Mon, 23 May 2022 at 21:14, Bruce Horrocks <ntg@scorecrow.com> wrote:
> Does this help?
> 
> \startxmlsetups xml:demo:base
>   \xmlsetsetup{#1}{tag}{xml:demo:tag}
>   \xmlsetsetup{#1}{o:tag}{xml:demo:otag} %% <---
> \stopxmlsetups
> \xmlregisterdocumentsetup{demo}{xml:demo:base}
> \startxmlsetups xml:demo:tag
>   \xmlflush{#1}
> \stopxmlsetups
> \startxmlsetups xml:demo:otag   %% <---
>   {\bf \xmlflush{#1}}
> \stopxmlsetups
> \starttext
> \startbuffer[test]
> <?xml version="1.0"?>
> <root xmlns="NameSpaceA"
>       xmlns:o="NameSpaceO">
>   <tag>text</tag> <o:tag>text</o:tag>
> </root>
> \stopbuffer
> \xmlprocessbuffer{demo}{test}{}
> \stoptext
> 
> > On 23 May 2022, at 09:07, Duncan Hothersall via ntg-context <ntg-context@ntg.nl> wrote:
> > 
> > I found this unanswered question on the list from November 2020 and find today that I have the same question. How can one handle elements with the same name but in different namespaces? How should the different \startxmlsetups commands be written?
> > 
> > Thanks.
> > 
> > Duncan
> > 
> > On Mon, 16 Nov 2020 at 13:37, Christoph Reller <christoph.reller@gmail.com> wrote:
> > Dear List,
> > 
> > Consider the following MWE:
> > 
> > \startxmlsetups xml:demo:base
> >   \xmlsetsetup{#1}{tag}{xml:demo:tag}
> > \stopxmlsetups
> > \xmlregisterdocumentsetup{demo}{xml:demo:base}
> > \startxmlsetups xml:demo:tag
> >   %\doif{\xmlnamespace{#1}}{o}{NameSpaceO:}
> >   \xmlflush{#1}
> > \stopxmlsetups
> > \starttext
> > \startbuffer[test]
> > <?xml version="1.0"?>
> > <root xmlns="NameSpaceA"
> >       xmlns:o="NameSpaceO">
> >   <tag>text</tag> <o:tag>text</o:tag>
> > </root>
> > \stopbuffer
> > \xmlprocessbuffer{demo}{test}{}
> > \stoptext
> > 
> > My questions:
> > - Is there a good way to have a separate XML setup for each XML namespace?
> > - Alternatively, one has to do the distinction within the same XML setup. In this case, how do we get the complete namespace? (In this example: "NameSpaceA" and "NameSpaceO")
> > 
> > Thanks in advance for your help!
> > 
> > Cheers, Christoph

—
Bruce Horrocks
Hampshire, UK

___________________________________________________________________________________
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] 5+ messages in thread

end of thread, other threads:[~2022-05-24 15:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-16 13:31 XML Namespaces and XML Setups Christoph Reller
2022-05-23  8:07 ` Duncan Hothersall via ntg-context
2022-05-23 20:14   ` Bruce Horrocks via ntg-context
2022-05-24  8:50     ` Duncan Hothersall via ntg-context
2022-05-24 15:40       ` Bruce Horrocks via ntg-context

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