users@jaxb.java.net

[ANN] jaxb-verification - object-level validation package for JAXB

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Tue, 12 Oct 2004 13:28:23 +0200

Hi.

I'm glad to announce the early release of jaxb-verification.

Project location: http://jaxb-verification.dev.java.net/.

What can jaxb-verification do?

It can diagnose problems in your object structures - with precise
location and diagnostic information. With jaxb-verification, you will
know exactly, where and what.

What?

The jaxb-verification package defines extensive hierarchies of datatype
and structural problems that will help you diagnose and report errors.

For instance, if the value violates <xs:length value="9"/> facet, you
will not only get a message like "The value (abcd) has wrong length (the
length is 4, the allowed length is 9).". You will be also provided with
a WrongLengthProblem object, carrying information about the value that
failed validation, effective length and expected length.

Where?

With the object-level and collection entry level event locators, you
will know:
     * object that has an erroneous property;
     * name of the property;
     * index of the erroneous entry (for collection properties);
     * locator of the parent object (if object is validated in a context
of parent object).

Moreover, you are provided with JXPath and EL expressions which may also
come handy when locating the source of the problem.

A small example

Consider the following XML Schema fragment:

   <xs:element name="root" type="rootType"/>

   <xs:complexType name="rootType">
     <xs:sequence>
       <xs:element name="elementWithListAttribute1"
type="elementWithListAttribute1" minOccurs="0"/>
     </xs:sequence>
   </xs:complexType>

   <xs:complexType name="elementWithListAttribute1">
     <xs:attribute name="list1" type="listType1" use="optional"/>
   </xs:complexType>

   <xs:simpleType name="listType1">
     <xs:list itemType="patternType1"/>
   </xs:simpleType>

   <xs:simpleType name="patternType1">
     <xs:restriction base="xs:string">
       <xs:length value="9"/>
       <xs:pattern value="[A-Z]{2}([0-9]|[A-Z]){7}"/>
     </xs:restriction>
   </xs:simpleType>

And an object structure which is created as follows:

final Root root = new RootImpl();
root.setElementWithListAttribute1(new ElementWithListAttribute1Impl());
root.getElementWithListAttribute1().getList1().add("abcd");

Below is the message of the verification event reported by the object
verifier:

Object:
de.fzi.dbs.verification.tests.one.impl.ElementWithListAttribute1Impl_at_8bdcd2.
Field: List1.
Entry index: 0.
EL: ElementWithListAttribute1.List1[0]
JXPath: ElementWithListAttribute1/List1[0].
Problem:
The value (abcd) has wrong length (the length is 4, the allowed length
is 9).

Please see http://jaxb-verification.dev.java.net/ for more details.

Bye.
/lexi



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net