Thanks David for information.

I tried using minidom xml parser as replacement to lxml.  Here is my
modified code:

******************************
from xml.dom import minidom

                ConfileFile1 = 'C:\\test.xml'
                ConfigFile2 = 'C:\\test1.xml'

                ATree = minidom.parse(ConfileFile1)

                CTree = minidom.parse(ConfigFile2)


                for Element in ATree.getElementsByTagName('Test1'):
                    for Ele in CTree.getElementsByTagName ('Test2'):
                        Element.appendChild(Ele)

                NewATreeString = ATree.toxml()


******************************



But I am getting below mentioned error

Line 11: Error in element type "script".

===== Python Error Information =====

com.ibm.staf.service.stax.STAXPythonEvaluationException:
Traceback (innermost last):
  File "<pyExec string>", line 6, in ?
  File
"C:\STAF\data\STAF\lang\java\shared_jython\2.1-staf-v3.3\Lib\xml\dom\minidom.py",
line 908, in parse
  File
"C:\STAF\data\STAF\lang\java\shared_jython\2.1-staf-v3.3\Lib\xml\dom\minidom.py",
line 900, in _doparse
  File
"C:\STAF\data\STAF\lang\java\shared_jython\2.1-staf-v3.3\Lib\xml\dom\pulldom.py",
line 251, in getEvent
AttributeError: feed

Regard's


On Tue, Jan 5, 2010 at 7:47 PM, David Bender <bda...@us.ibm.com> wrote:

>
> Hi,
>
> Do the 3 lines in your <script> work for you when running them outside of
> STAF/STAX?  I tried installing lxml-2.2.4.win32-py2.5.exe, and when running
> from Python 2.5, I got the same error:
>
> $ python
> Python 2.5.1 (r251:54863, May 18 2007, 16:56:43)
> [GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import sys
> >>> sys.path.append("C:\\Python25\\Lib\\site-packages\\lxml")
> >>> from lxml import etree
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: cannot import name etree
> >>>
>
> Looking at the documentation at: http://codespeak.net/lxml/tutorial.html
>
> I tried the following and it worked:
>
> >>> import xml.etree.cElementTree as etree
> >>>
>
> Having said all that, note that STAX uses Jython V2.1, which is a Java
> implementation of Python V2.1.  It seems that lxml is built for specific
> versions of Python (and does not appear to support Python 2.1), so I don't
> think you will be able to use lxml within your STAX job.  Using "import
> xml.etree.cElementTree as etree" within the <script> results in
> "ImportError: No module named etree".
>
> Thanks,
> David
>
> ------------------------------
>  *David 
> Bender*<http://w3.ibm.com/bluepages/simpleSearch.wss?searchBy=Name&searchFor=David+Bender>
> STAF/STAX Development
> IBM Software Group, WPLC
>   11501 Burnet Rd.
> Bldg. 903-5B002
> Austin, TX 78758-3400
>   Phone (T/L): 1-512-286-5315 (363-5315)
> ITN: 23635315
> Email: *bda...@us.ibm.com* <bda...@us.ibm.com>
>
>
> ------------------------------
>
>
>
>  From: staf-stax user <stafstaxu...@gmail.com> To:
> staf-users@lists.sourceforge.net Cc: staf-stax user <
> stafstaxu...@gmail.com> Date: 01/05/2010 07:17 AM Subject: [staf-users]
> Issues while importing external python modules.
> ------------------------------
>
>
>
> Hi
>
> I am facing issues while importing "lxml" module through STAX.
>
> lxml package is installed at location "C:\Python26\Lib\site-packages\lxml".
>
> In my stax.xml I am importing this module by appending syspath. Here is how
> I am trying to import etree under lxml. "etree.pyd" file is present under
> lxml folder.
>
> **************
> <script>
>                 import sys
>                 sys.path.append ("C:\\Python26\\Lib\\site-packages\\lxml")
>
>                 from lxml import etree
> </script>
> ***************
>
> At this point it is throwing me an error "ImportError: cannot import name
> etree"
>
> Regard's
>
>
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and
> easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev_______________________________________________
> staf-users mailing list
> staf-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/staf-users
>
>
>
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to