Nice. I don't think it is complete to actually use it for the real map validation, but this is a great start. I guess the immediate value of it is documenting the format for manual editing.

Now I am wondering where in the model lifecycle during development and runtime would it be appropriate/useful to do automated validation of the mapping? In other words where the benefit of validation would justify the overhead? The map semantical problems are rare, as most people are using the Modeler (that presumably generates a correct mapping). So I can only think of cases that would help us internally, but will not affect the end users:

* Validation as a part of map-saving unit tests
* Switching from manual XML parser to an auto-generated parser based on schema (such as JAXB; although I decided against JAXB some time ago, as it would add yet another hard dependency to Cayenne, and will require a rewrite of a piece of Cayenne that already works well. So I am just using it as an example).

Other ideas?

Andrus


On Dec 4, 2008, at 12:44 PM, Aristedes Maniatis wrote:
I've put together a preliminary schema. I am sure adjustment will be needed, but I think it is a good first cut. I'd appreciate some feedback about whether it validates your models, so please take your xxx.map.xml file and hand edit the top of it to change this:

<?xml version="1.0" encoding="utf-8"?>
<data-map project-version="3.0">

to this

<?xml version="1.0" encoding="utf-8"?>
<data-map project-version="3.0" xmlns="http://cayenne.apache.org/xml/ns/map " xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://apache.org/xml/ns/cayenne http://people.apache.org/~amaniatis/cayenneMap.xsd ">



Then please use a tool to validate this schema. Personally I use Oxygen which is really nice, but anything will do. You can even write a little Java tool to do it [1]. Ultimately that's how Cayenne Modeler will validate the XML to see that it matches the schema.

We'll need to discuss how to name the namespace, and it might be nice to put lots of documentation into the schema file itself which will help people who want to dive in.



Ari




[1] 
http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/validation/package-summary.html


-------------------------->
ish
http://www.ish.com.au
Level 1, 30 Wilson Street Newtown 2042 Australia
phone +61 2 9550 5001   fax +61 2 9550 4001
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A




Reply via email to