From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/79197 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:44:30 +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=----------CJRUersBFgKcSuDAUzZzyy X-Trace: ger.gmane.org 1352907895 15459 80.91.229.3 (14 Nov 2012 15:44:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 14 Nov 2012 15:44:55 +0000 (UTC) To: ConTeXt Original-X-From: ntg-context-bounces@ntg.nl Wed Nov 14 16:45:02 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 1TYf99-00008o-60 for gctc-ntg-context-518@m.gmane.org; Wed, 14 Nov 2012 16:44:59 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 9D83510232; Wed, 14 Nov 2012 16:44:46 +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 2KI8nBhPtJVl; Wed, 14 Nov 2012 16:44:44 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id EACF4101F6; Wed, 14 Nov 2012 16:44:43 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 8CD92101F6 for ; Wed, 14 Nov 2012 16:44:42 +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 2yiwUiWGbArZ for ; Wed, 14 Nov 2012 16:44:40 +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 2D804101E8 for ; Wed, 14 Nov 2012 16:44:40 +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 qAEFcUWG032032 for ; Wed, 14 Nov 2012 16:38:31 +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:44:34 +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: 0WInrCuV7 - 0be78fd6090d - 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:79197 Archived-At: ------------CJRUersBFgKcSuDAUzZzyy 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 "