cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vilya Harvey <>
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
	  // show the form to the user until it is validated successfully
	  // bind the form's data back to the document;

	  // 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));


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

Thanks in advance,

    o|   _. /  \|o._  _  _ ._  _  ._  _ _|_
\/ ||\/(_|| (|/||| |(/_(_)| |(/_o| |(/_ |_
      /     \__

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

View raw message