To use a literal less-than operator (the < character) within a STAX xml 
file (or any xml file) and not have an XML processor assume it is the 
start of a tag (aka element), you must specify entity reference &lt; 
instead of <.   For example:

<script>
  if RC &lt; 0:
    errMsg = 'Error: RC=%s' % (RC)
</script>

This is talked about in section "Using Python for Expression Evaluation" 
in the STAX User's Guide at 
http://staf.sourceforge.net/current/STAX/staxug.html#Header_Python where 
it says:

Also, note that XML processors assume that < always starts a tag and that 
& always starts an entity reference, so you should avoid using those 
characters for anything else. You must use the entity reference &lt; 
instead of < and entity reference &amp; instead of & or else you'll get an 
XML parsing error. This can be difficult sometimes as the < character is 
used as the less-than operator in Python, as in this example, where RC < 0 
is being assigned to the expression attribute.

<if expr="RC &lt; 0">

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




From:   Luca Robusto <lucarobu...@gmail.com>
To:     "staf-users@lists.sourceforge.net" 
<staf-users@lists.sourceforge.net>, 
Date:   05/29/2013 05:34 AM
Subject:        [staf-users] STAXImportError Signal



When I write STAX Script and inside <script> </script> I use the < 
operator for Python variable comparison I get STAXImportError error:

"The content of elements must consist of well formed character data or 
markup.

How can I sove this?

Regards.

Luca.
------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to