RE: Zeus compatibility with xerces 2.4.x
"Christophe Ney" <[email protected]> Wed, 9 Apr 2003 21:12:03 +0200
| Newsgroups | gmane.comp.java.enhydra.zeus |
|---|---|
| Message-ID | <00c101c2fecb$e7d2e710$0201a8c0@cney2> |
Hi Florent, Why don't you use your own generator instead of SimpleGenerator, this would soove your problem right away. Now, it is probably a good suggestion not to use trim considering the evolution of xerces, so I have applied your patch. thanks, christophe > -----Original Message----- > From: [email protected] > [mailto:[email protected]]On Behalf Of Florent BENOIT > Sent: Wednesday, April 09, 2003 2:21 PM > To: [email protected] > Cc: [email protected]; [email protected]; > [email protected] > Subject: Zeus compatibility with xerces 2.4.x > > > Hello, > > JOnAS needs to upgrade its xerces version (1.3.0) to the latest > available version (2.4.0) for two reasons : > 1/ > In order to use Axis with JOnAS, the xerces version must be changed. > This doesn't work with the xerces version 1.3.0 > 2/ > The JDK from IBM (IBMJava2-14) includes the xerces 2.4.0 > version in the > jre/lib/xml.jar file. > So when we compile JOnAS or JOnAS examples with this JDK, this is the > xerces 2.4.0 version which is used and not the version packaged into > JOnAS(1.3.0) > > But, when we are using the xerces 2.4.0 we've got some problems : > > Here is a short example : > > When we declared an ejb-ql tag in an ejb-jar.xml, we can put the query > on different lines like this : > <ejb-ql><![CDATA[ > SELECT OBJECT(c) > FROM Cmp2_Customer c > WHERE c.lastName LIKE ?1 AND c.firstName LIKE ?2 > ]]> > </ejb-ql> > > When we use xerces 1.3.0 there is no problems. > But, when xerces 2.4.0 is used there are some problems : > The different lines of the query are collapsed : > SELECT OBJECT(c)FROM Cmp2_Customer cWHERE c.lastName LIKE ?1 AND > c.firstName LIKE ?2 > ^ ^ > | | > No space No space > > The difference in the behavior between the two xerces can be explained > by this : > xerces 2.4.0 call the characters() SAX method for each line > of the query > xerces 1.3.0 call only once the characters() SAX method for > the ejb-ql > tag . > > But why the spaces are deleted ??? This is due to the trim() method > which is called in the charcaters() method. > In the xerces 1.3.0 this is not a problem as the lines are send in one > call so, after the trim, we've got the result query : > > "SELECT OBJECT(c) > FROM Cmp2_Customer c > WHERE c.lastName LIKE ?1 AND c.firstName LIKE ?2" > > > In the xerces 2.4.0 case we've got the result, with all the collapsed > lines : > "SELECT OBJECT(c)""FROM Cmp2_Customer c""WHERE c.lastName LIKE ?1 AND > c.firstName LIKE ?2" > > > In the xml specification, the CDATA section implies that the > characters > must be kept as is. This is not the case when we are using > zeus because > the spaces are removed with the trim(). > > A simple solution could be to delete the call to the trim() method in > the file org.enhydra.zeus.generator.SimpleGenerator.java at the line > 2638 : > > writer.write(" String text = new String(ch, start, > len);\n"); > writer.write(" text = text.trim();\n"); <------------- > TRIM > > A more complex solution : > When using xerces 2.4.0 the startCDATA method contains > parameters which > are not present in the 1.3.0 version. > The trim shouldn't have to be done for the CDATA section (use of the > startCDATA and endCDATA method) > But this implies a lot of changes to allow the use of the both xerces > version with zeus. > > It would be great if a new version of zeus could be released very soon > with the "simple solution" patch. > Otherwise, we can't use the JDK from IBM or use Axis with JOnAS. > (This is not a solution to put the SELECT FROM WHERE on only one line) > > Thanks for a quick answer. > > Best regards. > > Guillaume, Xavier, Florent. >