users@jaxb.java.net

JAXB and attribut error messages

From: Tim Davidson <tim.davidson_at_greenhatconsulting.com>
Date: Thu, 12 Jun 2003 10:58:11 +0100

Hello people,
 
 Is is possbile to validate single attributes without encapsulating them in complex-types?
 what we would like to do is
 if( validator.validate( logonImpl.getUserID() ) )
 {
   System.out.println("our error message");
 }
 where UserID is a string attribute of logon.

 i.e.

<xs:complexType name="Logon">
                <xs:attribute name="userID" type="xs:string" minOccurs="0"/>
</xs:complexType>

 our current solution is to encapsulate the attribute in a complex type, but this is not a nice solution and we would like to remove this.
i.e.

<xs:complexType name="Logon">
                <xs:attribute name="userID" type="userIDComplexType" minOccurs="0"/>
</xs:complexType>

 alternativly, is there a way to obtain the attribute which fails so that we can implement our own error messages?

 many thanks.