cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Josh2007 <>
Subject Re: How to get same function as java loadDocument(cocoon:/your.pipeline) in javascript flow?
Date Sun, 07 Oct 2007 11:33:09 GMT

Everything works fine with the function.

I've been able to retrieve my xml and to fetch the required node.
Problem, I can't fetch any nodeValue.

To check, I save the node.nodeValue content in a session attribute and try
to get this attribute content back to the browser. Each time I get an empty
If I ask for the nodeName or node attribute, I get the required result. It
only fails with nodeValue or data.

Here's my flowscript, based on the link you sent to me. Hopefully you know
what I'm doing wrong :

// loadDocument() reads in an XML file and returns a DOM Document. 
function loadDocument(uri) {
var parser = null;
var source = null;
var resolver = null;
try {
parser =
resolver =
source = resolver.resolveURI(uri);
var is = new;
return parser.parseDocument(is);
} finally {
if (source != null) resolver.release(source);
if (parser != null) cocoon.releaseComponent(parser);
if (resolver != null) cocoon.releaseComponent(resolver);

function getCaptchaUserEntry() {
  // retrieve the XML
  var xml = loadDocument("cocoon:/get-stream");
  // get the root element:
  var root = xml.getDocumentElement();
  // get captcha elements (actually only 1 captcha element is allowed in the
  var captchaUserEntries = root.getElementsByTagName("captcha");
  // get captcha node
  for (var i = 0; i < captchaUserEntries.getLength(); i++) {
      var captchaUserEntry = captchaUserEntries.item(i);
  // get required content
  var captchaUserContent = captchaUserEntry.nodeValue;
  // save in session - to debugg
  var session = cocoon.session;
  session.setAttribute("captcha-result", captchaUserContent);
  // ---------------------------
  var parameters = null;
  parameters = {
      "captcha-result": captchaUserContent,
  cocoon.sendPage("check-session", parameters);



View this message in context:
Sent from the Cocoon - Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message