Re: Why some xml files are not parsed ?

[email protected] Tue, 18 Jan 2005 12:39:33 -0800 (PST)
Newsgroups gmane.lisp.scheme.ssax-sxml
Message-ID <[email protected]>
> I tried to run the example file for xml to sxml conversion...  The
> program is converts the xml example input file given in the
> archive. But when i gave any other inputs, the parsed expression is
> just the simplest s-expression., i.e. ().

Here's that program you quote:

> (define doc
>   (let ((port (open-input-file "target.xml")))
>     (let ((doc (SSAX:XML->SXML port '())))
>       (close-input-port port)
>       doc)))
>    
> (define (main argv)
>   (pp
>     ((sxpath "doc/*/text()") doc)))

The last line is the reason you get no output for your documents. The
above program does _two_ things. First, the program parses the
document and binds its SXML representation to the variable 'doc'. The
function 'main' selects text strings from the children of the '<doc>'
element(s), using SXPath. In your XML document, there are no '<doc>'
XML elements. Therefore, the SXPath expression selects nothing --
which is the answer you get.

If you just wish to see the document after parsing, you may want to
write the main function as

(define (main argv)
  (pp doc))

	Cheers,
	Oleg


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt