unclebob / fitnesse

FitNesse -- The Acceptance Test Wiki
fitnesse.org
Other
2.05k stars 715 forks source link

Retrieving XML Value Using XPath #214

Closed dwhalen14 closed 11 years ago

dwhalen14 commented 11 years ago

I am trying to extract an XML value using xpath (text()). I want to put it into a variable that I can use later. My let is returning a blank (see atch). I've tried a couple of options but I get nothing. I've also tried putting it in the GET - that gives me a yellow java error. Suggestions?

Xpath1

Xpath2

woodybrood commented 11 years ago

Are your sure this isn't an issue with the REST fixture? FitNesse itself isn't responsible for the XPath processing.

dwhalen14 commented 11 years ago

Actually, I thought of that so I found a REST Fixture XPath test which works. See below... Xpath3

woodybrood commented 11 years ago

Is the yellow triangle what you are concerned about? The yellow triangle in the upper right is not an error. It just means something used System.out.println().

dwhalen14 commented 11 years ago

No, I understand the yellow triangle - that's not the problem. My question is, why am I not getting anything returned using the XPath in the first example but I get something in the RestFixtureTest. I'm doing it the exact same way in both. The only obvious difference to me is the Content-Type headers. The RestFixtureTest uses text/xml where my example uses application/xml. I admit I know nothing about the headers. What I want to do is use a GET to retrieve order information (such as an Order Number) then use that value in a POST or PUT.

woodybrood commented 11 years ago

Then I come back to this. I don't think this is a bug in FitNesse, but a question about https://github.com/smartrics/RestFixture. Have you tried there or on StackOverflow?

FitNesse doesn't make the REST call to your test system, nor does it interpret the difference between text/xml or application/xml. That is specific to the RestFixture.

woodybrood commented 11 years ago

@dwhalen14 moved this to Stackoverflow. If anyone can help him over there it would be great.

http://stackoverflow.com/questions/15300953/using-xpath-to-extract-and-use-data-from-a-get-response