[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sxml: avoiding intermixed text?
From: |
Aleix Conchillo Flaqué |
Subject: |
sxml: avoiding intermixed text? |
Date: |
Mon, 10 Jan 2011 12:21:46 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20101227 Iceowl/1.0b1 Icedove/3.0.11 |
Hi!
is there an easy way to avoid intermixed text from xml? For example,
given this XML:
<?xml version="1.0"?>
<test>
<check><value>empty</value></check>
<check>
<value>hi!
this is just a test!
</value>
</check>
</test>
the following code:
-------------
(use-modules (sxml simple))
(use-modules (sxml xpath))
(let ((sxml (with-input-from-file "test.xml" xml->sxml)))
(map
(lambda (c) (pk (cdr c)))
((sxpath '(// check)) sxml)))
-------------
Returns:
-------------
;;; (((value "empty")))
;;; (("
" (value "hi!
this is just a test!
") "
"))
-------------
I'd like to get rid of the (car) of the second print. Or saying it in
another way, I want to get rid of all text that is not a leaf.
I'm using xpath to find my elements, which is what I found easiest from
all the sxml stuff. May be I should do it some other way.
Any help would be welcome!
Cheers,
Aleix
- sxml: avoiding intermixed text?,
Aleix Conchillo Flaqué <=