Thank you Radu. So often on these fora when the "happy message" isn't appropriate one never gets a response.
For documentation purposes should anyone else encounter this problem, I've tried every combination of cursor, line number, etc. and none will give you any indicator or pointer to the problem. Paul -----Original Message----- From: Radu Preotiuc [mailto:[email protected]] Sent: Wednesday, June 03, 2009 4:50 PM To: [email protected] Subject: Re: XML validation not showing element name in error 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

