Re: [tcljava-user] jacl 1.3.1 regexp
Brought to you by:
mdejong
From: Johannes K. <joh...@kl...> - 2007-04-09 14:37:33
|
sa4was isn't supported anyway by IBM so I don't think that is the point. I am developing my own deployment-scripts so I just wanted to take some code of sa4was and use it in my scripts. Parsing XML files was some of it. I didn't find any code to do that and I don't think it is easy without a good regexp-engine. Non-greedy regexp is one important thing for parsing XML, I think. Do you have some piece of code which can parse XML-Files with the regexp-engine in jacl 1.3.1? I will look at your homepage the next time and look forward to your jacl libraries. Am Montag, den 09.04.2007, 14:22 +0100 schrieb Patrick Finnegan: > On Monday 09 April 2007 13:32, Johannes Kleinlercher wrote: > > Hi all, > > > > I look for a way to parse an XML-File in IBMs wsadmin, which uses jacl > > 1.3.1 as a scripting language. > > > > I found a project called sa4was [1] on IBMs developerworks which does > > parsing XML with regexp. sa4was works with WebSpher 5.x (which used jacl > > 1.2.x) however in WebSphere 6.0 (which uses jacl 1.3.1) it doesn't work > > anymore. > > > > Some code in sa4was does the following: > > > > ============================================ > > while {[regexp {([^=]+)="([^"]*?)"(.*)} $restOfTag dontCare > > attributeName attributeValue restOfTag]} { > > if {$attributeName == "id"} { > > set idValue $attributeValue > > break > > } > > } > > ============================================ > > > > and there I get the error > > "couldn't compile regular expression pattern: nested *?+" > > > > > > I found out that regexp changed in jacl 1.3.1 and non-greedy regexp > > (with this "*?" expression) doesn't work anymore. Is that right? > > > > Questions: > > a) So are there workarounds for something like that? > > b) Or are there some better ways to parse XML in jacl? > > > > The quick work around for existing sa4was scripts in a WAS 6 environment is to > downgrade JACL from 1.3.1 to 1.2.X by replacing the 1.3.1 jacl.jar and > tcljava.jar jar files in the was/installdirectory/lib directory. > > However I would not recommend using sa4was with 6.0 because it's is not > supported by IBM in 6.x. I have a JACL script library for WAS which I am > posting on the internet this week that covers most of the WAS admin > functions. You should have a look at that. > > The Tcl xml parser TclXml has not been ported to JACL so you need to use > 'regexp' or 'string match' to parse XML. > > If you want to use Tcl packages that have not been ported to JACL in a > scripted WebSphere admin environment then you will need to use TclBlend as a > java client with the WebSphere JMX java library. There are plenty of > articles on Developerworks that describe WAS admin using java clients rather > than Wasadmin clients written in Jython or Jacl. I am re-writing most of my > stuff to use TclBlend because while IBM might drop support for Jacl and > Jython in future releases the JVM layer will always be there. |