Hi Lucas

   Thank you, your advise helped me out.
   Now I modified the script to let it work with Jython2.1
   And it seems working well now.

Cao Yu

Sharon Lucas wrote:
> You didn't provide the code that you're trying to run, so I can't comment 
> specifically on the problem.  But, the problem is most likely due to you 
> not understanding that STAX uses Jython 2.1, not Python to run the code 
> you put into a <script> element in a STAX job.  This is documented in the 
> STAX User's Guide.  So, just because your Python code runs under a Python 
> version, does not mean it will run using Jython 2.1.  However, if you can 
> run your Python code using Jython 2.1 (instead of using Python), then it 
> will run via STAX.  Section "Appendix F: Jython and CPython Differences" 
> in the STAX User's Guide talks about some of the Jython and CPython 
> differences.
> 
> The version of minidom provided with Jython 2.1 must be different than the 
> version of minidom that your version of Python is using.  If you google 
> for "Jython minidom", you'll see many hits about a known bug in the 
> version of PyXML partially shipped with Jython 2.1 (e.g. 
> http://aspn.activestate.com/ASPN/Mail/Message/Jython-users/1519395). You 
> should try to use a newer version of PyXML that you provide and use in 
> your STAX job.  Or, you could use an XML parser provided with Java since 
> Jython supports running Java as well as Python.  The STAF/STAX FAQ in 
> section "2.6.7 How can I parse an XML file from a STAX job?" at 
> http://staf.sourceforge.net/current/STAFFAQ.htm#d0e732 provides an example 
> of parsing XML using a Java parser from within a STAX job.
> 
> --------------------------------------------------------------
> Sharon Lucas
> IBM Austin,   luc...@us.ibm.com
> (512) 286-7313 or Tieline 363-7313
> 
> 
> 
> 
> Cao Yu <c...@nec-as.nec.com.cn> 
> 04/21/2009 03:33 AM
> 
> To
> staf-users@lists.sourceforge.net
> cc
> 
> Subject
> [staf-users] About NameError: XMLCommonParser
> 
> 
> 
> 
> 
> 
> Hello Everyone
> 
>     I'm using STAF to set up an automatic test frame work.
>     Inside which, I'm using minidom to parse xml files.
>     But, it seems that minidom did not work correctlly:
> 
> ------------------------------------------------
> com.ibm.staf.service.stax.STAXPythonEvaluationException:
> Traceback (innermost last):
>    File "<pyExec string>", line 9, in ?
>    File "/home/caoy/STAF/STAFscripts/bin/./suit_dom.py", line 27, in 
> getTestList
>    File 
> "/usr/local/staf/data/STAF/lang/java/shared_jython/2.1-staf-v3/Lib/xml/dom/minidom.py",
>  
> 
> line 908, in parse
>    File 
> "/usr/local/staf/data/STAF/lang/java/shared_jython/2.1-staf-v3/Lib/xml/dom/minidom.py",
>  
> 
> line 899, in _doparse
>    File 
> "/usr/local/staf/data/STAF/lang/java/shared_jython/2.1-staf-v3/Lib/xml/dom/pulldom.py",
>  
> 
> line 306, in parse
>    File 
> "/usr/local/staf/data/STAF/lang/java/shared_jython/2.1-staf-v3/Lib/xml/sax/sax2exts.py",
>  
> 
> line 34, in make_parser
>    File 
> "/usr/local/staf/data/STAF/lang/java/shared_jython/2.1-staf-v3/Lib/xml/sax/saxexts.py",
>  
> 
> line 64, in make_parser
>    File 
> "/usr/local/staf/data/STAF/lang/java/shared_jython/2.1-staf-v3/Lib/xml/sax/saxexts.py",
>  
> 
> line 37, in _create_parser
>    File 
> "/usr/local/staf/data/STAF/lang/java/shared_jython/2.1-staf-v3/Lib/xml/sax/drivers2/drv_xmlproc.py",
>  
> 
> line 9, in ?
>    File 
> "/usr/local/staf/data/STAF/lang/java/shared_jython/2.1-staf-v3/Lib/xml/parsers/xmlproc/xmlproc.py",
>  
> 
> line 14, in ?
>    File 
> "/usr/local/staf/data/STAF/lang/java/shared_jython/2.1-staf-v3/Lib/xml/parsers/xmlproc/dtdparser.py",
>  
> 
> line 20, in ?
> NameError: XMLCommonParser
> ------------------------------------------------
> 
>     I could run the same python script by using /user/bin/python,
> 
>     Did any one have some idea about this issue? Thanks
> 
> Cao Yu
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> Stay on top of everything new and different, both inside and 
> around Java (TM) technology - register by April 22, and save
> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
> 300 plus technical and hands-on sessions. Register today. 
> Use priority code J9JMT32. http://p.sf.net/sfu/p
> _______________________________________________
> staf-users mailing list
> staf-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/staf-users
> 
> 


-- 
  ________           NN\
  Cao Yu  |_______m_(@....@_)_m______-&_________________
  NEC Advanced Software Technology (Beijing) Co.,Ltd.|
  E-mail: c...@nec-as.nec.com.cn                     |
  TEL: +861082334433 Ext No: 345                     |



------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to