When I try to slurp the xml in I get [fl.xml:1] !DOCTYPE -- Unbalanced XML I'm assuming ":1" refers to the second line here... <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE pdf2xml SYSTEM "pdf2xml.dtd"> <this is a blank line really>
I've looked at the xml tree using the firefox plugin "xml developer" and it's indents look pretty uniform from the start to the end so I don'r really know what I'm doing wrong. On 16 January 2017 at 17:44, dean <[email protected]> wrote: > >'read' cannot be used to parse an XML file, because it expects Lisp > syntax. > > Thank you for putting me straight on that. > > >You can then operate on the s-expr with all the list manipulation > functions. > >And/or use 'body' and 'attr' for convenience. > > That sounds really good...thank you very much > > On 16 January 2017 at 17:10, Alexander Burger <[email protected]> wrote: > >> On Mon, Jan 16, 2017 at 04:04:18PM +0000, dean wrote: >> > I tried this on an xml file and it seems ideal re separating the tags >> and >> > data for processing >> > (in "fl.xml" (until (eof) (prinl (read)))) >> > >> > The input is stopping abruptly when I hit an isolated closed paren >> though >> >> 'read' cannot be used to parse an XML file, because it expects Lisp >> syntax. >> >> >> > I'm just wondering how best to get around this >> >> "@lib/xm.l" or "@lib/xml.l" are for that. >> >> The function 'xml' slurps in a whole XML tree: >> >> : (load "@lib/xm.l") >> >> : (in "fl.xml" (and (xml?) (xml))) >> -> (...) # Get s-expr representing the XML >> >> : (pretty @) >> # Get pretty-printed output of the structure >> >> You can then operate on the s-expr with all the list manipulation >> functions. >> And/or use 'body' and 'attr' for convenience. >> >> ♪♫ Alex >> -- >> UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe >> > >
