No, not currently. There is definitely room for improvement as far as
this error message is concerned. Hopefully, the message is pretty clear
though and allows you to do a quick search in the document for the
offending element instance.

Radu

On Wed, 2009-06-03 at 15:10 -0400, Gillen, Paul wrote:
> I have an XSD containing an element definition:
> 
>                   <xs:element name="SEQUENCE_NUMBER">
> 
>                         <xs:simpleType>
> 
>                               <xs:restriction base="xs:long">
> 
>                                     <xs:minInclusive value="1"/>
> 
>                                     <xs:maxInclusive
> value="9999999999999"/>
> 
>                               </xs:restriction>
> 
>                         </xs:simpleType>
> 
>                   </xs:element>
> 
>  
> 
> When I try to validate XML containing:
> 
>       <SEQUENCE_NUMBER/>
> 
> I get the message:
> 
>       Invalid decimal value: expected at least one digit
> 
>  
> 
> There is no indication that this is for the SEQUENCE_NUMBER element.
> Is there any way to get that?  
> 
>  
> 
> The code:  
> 
>         try
> 
>         {
> 
>             ArrayList   validationErrors    = new ArrayList();
> 
>             XmlOptions  validationOptions   = new XmlOptions();
> 
>             validationOptions.setErrorListener(validationErrors);
> 
>             
> 
>             tempObject = (XmlObject) xClassFactoryParse.invoke(null,
> aXml);
> 
>               
> 
>             if (!tempObject.validate(validationOptions))
> 
>             {   
> 
>                 String      exMsg       =   "validation failed";
> 
>                 Iterator    iter        = validationErrors.iterator();
> 
>                 while (iter.hasNext())
> 
>                 {
> 
>                     XmlValidationError valErr =
> (XmlValidationError)iter.next();
> 
>                     exMsg   +=  "\n\t" + valErr.getMessage();
> 
>                 } 
> 
>                 return exMsg;
> 
>             }
> 
>             return "XML document is valid";
> 
>         }
> 
>         catch (Exception e)
> 
>         {
> 
>             return "Document could not be validated";
> 
>         }
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to