[plt-scheme] xml-parsing

From: Mike T. Machenry (dskippy at ccs.neu.edu)
Date: Thu Jan 23 21:20:54 EST 2003

  I called it a root tag because this is what the parser's error message
calls it. I don't think it's an incorrect name since with respect to it's
input it is a root tag. You are correct, if I put some tag enclosing the
rest of my XML (giving it a root tag) it would work just fine.

  I cannot require the contents of the input port to contain a root tag.
I don't want to add a root tag for parsing and then strip it back out
when I have an xexpr, though this seems the easiest solution, it's ugly.


On Thu, Jan 23, 2003 at 03:14:58PM -0500, John Clements wrote:
> On Wednesday, January 22, 2003, at 12:57  AM, Mike T. Machenry wrote:
> >  For list-related administrative tasks:
> >  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> >
> >Hello List,
> >
> >  I am trying to parse an xml fragment. I am noting that it seems all 
> >the
> >provisions from the xml library require the document to be a full xml
> >document with a root tag. Is it not possible to parse fragments with 
> >the
> >current library? My desired function would be as such:
> >
> >given a STDIN
> >this is a <a href="http://www.test.org">test</a>
> >
> >a call to
> >(xml->xexpr (my-desired-function))
> >
> >produces
> >("this is a " (a ((href "http://www.test.org")) "test"))
> >
> >When (define my-desired-function read-xml/element) I get an error
> >complaining about a missing root tag :-\
> I think a root tag is not what you think it is.  If I understand things 
> correctly, the only requirement is that the input be wrapped in some 
> kind of XML tag.  So, for instance, if you wrapped your input in any 
> tag pair at all, I believe this would work fine.
> Check me on this.
> john

Posted on the users mailing list.