You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Robert Koberg <ro...@koberg.com> on 2003/08/02 17:58:10 UTC

RE: [RT] Cubist WebApp Team Organization

Hi,

Very cool stuff on all of these threads! I have another way to throw into
the mix. Perhaps it can spark some ideas?

I have been playing around with removing our apps dependence on the MSXML
SOM on client (to gain browser independence) and replacing it with (what I
call in my head) JSAXB. I started using JAXB and have really enjoyed it
which led me to think of how it could be done with JavaScript. Then along
come these threads and made me think that JSAXB could be used on both the
client in the browser and on the server with the flow.

I wonder what you guys think. 

I transform an XML Schema into a form instance and setup the form to call JS
methods on submit. I also transform the schema to JS objects and methods.
ComplexTypes become superclasses and the elements that extend the
complexType becomes the subclass. 

I am having troubles with datatyping. Some are easy, like determining if
something is a String or Boolean or not. But some leave me perplexed as to
how to check if something isValid. I have transformed the W3C Datatype
schema to give me a shell of objects to handle datatyping but not able to
create the methods. Any ideas? Any interest?

Here is a trimmed down example that handles modifying a folder site node in
our site.xml file (similar to forrest's site.xml):

/**
A base object to be extended.
*/
function _superclass_SiteNode() 
{
  _id = new _datatype_ID();
  _css = new _datatype_NCName();
  _onnav = new _datatype_boolean();

  this.set_id = set_id;
  function set_id(id) {
    _id.set(id);
    if (!_id.isValid()) {
      _id = new _datatype_ID();
      alert("Invalid ID entry!");
    }
  }
  
  this.get_id = get_id;
  function get_id() {
    return _id.get();
  }
  
  this.set_css = set_css;
  function set_css(css) {
    _css.set(css);
    if (!_css.isValid()) {
      _css = new _datatype_NCName();
      alert("Invalid CSS entry!");
    }
  }
  
  this.get_css = get_css;
  function get_css() {
    return _css.get();
  }
  
  this.set_onnav = set_onnav;
  function set_onnav(_onnav) {
    _onnav.set(_onnav);
    if (!_onnav.isValid()) {
      _onnav = new _datatype_boolean();
      alert("Invalid Show on Navigation entry!");
    }
  }
  
  this.get_onnav = get_onnav;
  function get_onnav() {
    return _onnav.get();
  }
}


/**
Superclass the folder object
*/
_folder.prototype = new _superclass_SiteNode();
_folder.prototype.constructor = _folder;
_folder.superclass = _superclass_SiteNode.prototype;

function _folder() 
{
  _index_page = new _datatype_IDREF();
  
  this.set_index_page = index_page;
  function set_index_page(index_page) {
    _index_page.set(index_page);
    if (!_index_page.isValid()) {
      _index_page = new _datatype_IDREF();
      alert("Invalid Index Page entry!");
    }
  }
  
  this.get_index_page = get_index_page;
  function get_index_page() {
    return _index_page.get();
  }
}

Best,
-Rob