Groups | Search | Server Info | Login | Register


Groups > comp.programming > #3851

Re: Looking for XML linearization information

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 2011-02-03 22:59 +0000
Organization Usenet Labs Bozon Detector Facility
Message-ID <8r0q9uF1rjU1@mid.individual.net> (permalink)
References <0ba9f95a-83d8-4a9e-9d95-c87046a71f20@y26g2000yqd.googlegroups.com>

Cross-posted to 3 groups.

Followups directed to: comp.text.xml

Show all headers | 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