At 1:29 PM +0100 10/11/00, David Bovill wrote:
>Is there anyone working on this are, who would be interested in
>using/advising on the creation of a general purpose XML library?

I'm also very interested. I had a go recently at some basic parsing, 
and ran into problems with using regex. (I think you reported 
something similar in a recent post.) I resorted to using a mixture of 
matchText and the offset function for some things. But I was groping 
in the dark a little as I wasn't completely clear of the various 
rules for valid XML content (whitespace, case, etc.). I'm still not 
clear. Right now, my functions will only work with my own home-made 
xml. These are the functions I made (kind of):

xmlElement(pName, pData)
This returns the first element with the name pName from a chunk of 
text (pData). It returns the element complete with tags. (It won't 
return empty elements.)

xmlAllElements(pName, pData)
This returns all the elements with the name pName from a chunk of 
data. It returns them as a return separated list, so assumes all the 
elements are single lines of text. (As I said, it works with 
home-made xml.) Probably better to use an array for this.

xmlAttribute(pAttrib, pElem)
Returns the value of the attribute pAttrib from some xml element. (A 
bit shaky. Needs more work.)

xmlStripStartEndTags(pElem)
Strips the start and end tags from an xml element.

If anyone's interested, I can mail the scripts.

And I'd be happy to see yours, David. (scripts, that is :)

So far, I've been surprised that something so conceptually simple as 
XML has been so tricky to work with in Metacard. But it's early days 
I guess.

Cheers
Dave Cragg




Reply via email to