How to parse response in jython extension tool?
Comments
-
There is no one recommended library for parsing XML within a Jython Extension Tool in SOAtest. I did a quick search and found that a commonly recommended library is a python library called ElementTree (see https://stackoverflow.com/questions/1912434/how-do-i-parse-xml-in-python). Jython is a Java implementation of Python, and it added support for ElementTree in Jython 2.5 which is the version that ships with SOAtest. See http://www.jython.org/docs/_sources/library/xml.etree.elementtree.txt.
0 -
Jython can access Java libraries such as JAXP
0 -
@jakubiak how to include ElemenTree ? do i have to add any library?
0 -
No, you only have to add the correct import at the top of your script, as described in the stackoverflow link I posted:
import xml.etree.ElementTree
0 -
I am trying to use ElementTree on Extension Tool using Jython but I am running into this error - ImportError: No module named xml
My SOATest version is 9.10 and I assumed that ElementTree would be supported. Is there anything else I need to do?
0 -
Got the answer, had to install jython.
0 -
laksramy,
How did you install jython and Parasoft picked it up. I follow the steps it listed yet I'm getting the following error the moment I do the following statement:
from xml.etree import ElementTree as ET
I get the following error:
Traceback (most recent call last):, File "", line 6, in , File "C:\devTools\jython2.7.0\Lib\xml\etree\ElementTree.py", line 1280, except SyntaxError as exc:, ^, SyntaxError: mismatched input 'as' expecting COLON,Did you get any of this errors?
0 -
line 6, in , File "C:\devTools\jython2.7.0
You need to use Jython 2.5.2. For detail and steps, please see Configuring Jython Preferences - Jython Version.
Please also see my response in this other thread:
Changing python version in Parasoft SoaTest0