I've had this discussion with Alex already, I ended up with this after it:
(setq Lst (in "atom.xml" (and (xml?) (xml))))

It will parse the whole thing into a list.

/Henrik

On Fri, Jul 25, 2008 at 6:15 AM, Tomas Hlavaty <[EMAIL PROTECTED]> wrote:

> Hi Alex,
>
> what is the way to load an XML file?  I seem to be having problems
> with some cases depending on where the ?xml declaration and comments
> are:
>
> : (load '@lib/xml.l)
> -> attr
> : (let F '/tmp/a.xml (call 'cat F) (in F (xml)))
> <hi>123</hi>
> -> (hi NIL "123")
> : (let F '/tmp/b.xml (call 'cat F) (in F (xml)))
> <!-- comment -->
> <hi>123</hi>
> -> NIL
> : (let F '/tmp/c.xml (call 'cat F) (in F (xml)))
> <?xml version="1.0" encoding="UTF-8"?>
> <hi>123</hi>
> [/tmp/c.xml:1] ?>\
> <hi>123</hi>\
>  -- XML parse error
> ?
> : (let F '/tmp/d.xml (call 'cat F) (in F (xml)))
> <?xml version="1.0" encoding="UTF-8"?>
> <!-- comment -->
> <hi>123</hi>
> [/tmp/d.xml:1] ?>\
> <!--\ comment\ -->\
> <hi>123</hi>\
>  -- XML parse error
> ?
> : (let F '/tmp/e.xml (call 'cat F) (in F (xml)))
> <!-- comment -->
> <?xml version="1.0" encoding="UTF-8"?>
> <hi>123</hi>
> -> NIL
>
> I am using picolisp-2.3.2.
>
> Thanks,
>
> Tomas
> --
> UNSUBSCRIBE: mailto:[EMAIL PROTECTED]
>

------=_Part_6557_33419765.1216951730383
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

<div dir="ltr">I&#39;ve had this discussion with Alex already, I ended up with 
this after it: (setq Lst (in &quot;atom.xml&quot; (and (xml?) 
(xml))))<br><br>It will parse the whole thing into a 
list.<br><br>/Henrik<br><br>
<div class="gmail_quote">On Fri, Jul 25, 2008 at 6:15 AM, Tomas Hlavaty &lt;<a 
href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>&gt; wrote:<br><blockquote 
class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 
0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Alex,<br>
<br>
what is the way to load an XML file? &nbsp;I seem to be having problems<br>
with some cases depending on where the ?xml declaration and comments<br>
are:<br>
<br>
: (load &#39;@lib/xml.l)<br>
-&gt; attr<br>
: (let F &#39;/tmp/a.xml (call &#39;cat F) (in F (xml)))<br>
&lt;hi&gt;123&lt;/hi&gt;<br>
-&gt; (hi NIL &quot;123&quot;)<br>
: (let F &#39;/tmp/b.xml (call &#39;cat F) (in F (xml)))<br>
&lt;!-- comment --&gt;<br>
&lt;hi&gt;123&lt;/hi&gt;<br>
-&gt; NIL<br>
: (let F &#39;/tmp/c.xml (call &#39;cat F) (in F (xml)))<br>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>
&lt;hi&gt;123&lt;/hi&gt;<br>
[/tmp/c.xml:1] ?&gt;\<br>
&lt;hi&gt;123&lt;/hi&gt;\<br>
&nbsp;-- XML parse error<br>
?<br>
: (let F &#39;/tmp/d.xml (call &#39;cat F) (in F (xml)))<br>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>
&lt;!-- comment --&gt;<br>
&lt;hi&gt;123&lt;/hi&gt;<br>
[/tmp/d.xml:1] ?&gt;\<br>
&lt;!--\ comment\ --&gt;\<br>
&lt;hi&gt;123&lt;/hi&gt;\<br>
&nbsp;-- XML parse error<br>
?<br>
: (let F &#39;/tmp/e.xml (call &#39;cat F) (in F (xml)))<br>
&lt;!-- comment --&gt;<br>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>
&lt;hi&gt;123&lt;/hi&gt;<br>
-&gt; NIL<br>
<br>
I am using picolisp-2.3.2.<br>
<br>
Thanks,<br>
<br>
Tomas<br>
<font color="#888888">--<br>
UNSUBSCRIBE: mailto:<a 
href="mailto:picolisp@software-lab.de";>picolisp@software-lab.de</a>?subject=Unsubscribe<br>
</font></blockquote></div><br></div>

------=_Part_6557_33419765.1216951730383--
-- 
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]
-------

Reply via email to