RE: Digester Question

2003-12-23 Thread Ivan Rekovic
The simplest way of grabing ReportSuccesses is to use SetPropertyRule.
See documentation in digester distribution for this.

Basically you will have to create digester, attach rule (with alias
since ReportSuccesses is not valid bean name), add pattern (something
like  IDTDebitInterface/DebitRequests in your case) and parse file with
digester parse method. When parsing is finished you will have property
of your bean setted.

As for your second question. No. Digester can not create XML documents,
but you can look for DOM4J for example witch will suite your needs.

 -Original Message-
 From: Juan Alvarado [mailto:[EMAIL PROTECTED]
 Sent: Monday, December 22, 2003 11:46 PM
 To: [EMAIL PROTECTED]
 Subject: Digester Question
 
 Hello:
 
 I am relatively new to xml parsing and I just started using the
 commons-digester tools and it seems like it might fit my needs.
 
 First let me apologize to all you seasoned pros in the field of XML in
 the event that my question seems too simple or if I am just not using
 the right terminology.
 
 My question is as follows.
 
 The particular XML that I am working with and in need to parse is
 composed as follows:
 
 ?xml version=1.0?
 IDTDebitInterface
 UserInfo
 usernameJuan/username
 passwordAlvarado/password
 /UserInfo
 DebitRequests ReportSuccesses=true
 DebitRequest id=1 type=misctrans
 account123/account
 amount10/amount
 transtypevendordebit/transtype
 noteTest/note
 balancetozeron/balancetozero
 /DebitRequest
 /DebitRequests
 /IDTDebitInterface
 
 As you can see, the node DebitRequests ReportSuccesses=true
 contains an attribute ReportSuccesses=true. I need to be able to
grab
 that value so that it can be populated into my corresponding bean.
 Additionally there might be times when there is more than one
attribute
 in a given node and obviously I would need to get those values also.
 Could someone please tell me if this is possible and if so, how to
 accomplish this.
 
 NEXT QUESTION:
 
 My application not only has to parse this XML stream, but we also have
 to create this XML from in certain situations. We might for example
 receive a request through the web with the necessary parameters and
 values needed to construct the XML and then pass on to the next layer.
 Can anyone tell me if the digester framework can handle this and if
so,
 I'd appreciate some sample code.
 
 Thanks in advance.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: jelly-tag util:loadText

2003-12-23 Thread Paul Libbrecht
Michael,

This looks like a bug into the sql:query tag. Have you looked around it?
(what I understand from that is that it's taking an XML-output whereas 
it should accept only the  concatenation of a bunch of text-nodes 
(CDATA and entity refs included).

Paul

On 22-Dec-03, at 17:13 Uhr, Michael L. Conneen wrote:

Folks,

I'm using a snap-shot of the commons-jelly library from week of 12/15..

I have the following jelly script
...
 util:file name=${sqlScript} var=fp/
  util:loadText file=${fp} var=sqlText/
  sql:setDataSource
url=${databaseURL}
driver=${databaseDriver}
user=${databaseUser}
password=${databasePassword}
/
  sql:query var=results
![CDATA[
${sqlText}
]]
  /sql:query
..
Within the sql file is..
select * from table where foo  bar
what is happening is that when the file is loaded..  is translated 
to lt;

This even occurs if I change the jelly script to..
  sql:query var=results
![CDATA[
select * from table where foo  bar
]]
  /sql:query
And.. if I change my input file text to be..
![CDATA[
select * from table where foo  bar
]]
Then the sqlText is
lt;![CDATA[
select *
from SCARAB_ATTRIBUTE
where created_date lt; CURRENT_DATE
]]gt;
I poked around the LoadTextTag.java file.. and it appears the file IS 
being read and put into the context..  Just when it comes out of the 
context.. it is being treated as HTML and translated..

Ideas?

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Digester Question

2003-12-23 Thread Juan Alvarado
Tim:

Thanks for the help and the sample code. I really appreciate it. This 
will help us  get up and running really fast.

Take care,

On Dec 22, 2003, at 8:23 PM, Tim O'Brien wrote:

Juan, the Digester is pretty straightforward, I'd recommend using the 
XML rules sets.

As far as Object - XML, try using Betwixt.  It is very straightfoward.

Assume you have a Play JavaBean with a genre, year, language, and 
author properties.

Create a file named Play.betwixt, and make sure that it resides in 
the classpath as a sibling to Play.class.

info primitiveTypes=element
 element name=play
   attribute name=genre property=genre/
   attribute name=year property=year/
   attribute name=language property=language/
   addDefaults/
 /element
/info
*** Then you can use the code below to write out an XML file.

Play play = new Play();
play.setGenre( blah );
play.setYear( 1232 );
play.setLanguage( Danish );
play.setAuthor( Ali G.);
BeanWriter beanWriter = new BeanWriter();
beanWriter.enablePrettyPrint();
beanWriter.write(play);
System.out.println(beanWriter.toString());
*** This will spit out something like this:

play genre=blah year=1232 language=Danish
 authorAli G./author
/play
So, in other words, using Betwixt is as easy as creating a series of 
.betwixt files that you place in the Classpath.

Good Luck.

Juan Alvarado wrote:

Hello:

I am relatively new to xml parsing and I just started using the 
commons-digester tools and it seems like it might fit my needs.

First let me apologize to all you seasoned pros in the field of XML 
in the event that my question seems too simple or if I am just not 
using the right terminology.

My question is as follows.

The particular XML that I am working with and in need to parse is 
composed as follows:

?xml version=1.0?
IDTDebitInterface
UserInfo
usernameJuan/username
passwordAlvarado/password
/UserInfo
DebitRequests ReportSuccesses=true
DebitRequest id=1 type=misctrans
account123/account
amount10/amount
transtypevendordebit/transtype
noteTest/note
balancetozeron/balancetozero
/DebitRequest
/DebitRequests
/IDTDebitInterface
As you can see, the node DebitRequests ReportSuccesses=true 
contains an attribute ReportSuccesses=true. I need to be able to 
grab that value so that it can be populated into my corresponding 
bean. Additionally there might be times when there is more than one 
attribute in a given node and obviously I would need to get those 
values also. Could someone please tell me if this is possible and if 
so, how to accomplish this.

NEXT QUESTION:

My application not only has to parse this XML stream, but we also 
have to create this XML from in certain situations. We might for 
example receive a request through the web with the necessary 
parameters and values needed to construct the XML and then pass on to 
the next layer. Can anyone tell me if the digester framework can 
handle this and if so, I'd appreciate some sample code.

Thanks in advance.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Digester Question

2003-12-23 Thread Tim O'Brien
I do not know of any problem, but then again, I only use Betwixt in a very 
straightforward situation.

If you would like to check on the open issues in Bugzilla, here is the 
link:  
http://nagoya.apache.org/bugzilla/buglist.cgi?bug_status=NEWbug_status=ASSIGNEDbug_status=REOPENEDemail1=emailtype1=substringemailassigned_to1=1email2=emailtype2=substringemailreporter2=1bugidtype=includebug_id=changedin=votes=chfieldfrom=chfieldto=Nowchfieldvalue=product=Commonscomponent=Betwixtshort_desc=short_desc_type=allwordssubstrlong_desc=long_desc_type=allwordssubstrbug_file_loc=bug_file_loc_type=allwordssubstrkeywords=keywords_type=anywordsfield0-0-0=nooptype0-0-0=noopvalue0-0-0=cmdtype=doitorder=%27Importance%27


Betwixt is a helpful utility, it has been sitting at an alpha 1.0 stage 
for a bit too long.  I'll agitate on the commons-dev list, and roust some 
answers out of the group.

Tim



On Tue, 23 Dec 2003, Juan Alvarado wrote:

 Ok will do.
 
 Can you tell me if even though it is in alpha release, if you've  
 encountered or heard of any major problems with it.
 
 Thanks
 
 On Dec 23, 2003, at 12:46 PM, Tim O'Brien wrote:
 
  I left out more detail, especially concerning the situation where the  
  Play
  bean contains a property that happens to be a Character bean.
 
  Please also see the very well written online docs with Betwixt:
  http://jakarta.apache.org/commons/betwixt/guide/binding.html
 
  If you notice any glaring omissions please feel free to this community
  know.
 
  Tim
 
  On Tue, 23 Dec 2003, Juan Alvarado wrote:
 
  Tim:
 
  Thanks for the help and the sample code. I really appreciate it. This
  will help us  get up and running really fast.
 
  Take care,
 
  On Dec 22, 2003, at 8:23 PM, Tim O'Brien wrote:
 
  Juan, the Digester is pretty straightforward, I'd recommend using the
  XML rules sets.
 
  As far as Object - XML, try using Betwixt.  It is very  
  straightfoward.
 
  Assume you have a Play JavaBean with a genre, year, language, and
  author properties.
 
  Create a file named Play.betwixt, and make sure that it resides in
  the classpath as a sibling to Play.class.
 
  info primitiveTypes=element
   element name=play
 attribute name=genre property=genre/
 attribute name=year property=year/
 attribute name=language property=language/
 addDefaults/
   /element
  /info
 
  *** Then you can use the code below to write out an XML file.
 
  Play play = new Play();
  play.setGenre( blah );
  play.setYear( 1232 );
  play.setLanguage( Danish );
  play.setAuthor( Ali G.);
 
  BeanWriter beanWriter = new BeanWriter();
  beanWriter.enablePrettyPrint();
  beanWriter.write(play);
  System.out.println(beanWriter.toString());
 
  *** This will spit out something like this:
 
  play genre=blah year=1232 language=Danish
   authorAli G./author
  /play
 
  So, in other words, using Betwixt is as easy as creating a series of
  .betwixt files that you place in the Classpath.
 
  Good Luck.
 
 
  Juan Alvarado wrote:
 
  Hello:
 
  I am relatively new to xml parsing and I just started using the
  commons-digester tools and it seems like it might fit my needs.
 
  First let me apologize to all you seasoned pros in the field of XML
  in the event that my question seems too simple or if I am just not
  using the right terminology.
 
  My question is as follows.
 
  The particular XML that I am working with and in need to parse is
  composed as follows:
 
  ?xml version=1.0?
  IDTDebitInterface
  UserInfo
  usernameJuan/username
  passwordAlvarado/password
  /UserInfo
  DebitRequests ReportSuccesses=true
  DebitRequest id=1 type=misctrans
  account123/account
  amount10/amount
  transtypevendordebit/transtype
  noteTest/note
  balancetozeron/balancetozero
  /DebitRequest
  /DebitRequests
  /IDTDebitInterface
 
  As you can see, the node DebitRequests ReportSuccesses=true
  contains an attribute ReportSuccesses=true. I need to be able to
  grab that value so that it can be populated into my corresponding
  bean. Additionally there might be times when there is more than one
  attribute in a given node and obviously I would need to get those
  values also. Could someone please tell me if this is possible and if
  so, how to accomplish this.
 
  NEXT QUESTION:
 
  My application not only has to parse this XML stream, but we also
  have to create this XML from in certain situations. We might for
  example receive a request through the web with the necessary
  parameters and values needed to construct the XML and then pass on  
  to
  the next layer. Can anyone tell me if the digester framework can
  handle this and if so, I'd appreciate some sample code.
 
  Thanks in advance.
 
 
   
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail:  
  [EMAIL PROTECTED]
 
 
 
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional 

Re: Digester Question

2003-12-23 Thread Juan Alvarado
Ok great.. Keep me posted with that.

Take care

On Dec 23, 2003, at 1:52 PM, Tim O'Brien wrote:

I do not know of any problem, but then again, I only use Betwixt in a  
very
straightforward situation.

If you would like to check on the open issues in Bugzilla, here is the
link:
http://nagoya.apache.org/bugzilla/buglist.cgi? 
bug_status=NEWbug_status=ASSIGNEDbug_status=REOPENEDemail1=emailtyp 
e1=substringemailassigned_to1=1email2=emailtype2=substringemailrepo 
rter2=1bugidtype=includebug_id=changedin=votes=chfieldfrom=chfiel 
dto=Nowchfieldvalue=product=Commonscomponent=Betwixtshort_desc=sho 
rt_desc_type=allwordssubstrlong_desc=long_desc_type=allwordssubstrbu 
g_file_loc=bug_file_loc_type=allwordssubstrkeywords=keywords_type=an 
ywordsfield0-0-0=nooptype0-0-0=noopvalue0-0 
-0=cmdtype=doitorder=%27Importance%27

Betwixt is a helpful utility, it has been sitting at an alpha 1.0 stage
for a bit too long.  I'll agitate on the commons-dev list, and roust  
some
answers out of the group.

Tim



On Tue, 23 Dec 2003, Juan Alvarado wrote:

Ok will do.

Can you tell me if even though it is in alpha release, if you've
encountered or heard of any major problems with it.
Thanks

On Dec 23, 2003, at 12:46 PM, Tim O'Brien wrote:

I left out more detail, especially concerning the situation where the
Play
bean contains a property that happens to be a Character bean.
Please also see the very well written online docs with Betwixt:
http://jakarta.apache.org/commons/betwixt/guide/binding.html
If you notice any glaring omissions please feel free to this  
community
know.

Tim

On Tue, 23 Dec 2003, Juan Alvarado wrote:

Tim:

Thanks for the help and the sample code. I really appreciate it.  
This
will help us  get up and running really fast.

Take care,

On Dec 22, 2003, at 8:23 PM, Tim O'Brien wrote:

Juan, the Digester is pretty straightforward, I'd recommend using  
the
XML rules sets.

As far as Object - XML, try using Betwixt.  It is very
straightfoward.
Assume you have a Play JavaBean with a genre, year, language, and
author properties.
Create a file named Play.betwixt, and make sure that it resides  
in
the classpath as a sibling to Play.class.

info primitiveTypes=element
 element name=play
   attribute name=genre property=genre/
   attribute name=year property=year/
   attribute name=language property=language/
   addDefaults/
 /element
/info
*** Then you can use the code below to write out an XML file.

Play play = new Play();
play.setGenre( blah );
play.setYear( 1232 );
play.setLanguage( Danish );
play.setAuthor( Ali G.);
BeanWriter beanWriter = new BeanWriter();
beanWriter.enablePrettyPrint();
beanWriter.write(play);
System.out.println(beanWriter.toString());
*** This will spit out something like this:

play genre=blah year=1232 language=Danish
 authorAli G./author
/play
So, in other words, using Betwixt is as easy as creating a series  
of
.betwixt files that you place in the Classpath.

Good Luck.

Juan Alvarado wrote:

Hello:

I am relatively new to xml parsing and I just started using the
commons-digester tools and it seems like it might fit my needs.
First let me apologize to all you seasoned pros in the field of  
XML
in the event that my question seems too simple or if I am just not
using the right terminology.

My question is as follows.

The particular XML that I am working with and in need to parse is
composed as follows:
?xml version=1.0?
IDTDebitInterface
UserInfo
usernameJuan/username
passwordAlvarado/password
/UserInfo
DebitRequests ReportSuccesses=true
DebitRequest id=1 type=misctrans
account123/account
amount10/amount
transtypevendordebit/transtype
noteTest/note
balancetozeron/balancetozero
/DebitRequest
/DebitRequests
/IDTDebitInterface
As you can see, the node DebitRequests ReportSuccesses=true
contains an attribute ReportSuccesses=true. I need to be able to
grab that value so that it can be populated into my corresponding
bean. Additionally there might be times when there is more than  
one
attribute in a given node and obviously I would need to get those
values also. Could someone please tell me if this is possible and  
if
so, how to accomplish this.

NEXT QUESTION:

My application not only has to parse this XML stream, but we also
have to create this XML from in certain situations. We might for
example receive a request through the web with the necessary
parameters and values needed to construct the XML and then pass on
to
the next layer. Can anyone tell me if the digester framework can
handle this and if so, I'd appreciate some sample code.
Thanks in advance.

-- 
--
-
To unsubscribe, e-mail:  
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]





--- 
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:  
[EMAIL PROTECTED]




 
-
To unsubscribe, 

RE: RE : Jelly and forehead problem

2003-12-23 Thread Marc DEXET
Hello people.
I have partially solutionned my previous problem.
Jelly was unable to find the right .jar, because of I had not build
jelly-tags (sorry I'm new in jakarta world :0)

So don't forget maven tags:build !

That's almost ok, and I don't talk about sun lib ...

My next probem is always forehead;
I'm using ths example script, but it doesn't work.


-

[EMAIL PROTECTED] bin]# java -Djelly.home=/usr/local/jelly/bin/jelly
-Dtools.jar=/opt/java/lib/tools.jar -Dant.home=/opt/obox/ant/bin/ant
-Dforehead.conf.file=/usr/local/jelly/bin/forehead.conf -cp
/usr/local/jelly/lib/forehead-1.0-beta-2.jar
com.werken.forehead.Forehead $*
java.lang.NullPointerException
at com.werken.forehead.Forehead.loadGlob(Forehead.java:374)
at com.werken.forehead.Forehead.load(Forehead.java:317)
at com.werken.forehead.Forehead.config(Forehead.java:245)
at com.werken.forehead.Forehead.config(Forehead.java:131)
at com.werken.forehead.Forehead.main(Forehead.java:571)


-


Some ideas ?

Thanks

Marc DeXeT

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: RE : Jelly and forehead problem

2003-12-23 Thread Marc DEXET
New version (I'am debugging...)
It looks better this way
[EMAIL PROTECTED] root]# java -Djelly.home=/usr/local/jelly/
-Dtools.jar=/opt/java/lib/tools.jar -Dant.home=/opt/obox/ant
-Dforehead.conf.file=/usr/local/jelly/bin/forehead.conf -cp
/usr/local/jelly/lib/forehead-1.0-beta-6-SNAPSHOT.jar
com.werken.forehead.Forehead $*
 line ***/opt/obox/ant/lib/*.jar
return true
return true
suffix
return true
return true
return true
return true
return true
return true
return true
return true
return true
return true
return true
suffix
 line ***/usr/local/jelly//lib/*.jar
return true
return true
return true
return true
return true
return true
return true
return true
return true
return true
return true
return true
return true
return true
return true
 line ***/usr/local/jelly//custom/*.jar
return true
Usage: jelly [scriptFile] [-script scriptFile -o outputFile
-Dsysprop=syspropval]

-

Ok.
But my forhead.conf ?
.. not changed

-
+ant.home
+jelly.home
+tools.jar

=[root.jelly] org.apache.commons.jelly.Jelly

[root]

[root.jelly]
  ${ant.home}/lib/*.jar
  ${jelly.home}/lib/*.jar
  ${jelly.home}/custom/*.jar

-



-Original Message-
From: Marc DEXET
To: ''Jakarta Commons Users List ' '
Sent: 12/23/03 10:45 PM
Subject: RE: RE : Jelly and forehead problem

Hello people.
I have partially solutionned my previous problem.
Jelly was unable to find the right .jar, because of I had not build
jelly-tags (sorry I'm new in jakarta world :0)

So don't forget maven tags:build !

That's almost ok, and I don't talk about sun lib ...

My next probem is always forehead;
I'm using ths example script, but it doesn't work.



-

[EMAIL PROTECTED] bin]# java -Djelly.home=/usr/local/jelly/bin/jelly
-Dtools.jar=/opt/java/lib/tools.jar -Dant.home=/opt/obox/ant/bin/ant
-Dforehead.conf.file=/usr/local/jelly/bin/forehead.conf -cp
/usr/local/jelly/lib/forehead-1.0-beta-2.jar
com.werken.forehead.Forehead $*
java.lang.NullPointerException
at com.werken.forehead.Forehead.loadGlob(Forehead.java:374)
at com.werken.forehead.Forehead.load(Forehead.java:317)
at com.werken.forehead.Forehead.config(Forehead.java:245)
at com.werken.forehead.Forehead.config(Forehead.java:131)
at com.werken.forehead.Forehead.main(Forehead.java:571)



-


Some ideas ?

Thanks

Marc DeXeT

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: RE : Jelly and forehead problem

2003-12-23 Thread Paul Libbrecht
Marc,



On 23-Dec-03, at 22:45 Uhr, Marc DEXET wrote:
I have partially solutionned my previous problem.
Jelly was unable to find the right .jar, because of I had not build
jelly-tags (sorry I'm new in jakarta world :0)
So don't forget maven tags:build !
Cool, that's fixed in the documentation on the website now!


My next probem is always forehead;
I'm using ths example script, but it doesn't work.
Allow me to ask why you want to use forehead imperatively ?
I know jelly works very fine with a flat classpath...
e.g. something like the following works:
java -classpath `find . -name *.jar | tr \n :` \
org.apache.commons.jelly.Jelly \
file.jelly \
arg1 arg2 ...
presuming all the jars you need are in the current directory or  
somewhere below it.
(instead of . after the find, I would hope /usr/local/jelly would do  
as well).

Paul

PS: using $* in a command-line makes no sense to me... you would be  
relying on the arguments of the shell you are inputting to... ($*  
means, in a bourne-shell, the space-separated concatenation of  
arguments, very useful for scripts).


--- 
-
-

[EMAIL PROTECTED] bin]# java -Djelly.home=/usr/local/jelly/bin/jelly
-Dtools.jar=/opt/java/lib/tools.jar  
-Dant.home=/opt/obox/ant/bin/ant
-Dforehead.conf.file=/usr/local/jelly/bin/forehead.conf -cp
/usr/local/jelly/lib/forehead-1.0-beta-2.jar
com.werken.forehead.Forehead $*
java.lang.NullPointerException
at com.werken.forehead.Forehead.loadGlob(Forehead.java:374)
at com.werken.forehead.Forehead.load(Forehead.java:317)
at com.werken.forehead.Forehead.config(Forehead.java:245)
at com.werken.forehead.Forehead.config(Forehead.java:131)
at com.werken.forehead.Forehead.main(Forehead.java:571)

--- 
-
-

Some ideas ?

Thanks

Marc DeXeT

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [net] socket timed out BEFORE timeout exceed with commons net telnet

2003-12-23 Thread Daniel F. Savarese

This one slipped by me because it didn't have a [net] prefix in the
subject (I added it to the reply).

In message [EMAIL PROTECTED]
r.hu, =?iso-8859-2?Q?Sebesty=E9n_Zolt=E1n?= writes:
I've set TelnetClient's timeout to 5000 millisecs to make sure that I =
have enought time to read  when I read some input char by char from the =
server I've connected to. *Most* of the time it works, however sometimes =
the socket throws a java.net.SocketTimeoutException *before* the actual =
timeout exceed, mostly instantly after the read method has been called. =
Please tell me what do think the problem can be. Here's the stack trace =

This doesn't look like something we can do anything about since the
Commons Net code isn't throwing the exception.  The precision of
timeouts on socket II/O is implementation dependent.  Your only
recourse may be to increase the timeout.

daniel



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]