Help with ampersand in xml

Dave Cragg dave.cragg at lacscentre.co.uk
Fri Oct 19 04:47:27 EDT 2012


On 18 Oct 2012, at 16:35, Chris Sheffield <cmsheffield at me.com> wrote:

> For all you xml experts out there. Hoping someone has the answer for this...
> 
> I need to use an ampersand character (&) in xml. It's in a company name like Levi Strauss & Co. Everything I can find on the topic says to use the entity reference "&", but this doesn't seem to be working. I just end up with a blank space. Does anyone know how to make this work?
> 
> I'm beginning to think I've run into a bug in the LiveCode xml parser. I'm currently using the revXMLNodeContents() function. Should I be using some other function?
> 
> Thanks,
> Chris


The following works here (LC 4.6)

In field 1:
<data>
<company>
<name>Woolworths</name>
</company>
<company>
<name>Marks & Spencer</name>
</company>
</data>

In button script:

on mouseUp
   put revCreateXMLTree(field 1,true,true,false) into tID
   put revXMLNodeContents(tID, "/data/company[2]/name") into field 2
end mouseUp

Produces 'Marks & Spencer'

Dave






More information about the use-livecode mailing list