From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/79198 Path: news.gmane.org!not-for-mail From: =?iso-8859-2?B?UHJvY2jhemthIEx1a+G5IEluZy4gLSBQb250ZXggcy4gci4gby4=?= Newsgroups: gmane.comp.tex.context Subject: XML and Lua/Ctx Date: Wed, 14 Nov 2012 16:45:27 +0100 Message-ID: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=----------efPnjPaXMYTJgVJF2jWAsk X-Trace: ger.gmane.org 1352907946 15960 80.91.229.3 (14 Nov 2012 15:45:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 14 Nov 2012 15:45:46 +0000 (UTC) To: ConTeXt Original-X-From: ntg-context-bounces@ntg.nl Wed Nov 14 16:45:56 2012 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TYfA2-0000rh-Gn for gctc-ntg-context-518@m.gmane.org; Wed, 14 Nov 2012 16:45:54 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id E70A21027D; Wed, 14 Nov 2012 16:45:44 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id mulgKZ53-w6W; Wed, 14 Nov 2012 16:45:37 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 23D46101F6; Wed, 14 Nov 2012 16:45:37 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 08BDE101F6 for ; Wed, 14 Nov 2012 16:45:36 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 1QpLuf-FHo6Z for ; Wed, 14 Nov 2012 16:45:34 +0100 (CET) Original-Received: from filter5-til.mf.surf.net (filter5-til.mf.surf.net [194.171.167.221]) by balder.ntg.nl (Postfix) with ESMTP id 1F32F101E8 for ; Wed, 14 Nov 2012 16:45:34 +0100 (CET) Original-Received: from mail.pontex.cz (mail.pontex.cz [89.233.168.98]) by filter5-til.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id qAEFdPqw000861 for ; Wed, 14 Nov 2012 16:39:25 +0100 Original-Received: from localhost ([127.0.0.1]) by mail.pontex.cz (Kerio MailServer 6.6.2) for ntg-context@ntg.nl; Wed, 14 Nov 2012 16:45:32 +0100 User-Agent: Opera Mail/12.10 (Win32) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=89.233.168.98; country=CZ; latitude=49.7500; longitude=15.5000; http://maps.google.com/maps?q=49.7500,15.5000&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0WInrDp5h - 8099903f3222 - 20121114 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.221 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 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-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:79198 Archived-At: ------------efPnjPaXMYTJgVJF2jWAsk Content-Type: text/plain; charset=iso-8859-2; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable Hello, I've read that when Ctx is to process a XML file, the whole XML tree is = loaded first and processed as wanted. I'd need to process a XML file which represents an Excel workbook saved = as .xml. When working in pure Lua, I'm using Expat library (http://matthewwild.co= .uk/projects/luaexpat/index.html) which allow to create a parser with ca= llbacks (e.g. StartElement(), StopElement(), CharacterData()...). It processes the .xml file on-the-go. However, this solution cannot be used with Ctx as it causes Ctx to crash= . How to access a XML file loaded and parsed from within Ctx via Lua? I attach a simple Excel XML (for those who are familiar with Excel and d= on't refuse using it). As an example, I'd need process the attached .xml into a simple Lua tabl= e: ---- -- return -- Lua table as a result { workbooks =3D { [1] =3D { name =3D "1", -- No more info is necessary so far, -- I just need to see the way how to access XML elements }, [2] =3D { name =3D "Imp", }, [3] =3D { name =3D "Exp", }, [4] =3D { name =3D "