Dom to Javascript object

2008-02-28 Thread Tobia Conforto

Hello

Is there an API to translate a Dom object to a structure of Javascript  
objects and arrays?


For example, if I have the root Document object for this XML:


  
John Smith
[EMAIL PROTECTED]
  
  
Fred Bloggs
[EMAIL PROTECTED]
  


Is there an API somewhere that will translate it to a Javascript  
object, so that I can assert things like:


[EMAIL PROTECTED] == "123"
myXml.card.length == 2
myXml.card[0].name == "John Smith"
myXml.card[0].email == "[EMAIL PROTECTED]"
myXml.card[1].name == "Fred Bloggs"
myXml.card[1].email == "[EMAIL PROTECTED]"

(This is just an example, I'm sure there's ambiguities with this model.)

Alternatively, what is the standard Cocoon way of processing XML data  
in Flowscript?



Tobia

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



Re: Dom to Javascript object

2008-02-28 Thread Joerg Heinicke

On 28.02.2008 06:04, Tobia Conforto wrote:

Is there an API to translate a Dom object to a structure of Javascript 
objects and arrays?


Look for E4X (Ecmascript for XML), it's an official standard. It seems 
latest Rhino 1.6R7 has support for it.


Joerg

http://en.wikipedia.org/wiki/E4X
http://www.w3schools.com/e4x/default.asp
http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Processing_XML_with_E4X
http://www.mozilla.org/rhino/download.html

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



Re: Cocoon, JX Temaplte and UTF-8

2008-02-28 Thread Joerg Heinicke

On 27.02.2008 16:06, Magnus Haraldsen Amundsen wrote:

Yes, I tried the .toString("UTF-8), but that gave the same result. I've also 
tried to create the String using:
String myUTF8String = new String(byteArrayOutputStream.toByteArray(), "UTF-8");

Maybe this could be solved by using some other Output/InputStream or something?


Could it be that the Model.write() already does some conversion? You can 
try to write it directly into an FileOutputStream and try to figure out 
in which encoding it is (put some special characters into the RDF). Can 
you show a few more details like the Javascript code?


Joerg

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



RE: Cocoon, JX Temaplte and UTF-8

2008-02-28 Thread Magnus Haraldsen Amundsen
We use a spring-apples, in this case a StatelessAppleController, instead
of FlowScript, and the code looks like this:

http://pastebin.com/m571480c6

I've highlighted the lines that I think could have effect on the
encoding.

The strange thing is that this code works just fine on a Linux machine,
but not on my Windows machine. Probably because of different default
system encoding. 

The "result-list" in the Map is later on used in a jx-template like
this:

http://apache.org/cocoon/templates/jx/1.0"/>

If that jx-template could read byte arrays into text, that would solve
it I think, but I haven't found any ways to do that.

- Magnus



-Original Message-
From: Joerg Heinicke [mailto:[EMAIL PROTECTED] 
Sent: 28. februar 2008 14:12
To: users@cocoon.apache.org
Subject: Re: Cocoon, JX Temaplte and UTF-8

> Maybe this could be solved by using some other Output/InputStream or
something?

Could it be that the Model.write() already does some conversion? You can

try to write it directly into an FileOutputStream and try to figure out 
in which encoding it is (put some special characters into the RDF). Can 
you show a few more details like the Javascript code?

Joerg
IMPORTANT NOTICE:
This message may contain confidential information.
If you have received this e-mail in error, do not use, copy or
distribute it. Do not open any attachments. Delete it immediately from
your system and notify the sender promptly by e-mail that you
have done so. Thank you.


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



Setting a form field value as an empty string?

2008-02-28 Thread Derek Hohls
(Using Cocoon 2.1.8)
 
I'd like to be able to set the initial, default value of a form to be an empty 
string;
at the moment, if the user does not fill in a value, then it gets treated as a 
NULL
value when passed to the database.
 
I have tried:

and
 
 
but am still getting a NULL result.
 
Any help is appreciated.
 
Thanks
Derek

-- 
This message is subject to the CSIR's copyright terms and conditions, e-mail 
legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at 
http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their 
support.



Re: Newer FOP to Cocoon 2.1.11

2008-02-28 Thread Lehtonen, Mika




Hi Kai and others who are using or would wanted to use fop-0.9.x in
Cocoon 2.1.x,

this is just an informative message.

I had casual difficulties with fop-0.94 in cocoon-2.1.11 especially
with the tables. They caused some extra page breaks and even the
content of one row's parallel cells could divide into two rows so that
row1 had cell1 and row2 had cell2. I think there are some bugs in 0.94
which will be fixed in 0.95.

Anyway, I downloaded newer one from the trunk and hit my head against
the wall many times but finally got it working. It seems to be working
at least in 2.1.11 if the xmlgraphics-commons is updated to 1.3 version
shipped with the fop.

And now after few tests, I haven't found anything to complain about;
all the problems with the tables seems to be vanished away.  :-)  :-D  :-) 

have a nice day !
- mika -

