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";

        }

Reply via email to