From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/94455 Path: news.gmane.org!not-for-mail From: "Meer, Hans van der" Newsgroups: gmane.comp.tex.context Subject: Re: xml input Date: Thu, 14 Apr 2016 20:30:10 +0000 Message-ID: <545694FE-156E-4912-9D98-A59815EB6F47@uva.nl> References: <8ACED9AF-31FB-4C80-9D4C-6A545EA13634@uva.nl> <570F58C0.4090107@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8996801484989903542==" X-Trace: ger.gmane.org 1460665848 22689 80.91.229.3 (14 Apr 2016 20:30:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 14 Apr 2016 20:30:48 +0000 (UTC) To: NTG ConTeXt Original-X-From: ntg-context-bounces@ntg.nl Thu Apr 14 22:30:36 2016 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aqnuN-0005Qr-I9 for gctc-ntg-context-518@m.gmane.org; Thu, 14 Apr 2016 22:30:35 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 87155A573; Thu, 14 Apr 2016 22:30:24 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KiywdUPKiSUr; Thu, 14 Apr 2016 22:30:23 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id 679B9A576; Thu, 14 Apr 2016 22:30:23 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 4F0E9A56E for ; Thu, 14 Apr 2016 22:30:22 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kVojj9GbFsxO for ; Thu, 14 Apr 2016 22:30:20 +0200 (CEST) Original-Received: from HUB01.uva.nl (hub01.uva.nl [146.50.108.230]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id CCBFFA56A for ; Thu, 14 Apr 2016 22:30:10 +0200 (CEST) Original-Received: from MBX02.uva.nl ([169.254.2.73]) by HUB01.uva.nl ([::1]) with mapi id 14.03.0266.001; Thu, 14 Apr 2016 22:30:10 +0200 Thread-Topic: [NTG-context] xml input Thread-Index: AQHRlioM4dTLZ/GwMUWPLa/OBLWcZJ+JywSA In-Reply-To: <570F58C0.4090107@wxs.nl> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [84.106.134.200] x-endpointsecurity-0xde81-ev: v:6.2.7.719, d:out, a:y, w:t, t:0, sv:1460654764, ts:1460665810 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.org gmane.comp.tex.context:94455 Archived-At: --===============8996801484989903542== Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_545694FE156E49129D98A59815EB6F47uvanl_" --_000_545694FE156E49129D98A59815EB6F47uvanl_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable On 14 Apr 2016, at 10:45, Hans Hagen > = wrote: On 4/13/2016 4:21 PM, Meer, Hans van der wrote: I would like to process several input sources as one xml tree. Like this: with the sources having the structure ... ... and the code for containing: read from all sources given on -notes afterwards process all content at once Thus the content of the various source should be read into one tree to be processed, but I cannot get this done. How to amalgam this separate sources into one? a clue: \xmlinclude By the way: hoe laad ik de inhoud van een buffer net als van een file, is e= r een buffer equivalent van \xmlinclude? Hans, het spijt me zeer, maar ik begrijp er geen hout meer van want er volg= t een crash met een lua-error. Ik lees voor \xmlinclude dat \xmlinclude{NODE}{LPATH}{ATTRIBUTE} de file in= het attribuut laadt. Ik heb wat in de code rondgeneusd. Uit lxml > tex > including file 'notes-example.xml' in de log blijkt dat in function lxml.include(id,pattern,attribute,options) moet zijn uitgevoerd if trace_loading then report_lxml("including file %a",filename) end noffiles, nofconverted =3D noffiles + 1, nofconverted + 1 return resolvers.loadtexfile(filename) or "" Met resolvers tracking komt hier nog tussen: lxml > tex > including file 'notes-example.xml' resolvers > methods > resolving, method 'finders', how 'uri', handler= 'file', argument 'notes-example.xml' resolvers > resolving > remembering file 'notes-example.xml' using ha= sh 'xml::notes-example.xml' resolvers > files > file finder: 'notes-example.xml' found resolvers > methods > resolving, method 'loaders', how 'uri', handler= 'file', argument 'notes-example.xml' resolvers > files > file loader: 'notes-example.xml' loaded het lijkt erop dat de gezochte file wel geladen is en dat pas daarna ConTeX= t het opgeeft met de error. De log geeft me hier: HVDM-NOTE-DEBUG > enter notes:include HVDM-NOTE-DEBUG > ..looking for file notes-example.xml lxml > tex > including file 'notes-example.xml' lua error > lua error on line 14 in file /Users/hansm/Documents/TeX/t= exmf/publications/takenotes/take notes.tex: ...-35/tex/texmf-context/tex/context/base/mkiv/lxml-aux.lua:428: attempt to= index field 'settings' (a nil value) stack traceback: ...-35/tex/texmf-context/tex/context/base/mkiv/lxml-aux.lua:428: in functio= n 'include' ...-35/tex/texmf-context/tex/context/base/mkiv/lxml-tex.lua:579: in functio= n <...-35/tex/texmf-context/tex/context/base/mkiv/lxml-tex.lua:567> (...tail calls...) De navolgende code is toch niet fout? De main input is De file notes-example.xml bevat slechts subnodes etc omsluiten met ... doet niets anders. Ik doe het volgende (met loading tracker enabled \startxmlsetups notes:takenotes % Include files and buffers. \xmlfilter{#1}{/include/command(notes:include)} \stopxmlsetups \startxmlsetups notes:include % Include from file. \doifnot{\xmlatt{#1}{file}}{\empty} {\writestatus{HVDM-NOTE-DEBUG}{..looking for file \xmlatt{#1}{file}} \xmlinclude{#1}{}{file}} \stopxmlsetups Zelfde crash in de volgende gevallen \xmlinclude{#1}{}{file} \xmlinclude{#1}{.}{file} \xmlinclude{#1}{../include}{file} met vriendelijke groet Hans van der Meer met vriendelijke groet Hans van der Meer --_000_545694FE156E49129D98A59815EB6F47uvanl_ Content-Type: text/html; charset="us-ascii" Content-ID: <3CE5A29A40DA2F43BFC045DD82528AF6@uva.nl> Content-Transfer-Encoding: quoted-printable
On 14 Apr 2016, at 10:45, Hans Hagen <pragma@wxs.nl> wrote:

On 4/13/2016 4:21 PM, Meer, Hans van der wrote:
I would like to process several input = sources as one xml tree. Like this:

<?xml version=3D"1.0" encoding=3D"UTF-8"?>
<takenotes>
<include buffer=3D"notes-example"/>
<include file=3D"notes-example.xml"/>
</takenotes>

with the sources having the structure
<notes>
<note>...</note>
...
</notes>

and the code for <takenotes> containing:
read from all sources given on <include>-notes
afterwards process all content at once

Thus the content of the various source should be read into one tree to
be processed, but I cannot get this done.
How to amalgam this separate sources into one?

a clue: \xmlinclude

By the way: hoe laad ik de inhoud van een buffer net als van een file, is er een buffer equivalent van \xm= linclude?

Hans, het spijt me zeer, maar ik begrijp er geen hout meer = van want er volgt een crash met een lua-error.
Ik lees voor \xmlinclude dat \xmlinclude{NODE}{LPATH}{ATTRI= BUTE} de file in het attribuut laadt.

Ik heb wat in de code rondgeneusd. 
Uit  = lxml            > tex > including = file 'notes-example.xml' 
in de log blijkt dat in function lxml.i= nclude(id,pattern,attribute,options)
moet zijn uitgevoerd

            if trace_loading = then
                rep= ort_lxml("including file %a",filename)
            end
            noffiles, nofconv= erted =3D noffiles + 1, nofconverted + 1
            return resolvers.= loadtexfile(filename) or ""

Met resolvers tracking komt hier nog tussen:
lxml            > tex > including= file 'notes-example.xml'
resolvers       > methods > resolving, method 'f= inders', how 'uri', handler 'file', argument 'notes-example.xml'
resolvers       > resolving > remembering file '= notes-example.xml' using hash 'xml::notes-example.xml'
resolvers       > files > file finder: 'notes-ex= ample.xml' found
resolvers       > methods > resolving, method 'l= oaders', how 'uri', handler 'file', argument 'notes-example.xml'
resolvers       > files > file loader: 'notes-ex= ample.xml' loaded
het lijkt erop dat de gezochte file wel geladen is en dat p= as daarna ConTeXt het opgeeft met de error.

De log geeft me hier:

HVDM-NOTE-DEBUG > enter notes:include
HVDM-NOTE-DEBUG > ..looking for file notes-example.xm= l
lxml            > = tex > including file 'notes-example.xml'

lua error       > lua error = on line 14 in file /Users/hansm/Documents/TeX/texmf/publications/takenotes/= take notes.tex:

...-35/tex/texmf-context/tex/context/base/mkiv/lxml-aux.= lua:428: attempt to index field 'settings' (a nil value)
stack traceback:
...-35/tex/texmf-context/tex/context/base/mkiv/lxml-aux.lua:428: = in function 'include'
...-35/tex/texmf-context/tex/context/base/mkiv/lxml-tex.lua:579: = in function <...-35/tex/texmf-context/tex/context/base/mkiv/lxml-tex.lua= :567>
(...tail calls...)


De navolgende code is toch niet fout?

De main input is
<?xml v= ersion=3D"1.0" encoding=3D"UTF-8"?>
<takenotes><= /div>
  <!-- <includ= e buffer=3D"notes-example"/> -->
<include file=3D"= notes-example.xml"/>
</takenotes>=

De file notes-example.xml bevat slechts
<note> subnodes </note> etc
omsluiten met <root>...</root> doet niets ander= s.

Ik doe het volgende (met loading tracker enabled
\startxmls= etups notes:takenotes
  % Include files an= d buffers.
  \xmlfilter{#1}{/in= clude/command(notes:include)}
\stopxmlsetups

\startxmlsetups notes:inc= lude
   \doifnot{\xmlatt{#1= }{file}}{\empty}
    {\writestatus{HVDM-NOTE-DEBUG}= {..looking for file \xmlatt{#1}{file}}
     \xmli= nclude{#1}{}{file}}=
\stopxmlse= tups

Zelfde cra= sh in de volgende gevallen
\xmlinclude{#1}{}{file}
\xmlinclude{#1}{.}{file}
\xmlinclude{#1}{../include}{file}

met vriendelijke groet
Hans van der Meer
met vriendelijke groet
Hans van der Meer




--_000_545694FE156E49129D98A59815EB6F47uvanl_-- --===============8996801484989903542== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly90ZXguYWFuaGV0Lm5ldAphcmNoaXZlICA6IGh0dHA6Ly9mb3VuZHJ5LnN1cGVsZWMu ZnIvcHJvamVjdHMvY29udGV4dHJldi8Kd2lraSAgICAgOiBodHRwOi8vY29udGV4dGdhcmRlbi5u ZXQKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX18= --===============8996801484989903542==--