[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: Gecko/20101227 Iceowl/1.0b1 Icedove/3.0.11


is there an easy way to avoid intermixed text from xml? For example, given this XML:

<?xml version="1.0"?>

    this is just a test!

the following code:

(use-modules (sxml simple))
(use-modules (sxml xpath))

(let ((sxml (with-input-from-file "test.xml" xml->sxml)))
   (lambda (c) (pk (cdr c)))
   ((sxpath '(// check)) sxml)))


;;; (((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!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]