Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
9 replies
Subscribers
7 subscribers
Views
3447 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
I am not able to parse xml file using xpathdocument function. Expression R
vineeta6579
over 11 years ago
I am not able to parse xml file using xpathdocument function.
Expression Rule : =xpathdocument(cons!xmlCode,"//CurrentWeather/Location/text()")
Attached:XML File...
xmlCode.xml
OriginalPostID-110094
OriginalPostID-110094
Discussion posts and replies are publicly visible
Parents
0
Stefan Helzle
A Score Level 3
over 11 years ago
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
= with(local!response:webservicequery(
a!wsConfig(
wsdlUrl: "
www.webservicex.net/globalweather.asmx
service: "{
www.webserviceX.NET}GlobalWeather",
port: "GlobalWeatherSoap",
operation: "{
www.webserviceX.NET}GetWeather"
),
{
GetWeatherSoapIn: {
CountryName: ri!CountryName,
CityName: ri!CityName
}
}
).returnValue.GetWeatherSoapOut.GetWeatherResult,
xpathsnippet(
substitute(local!response, "utf-16", "utf-8"),
"//CurrentWeather/Location/text()"
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
Stefan Helzle
A Score Level 3
over 11 years ago
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
= with(local!response:webservicequery(
a!wsConfig(
wsdlUrl: "
www.webservicex.net/globalweather.asmx
service: "{
www.webserviceX.NET}GlobalWeather",
port: "GlobalWeatherSoap",
operation: "{
www.webserviceX.NET}GetWeather"
),
{
GetWeatherSoapIn: {
CountryName: ri!CountryName,
CityName: ri!CityName
}
}
).returnValue.GetWeatherSoapOut.GetWeatherResult,
xpathsnippet(
substitute(local!response, "utf-16", "utf-8"),
"//CurrentWeather/Location/text()"
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data