Sangram,

I need more information as you didn't provide the contents of function 
"parseXML".  Perhaps it isn't returning what you think it is.  You should 
add more debugging to log the value of variable machine_name and its type. 
 Note that if the len() function works on PyStrings and PyList, so that's 
why it is important to understand what type of variable machine_name is, 
as well as what its value is.  Also, what is the complete error 
information that you are getting.  Note that it would be helpful to 
provide the complete STAX job so that we could run it to recreate the 
problem (e.g. you didn't provide function "parseXML" so I don't know what 
exactly it is returning). 

Change your STAX xml function to the following so that you can see what 
variable machine_name's value and type is and provide the log output and 
error information.

<stax> 
  <defaultcall function="Main"/> 
  <function name="Main"> 
    <sequence> 
      <!-- Assign the file name of a STAX xml document you want to parse 
--> 
      <call function="'parseXML'">'c:/MyXml.xml'</call> 
      <script> 
        [name, machine_name] = STAXResult 
      </script>

      <log message="1">'type(machine_name)=%s' % 
(type(machine_name))</log>
      <log message="1">'machine_name=%s' % (machine_name)</log>

      <script>length = len(machine_name)</script>
      <log message="1">'len(machine_name)=%s' % (length)</log> 

      <log message="1">'Name: %s' % (name)</log> 
      <log message="1">'Machine_name: %s' % (machine_name)</log> 
    </sequence> 
  </function> 
</stax>

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313




Sangram Bakshi <san...@gmail.com> 
07/31/2009 11:46 AM

To
staf-users@lists.sourceforge.net
cc

Subject
[staf-users] Error in using jython funtion len()






Hi ,
 
 
In the following stax job i am trying to read the length of a list 
machine_name.
But i get syntax error while trying to do so . The code is highlighted in 
yellow.
 
<stax> 
  <defaultcall function="Main"/> 
  <function name="Main"> 
    <sequence> 
      <!-- Assign the file name of a STAX xml document you want to parse 
--> 
      <call function="'parseXML'">'c:/MyXml.xml'</call> 
      <script> 
        [name, machine_name] = STAXResult 
        
        length = len(machine_name)    ========> i am getting syntax error 
here ...is this a wrong way to do in this section?

      </script> 
      <log message="1">'Name: %s' % (name)</log> 
      <log message="1">'Machine_name: %s' % (machine_name)</log> 
    </sequence> 
  </function> 
</stax>
 
Regards
Sangram
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 
30-Day 
trial. Simplify your report design, integration and deployment - and focus 
on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to