<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>I am not able to parse xml file  using xpathdocument function. Expression R</title><link>https://community.appian.com/discussions/f/rules/2698/i-am-not-able-to-parse-xml-file-using-xpathdocument-function-expression-r</link><description>I am not able to parse xml file using xpathdocument function. Expression Rule : =xpathdocument(cons!xmlCode,&amp;quot;//CurrentWeather/Location/text()&amp;quot;) Attached:XML File... xmlCode.xml OriginalPostID-110094 OriginalPostID-110094</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: I am not able to parse xml file  using xpathdocument function.&lt;br /&gt;Expression R</title><link>https://community.appian.com/thread/9394?ContentTypeID=1</link><pubDate>Sun, 18 May 2014 21:16:23 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:670b4de7-46ac-45da-bfb0-e42511e60994</guid><dc:creator>vineeta6579</dc:creator><description>thank you stefan.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am not able to parse xml file  using xpathdocument function.&lt;br /&gt;Expression R</title><link>https://community.appian.com/thread/9393?ContentTypeID=1</link><pubDate>Sun, 18 May 2014 20:59:45 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ea443dde-d2d6-41ee-b420-929692de9ace</guid><dc:creator>Stefan Helzle</dc:creator><description>The problem is that in the response the XML tag tells the parser that the content is encoded in UTF-16. It is not. So after replacing the encoding definition to UTF-8 the Appian XML parser is able to perform the xpath expression. The code will look like this&lt;br /&gt;&lt;br /&gt;= with(local!response:webservicequery(&lt;br /&gt;    a!wsConfig(&lt;br /&gt;      wsdlUrl: &amp;quot;&lt;a href="http://www.webservicex.net/globalweather.asmx?WSDL"&gt;www.webservicex.net/globalweather.asmx&lt;/a&gt;&lt;br /&gt;      service: &amp;quot;{&lt;a&gt;www.webserviceX.NET}GlobalWeather&amp;quot;,&lt;/a&gt;&lt;br /&gt;      port: &amp;quot;GlobalWeatherSoap&amp;quot;,&lt;br /&gt;      operation: &amp;quot;{&lt;a&gt;www.webserviceX.NET}GetWeather&amp;quot;&lt;/a&gt;&lt;br /&gt;    ),&lt;br /&gt;    {&lt;br /&gt;      GetWeatherSoapIn: {&lt;br /&gt;        CountryName: ri!CountryName,&lt;br /&gt;        CityName: ri!CityName&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;  ).returnValue.GetWeatherSoapOut.GetWeatherResult,&lt;br /&gt;xpathsnippet(&lt;br /&gt;  substitute(local!response, &amp;quot;utf-16&amp;quot;, &amp;quot;utf-8&amp;quot;),&lt;br /&gt;  &amp;quot;//CurrentWeather/Location/text()&amp;quot;&lt;br /&gt;)&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am not able to parse xml file  using xpathdocument function.&lt;br /&gt;Expression R</title><link>https://community.appian.com/thread/9392?ContentTypeID=1</link><pubDate>Sun, 18 May 2014 02:00:10 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7734b305-a2b6-418e-a45c-5f038b934cd0</guid><dc:creator>Stefan Helzle</dc:creator><description>I&amp;#39;m going to take a look at it tomorrow. It is midnight already here in germany.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am not able to parse xml file  using xpathdocument function.&lt;br /&gt;Expression R</title><link>https://community.appian.com/thread/9391?ContentTypeID=1</link><pubDate>Sun, 18 May 2014 01:45:12 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:31778b5d-420a-48a6-ae92-d998416bf9b7</guid><dc:creator>vineeta6579</dc:creator><description>Attached :xpathsnippet function&lt;br /&gt;&lt;p&gt;&lt;a href="/cfs-filesystemfile/__key/communityserver-discussions-components-files/15/xpathsnippet.txt"&gt;xpathsnippet.txt&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am not able to parse xml file  using xpathdocument function.&lt;br /&gt;Expression R</title><link>https://community.appian.com/thread/9390?ContentTypeID=1</link><pubDate>Sat, 17 May 2014 23:32:49 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0857c955-c975-4a84-b928-5396ab3ac7a3</guid><dc:creator>vineeta6579</dc:creator><description>Stefanh I have attached SOAP UI response. As per my understanding one unit space is is coming because of &amp;quot;&amp;lt;![CDATA[&amp;quot;. and its getting failed in xpathsnippet function.&lt;br /&gt;I used trim function but it doesn&amp;#39;t help!!&lt;br /&gt;&lt;p&gt;&lt;a href="/cfs-filesystemfile/__key/communityserver-discussions-components-files/15/response.txt"&gt;response.txt&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="/cfs-filesystemfile/__key/communityserver-discussions-components-files/15/Screenshot001.jpg"&gt;&lt;img src="/cfs-filesystemfile/__key/communityserver-discussions-components-files/15/Screenshot001.jpg" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am not able to parse xml file  using xpathdocument function.&lt;br /&gt;Expression R</title><link>https://community.appian.com/thread/9388?ContentTypeID=1</link><pubDate>Sat, 17 May 2014 22:23:17 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bb928a9f-d519-4283-acf9-2755d421069b</guid><dc:creator>Stefan Helzle</dc:creator><description>You are welcome :-)&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am not able to parse xml file  using xpathdocument function.&lt;br /&gt;Expression R</title><link>https://community.appian.com/thread/9386?ContentTypeID=1</link><pubDate>Sat, 17 May 2014 22:05:36 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:58464d6d-d25e-4e06-a6d2-15ee60531bde</guid><dc:creator>vineeta6579</dc:creator><description>space problem!! &lt;br /&gt;Thanks Stefan.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am not able to parse xml file  using xpathdocument function.&lt;br /&gt;Expression R</title><link>https://community.appian.com/thread/9385?ContentTypeID=1</link><pubDate>Sat, 17 May 2014 21:57:04 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b6942b4a-cc98-403c-8270-4cf0b30df399</guid><dc:creator>vineeta6579</dc:creator><description>I am getting this XML from a web service. One more thing I noticed if I  remove &amp;quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-16&amp;quot;?&amp;gt;&amp;quot;  from XML then  it works..&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am not able to parse xml file  using xpathdocument function.&lt;br /&gt;Expression R</title><link>https://community.appian.com/thread/9383?ContentTypeID=1</link><pubDate>Sat, 17 May 2014 21:31:32 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:46981270-c1d2-4d2a-b3ac-2734b8cfe184</guid><dc:creator>Stefan Helzle</dc:creator><description>I checked your XML on &lt;a href="http://www.xpathtester.com"&gt;http://www.xpathtester.com&lt;/a&gt; and after removing the trailing whitespace it works great.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>