Linkage with C++ programs & Re: Re: Why some xml files are not parsed ?
pcs03872-tCEKLenjyJCf0DUV/[email protected] Wed, 19 Jan 2005 16:11:02 +0530 (IST)
| Newsgroups | gmane.lisp.scheme.ssax-sxml |
|---|---|
| Message-ID | <[email protected]> |
Hi,
Thanks a lot for replying my newbie n basic question. :) . I am not very
familiar with scheme sysntax and programs, that is why i posted that
doubt.
The following code also worked well, to give the output in console. This
is frm the example file given in the ssax library for bigloo users.
(module convert
(main main))
(define (main argv)
(if (not (= 2 (length argv)))
(exit 4)) ; at least one argument, besides argv[0], is expected
(pp
(call-with-input-file (cadr argv)
(lambda (port) (ssax:xml->sxml port '()))))
)
I have another doubt - is is possible to call this code snippet ( i.e
converitng xml to sxml ) from a c / c++ programs ? Plz give some simple
example to link ssax lib and other programming languages. What i need is a
set of s-expressions as an input to a c++ program. Can i use SSAX pacakge
to feed the input data ?
Thank you again
Shinni
>
>> 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
> _______________________________________________
> ssax-sxml mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ssax-sxml
>
-------------------------------------------------------
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