cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vilya Harvey <vi...@lineone.net>
Subject Validate an XML document in a flowscript
Date Wed, 16 Jun 2004 14:19:16 GMT
Hi all,

I'm using CForms and the binding framework to edit an XML document. That's 
working great. What I'd like to do is validate the document against an XML 
Schema after it's been updated with the values from the form. How can I 
achieve this?

The flowscript which controls the form at the moment looks like this (copied 
heavily from the cocoon samples):

	function enterForecasts(form)
	{
	  // parse the document to a DOM-tree
	  var documentObj = loadDocument("sampledata.xml");

	  // bind the document data to the form
	  form.load(documentObj);
	  // show the form to the user until it is validated successfully
	  form.showForm("form-display-pipeline");
	  // bind the form's data back to the document
	  form.save(documentObj);

	  // save the DOM-tree back to an XML file, the makeTargetURI
	  // function makes a modified filename so that the
	  // original document is not overwritten
	  saveDocument(documentObj, makeTargetURI(documentURI));

	  cocoon.sendPage("form-success-pipeline");
	}

What I'd like to be able to do is insert some code after the form.save(...) 
line which validates the form, and loops back to the form.load(...) line if 
validation fails. Any suggestions?

Thanks in advance,

Vil.
-- 
             __
    o|   _. /  \|o._  _  _ ._  _  ._  _ _|_
\/ ||\/(_|| (|/||| |(/_(_)| |(/_o| |(/_ |_
      /     \__
http://website.lineone.net/~vilya


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message