Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #3851

Re: Looking for XML linearization information

Path csiph.com!eeepc.pasdenom.info!news.pasdenom.info!news.dougwise.org!gegeweb.org!newsfeed.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Peter Flynn <peter.nosp@m.silmaril.ie>
Newsgroups comp.programming, comp.text.xml, comp.sources.d
Subject Re: Looking for XML linearization information
Followup-To comp.text.xml
Date Thu, 03 Feb 2011 22:59:09 +0000
Organization Usenet Labs Bozon Detector Facility
Lines 40
Message-ID <8r0q9uF1rjU1@mid.individual.net> (permalink)
References <0ba9f95a-83d8-4a9e-9d95-c87046a71f20@y26g2000yqd.googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net R7u/KdXQXNJpE2zXGUZjtgr1d5Hv4faBdyy0SPs7ZaV8y348R+
Cancel-Lock sha1:PY32GxVe7tY1Xv1ybGMB48GxlyI=
User-Agent Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7
In-Reply-To <0ba9f95a-83d8-4a9e-9d95-c87046a71f20@y26g2000yqd.googlegroups.com>
Xref csiph.com comp.programming:3851 comp.text.xml:697 comp.sources.d:78

Cross-posted to 3 groups.

Followups directed to: comp.text.xml

Show key headers only | View raw


On 03/02/11 19:29, Generic Usenet Account wrote:
> Hello,
>
> Are there are tools/W3C standards/design patterns etc. for linearizing
> XML content?  Basically I want to send information, which is natively
> in XML, to a resource constrained device that does not have XML
> awareness.  In other words, the resource constrained device does not
> do any DOM or SAX processing of XML.

There is a useful GPL'd tool called lxprintf, part of the LTXML2 package 
from Edinburgh. This reads an XML file, extracts specific nodes 
(elements, attributes) and then outputs values you specify in XPath 
notation, formatted with a printf-like specification.

To re-use Frank's example:

  <book>
    <references>This if ref #1</references>
    <references>This if ref #2</references>
    <references>This if ref #3</references>

    <title>Book Title One</title>
    <author>Joe Blog</author>
    <price>10.50</price>
</book>

$ lxprintf -e 'references' "%s\n" '.' test.xml
This if ref #1
This if ref #2
This if ref #3

Or perhaps

$ lxprintf -e book "%s/%s/$%s\n" author title price test.xml
Joe Blog/Book Title One/$10.50

///Peter (followups reset to c.t.x)
-- 
XML FAQ: http://xml.silmaril.ie/

Back to comp.programming | Previous | Next | Find similar


Thread

Re: Looking for XML linearization information Peter Flynn <peter.nosp@m.silmaril.ie> - 2011-02-03 22:59 +0000

csiph-web