From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/89480 Path: news.gmane.org!not-for-mail From: =?iso-8859-2?B?UHJvY2jhemthIEx1a+G5IEluZy4gLSBQb250ZXggcy4gci4gby4=?= Newsgroups: gmane.comp.tex.context Subject: Re: Ctx & XML Date: Thu, 11 Dec 2014 08:33:24 +0100 Message-ID: References: <5488F248.5080408@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=----------vcS7wcHoJTS1Y9l5OcfPh7 X-Trace: ger.gmane.org 1418283248 12228 80.91.229.3 (11 Dec 2014 07:34:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 11 Dec 2014 07:34:08 +0000 (UTC) To: "mailing list for ConTeXt users" Original-X-From: ntg-context-bounces@ntg.nl Thu Dec 11 08:34:03 2014 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([5.39.185.229]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XyyGA-0006QK-Ll for gctc-ntg-context-518@m.gmane.org; Thu, 11 Dec 2014 08:34:02 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 0FF251022B for ; Thu, 11 Dec 2014 08:34:02 +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 CGYNcCMyAMGL for ; Thu, 11 Dec 2014 08:34:01 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id D53D110230 for ; Thu, 11 Dec 2014 08:33:35 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 46F43101EC for ; Thu, 11 Dec 2014 08:33:32 +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 d13gKoKcOh6z for ; Thu, 11 Dec 2014 08:33:31 +0100 (CET) Original-Received: from filter1-til.mf.surf.net (filter1-til.mf.surf.net [194.171.167.217]) by balder.ntg.nl (Postfix) with ESMTP id 16FD9101EA for ; Thu, 11 Dec 2014 08:33:31 +0100 (CET) Original-Received: from mail.pontex.cz (mail.pontex.cz [89.233.168.98]) by filter1-til.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id sBB7XTjp025037 for ; Thu, 11 Dec 2014 08:33:30 +0100 X-Footer: cG9udGV4LmN6 Original-Received: from localhost ([127.0.0.1]) by mail.pontex.cz (Kerio Connect 8.0.2) for ntg-context@ntg.nl; Thu, 11 Dec 2014 08:33:43 +0100 In-Reply-To: <5488F248.5080408@wxs.nl> User-Agent: Opera Mail/12.15 (Win32) X-Bayes-Prob: 0.0001 (Score 0, tokens from: ntg-context@ntg.nl, base:default, @@RPTN) X-CanIt-Geo: ip=89.233.168.98; country=CZ; latitude=50.0833; longitude=14.4167; http://maps.google.com/maps?q=50.0833,14.4167&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0RNq7xtd6 - 26b62c4b3c17 - 20141211 X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.217 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:89480 Archived-At: ------------vcS7wcHoJTS1Y9l5OcfPh7 Content-Type: text/plain; charset=iso-8859-2; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable Hello, On Thu, 11 Dec 2014 02:24:24 +0100, Hans Hagen wrote: > On 12/10/2014 11:08 PM, Luk=E1=B9 Proch=E1zka wrote: > > I assume that you also want the content of elements, not just the > attributes. Yes... >> Or how to achieve this in a best way under Ctx: XML file -> Lua table= /tree? > > It all depends on what kin dof table you want (if the content is an > indexed table and attributes keys then you have the problem that the > element cannot be a key too as it can clash) .. anyway, it's no big de= al > to provide a stupid table, so I can provide something because after al= l > the loaded xml file is a table already. It would be great. > local x =3D xml.load("file.xml") > > local t =3D xml.totable(x) > > where x is an index/hash mix plus _tag, _type and _namespace fields as= > well (after all I assume that you need to know that too). > > (btw, I bet that you can do what you want with the existing > functionality as well, so there is not much benefit in such a table) > > Probably in the next upload, ... Means - some functionality (for me to test or to play with) might be= available tomorrow morning? > Hans BTW, I prepared a really-simple-XML-test which shows XML -> Lua table/tr= ee conversion, which I'd like to achieve (and which (approx.) provides L= uaXml lib). ---- XML c ---- ---- Lua representation { [0] =3D "a", -- Element name { [0] =3D "b", -- Element name -- No nested members bbb =3D "B1", -- Atts }, { [0] =3D "b", -- Element name { "c", }, -- Nested member bbb =3D "B2", -- Atts }, aaa =3D "AAA", -- Atts } ---- Thanks again. Best regards, Lukas -- = Ing. Luk=E1=B9 Proch=E1zka | mailto:LPr@pontex.cz Pontex s. r. o. | mailto:pontex@pontex.cz | http://www.pontex.cz Bezov=E1 1658 147 14 Praha 4 Tel: +420 241 096 751 Fax: +420 244 461 038 ------------vcS7wcHoJTS1Y9l5OcfPh7 Content-Disposition: attachment; filename=t.xml Content-Type: text/xml; name="t.xml" Content-Transfer-Encoding: 7bit c ------------vcS7wcHoJTS1Y9l5OcfPh7 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= ------------vcS7wcHoJTS1Y9l5OcfPh7--