P.S. Kai, I did some fine tuning in Tomcat, also with that PermGen Size
and now it is really rocking. I can plot 1400x1400mm 300 dpi images out
into pdf within less than 3 minutes. (Dell PE1950, 2,5 Ghz Xeon
quadcore, 4G RAM). So I wouldn't say that this current fop is the
world's weakest graphics renderer. 
;-) 


Kai Mütz kirjoitti:

  Lehtonen, Mika <> wrote:
  
  
I am afraid it won't help. I already increased the heap size to
2,5/3,5g min/max, but I still can't plot any pdf including raster
out, whether the raster is at any size. It seems like something is
totally broken but I can't imagine that a user could get the whole
system to crash.

  
  
You should try to increase the PermGen space, e.g. -XX:MaxPermSize=256m

  
  
I am printing large images; the FOP manual said: do not use large
images. So I don't know is this project of mine sane, but it seemed
to be working nice with 12000x12000x24 rasters until I got creedy and
add the pixel amount. It crashed and after that, I haven't been able
to print out a single raster through FOP.

  
  
I don't have any experiences with such large images. Sorry.

-
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: Setting a form field value as an empty string?

2008-02-28 Thread Antonio Gallardo

Hi Derek,

Hope this helps:

https://issues.apache.org/jira/browse/COCOON-1879

Best Regards,

Antonio Gallardo.

Derek Hohls escribió:

(Using Cocoon 2.1.8)
 
I'd like to be able to set the initial, default value of a form to be 
an empty string;
at the moment, if the user does not fill in a value, then it gets 
treated as a NULL

value when passed to the database.
 
I have tried:


and
 
 
but am still getting a NULL result.
 
Any help is appreciated.
 
Thanks

Derek


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



Re[2]: Cocoon, JX Temaplte and UTF-8

2008-02-28 Thread Martin Heiden
Magnus,

  I'd also suggest to write the output of m.write() to a file, to
  inspect, if this outputs UTF-8 or ISO-8859-1. If it is UTF-8 add
  the charset to bout.toString().

  If you only deal with UTF-8, you should make sure that the
  default-charset of the application server und cocoons settings are
  utf-8 too.
  (http://cocoon.apache.org/2.2/1366_1_1.html)

  The difference between windows and linux, you noticed, is caused by
  the different default encodings. (Windows cp1252, Linux UTF-8?)

  The bout.toString("UTF-8") only ensures that the constructed string
  honors the encoding of the ByteArrayOutputStream. This has nothing
  to do with the output, it just ensures that the ByteArray is
  converted properly to a Java string.

  If you have a correct string, JX Template shouldn't mess around
  with the charset. Try to debug your apple-class and take a look at
  the string, before it is added to bizData.

  Wait! This could be another problem...

  Take a closer look at the ByteArray. It may be that you receive an
  UTF-8 encoded File with BOM. Java can't deal with that. You would
  have to cut all characters from the string that precede the first
  "<", before adding the string to bizData. That would explain the
  exceptions you received, but that wouldn't work on linux either.

Good luck!

  Martin


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



Re: Setting a form field value as an empty string?

2008-02-28 Thread Derek Hohls
Antonio
 
Does this mean that the patch is available in the version 2.1.10?
 
I have also come to the conclusion that this still does not help me.
What I need is some way to tell Cocoon to pass an empty string
(not "whitespace" per se) and not a NULL from an empty field:
that might require another patch e.g.
 
 - default (current) behaviour
 - overrides a null value from an
empty field with an empty string instead when processing values
returned from the form.
 
This option will (obviously) only be applicable to string-type fields.
 
Derek


>>> On 2008/02/28 at 07:19, in message <[EMAIL PROTECTED]>,
Antonio Gallardo <[EMAIL PROTECTED]> wrote:
Hi Derek,

Hope this helps:

https://issues.apache.org/jira/browse/COCOON-1879 

Best Regards,

Antonio Gallardo.

Derek Hohls escribió:
> (Using Cocoon 2.1.8)
>  
> I'd like to be able to set the initial, default value of a form to be

> an empty string;
> at the moment, if the user does not fill in a value, then it gets 
> treated as a NULL
> value when passed to the database.
>  
> I have tried:
> 
> and
>  
>  
> but am still getting a NULL result.
>  
> Any help is appreciated.
>  
> Thanks
> Derek

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


-- 
This message is subject to the CSIR's copyright terms and conditions, e-mail 
legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at 
http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their 
support.



Re: IncludeTransformer

2008-02-28 Thread Andy Stevens

Sébastien Geindre wrote:

How can i log the http header of a request made by CIcludeTransformer ?


One possibility would be to use Axis' tcpmon utility 
(http://ws.apache.org/axis/java/user-guide.html#AppendixUsingTheAxisTCPMonitorTcpmon)? 
 Just change the CInclude to use localhost and configure tcpmon to 
forward requests to the real service.



Andrew.
--
http://pseudoq.sourceforge.net/  Open source java Sudoku solver

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