XPath with BE_XPath()

Discussion created by steve.winter on Jan 8, 2013
Latest reply on Jan 14, 2013 by steve.winter

Hi all


I need to access data from a remote XML feed, which I'm trying to do using an FM script and the BE plugin.


At present I've got;

Set Variable[$xml; Value:BE_GetURL(""; ""; "username"; "password")]


So far so good, in the data viewier I get my variable correctrly set to the XML feed from the remote server, that looks like this:


<Users xmlns="" xmlns:xsi="" xsi:schemaLocation="schema.xsd">






<CompanyName>A Company</CompanyName>

<TradingName>A Company</TradingName>

<AddressLine1>123 Some Street</AddressLine1>


<Postcode>W1 2SQL</Postcode>

<Country>United Kingdom</Country>




<Category>Clothing and Footwear</Category>

<Category>Fashion and Design</Category>







Now when I try to use the BE_XPath function to access data within there, I'm not getting anywhere. I've tried;

Set Variable[$addr; Value:BE_XPath ( $xml; "//AddressLine1" )]

which I expected to set variable $addr to 123 Some Street


Set Variable[$user; Value:BE_XPath ( $xml; "Users/User" )]

from which I expected $user to end up containing the above XML block for the user (so pretty much all of it)


Set Variable[$users; Value:BE_XPathAll ( $xml; "//User" )]

which I expected would give me a list of (in this case only one) users


I've worked with XPath before, but only within PHP and thought I understood how it works, but maybe not...? any tips...? pointers...? suggestions...?