public ValidationException makeException() { if (exception != null) { exception.maybeSetLocation(this); return exception; } ValidationException ve = new ValidationException(this); if (errorCode == null) { ve.setErrorCode("FORG0001"); } else { ve.setErrorCodeQName(errorCode); } ve.setHasBeenReported(hasBeenReported); exception = ve; return ve; }
/** * Report the end of an element (the close tag) */ public void endElement (String uri, String localname, String rawname) throws SAXException { //System.err.println("ReceivingContentHandler#End element " + rawname); try { flush(); receiver.endElement(); } catch (ValidationException err) { err.maybeSetLocation(ExpressionLocation.makeFromSax(locator)); if (!err.hasBeenReported()) { try { pipe.getErrorListener().fatalError(err); } catch (TransformerException e) { // } } err.setHasBeenReported(); throw new SAXException(err); } catch (XPathException err) { throw new SAXException(err); } }
/** * Report the end of an element (the close tag) */ public void endElement (String uri, String localname, String rawname) throws SAXException { //System.err.println("ReceivingContentHandler#End element " + rawname); try { flush(); receiver.endElement(); } catch (ValidationException err) { err.setLocator(locator); if (!err.hasBeenReported()) { try { pipe.getErrorListener().fatalError(err); } catch (TransformerException e) { // } } err.setHasBeenReported(); throw new SAXException(err); } catch (XPathException err) { throw new SAXException(err); } }
public ValidationException makeException() { ValidationException ve = new ValidationException(message); ve.setConstraintReference(schemaPart, constraintName, clause); ve.setErrorCode(errorCode == null ? "FORG0001" : errorCode); return ve; }
/** * Get a ValidationFailure object containing information from this ValidationException * @return a ValidationFailure object */ public ValidationFailure getValidationFailure() { if (failure != null) { return failure; } else { ValidationFailure failure = new ValidationFailure(getMessage()); failure.setErrorCodeQName(getErrorCodeQName()); failure.setLocator(getLocator()); return failure; } }
value, DummyNamespaceResolver.getInstance(), context.getConfiguration().getNameChecker()); if (err != null) { ValidationException verr = new ValidationException( "Attribute value " + Err.wrap(value, Err.VALUE) + " does not the match the required type " + schemaType.getDescription() + ". " + err.getMessage()); verr.setErrorCode("XTTE1540"); verr.setLocator(this); throw verr; } catch (ValidationException e) { XPathException err = XPathException.makeXPathException(e); String errorCode = e.getErrorCodeLocalPart(); if (errorCode == null) { errorCode = (validationAction==Validation.STRICT ? "XTTE1510" : "XTTE1515");
value, DummyNamespaceResolver.getInstance(), context.getConfiguration().getNameChecker()); if (err != null) { ValidationException ve = new ValidationException( "Attribute value " + Err.wrap(value, Err.VALUE) + " does not match the required type " + schemaType.getDescription() + ". " + err.getMessage()); ve.setErrorCode("XTTE1540"); throw ve; throw new ValidationException(ure); } catch (ValidationException e) { XPathException err = XPathException.makeXPathException(e); String errorCode = e.getErrorCodeLocalPart(); if (errorCode == null) { errorCode = (validationAction==Validation.STRICT ? "XTTE1510" : "XTTE1515");
value, DummyNamespaceResolver.getInstance(), context.getConfiguration().getNameChecker()); if (err != null) { ValidationException verr = new ValidationException( "Attribute value " + Err.wrap(value, Err.VALUE) + " does not the match the required type " + schemaType.getDescription() + ". " + err.getMessage()); verr.setErrorCode("XTTE1540"); verr.setLocator((SourceLocator)this); throw verr;
/** * Get the typed value corresponding to a given string value, assuming it is * valid against this type * * @param value the string value * @param resolver a namespace resolver used to resolve any namespace prefixes appearing * in the content of values. Can supply null, in which case any namespace-sensitive content * will be rejected. * @param nameChecker checks names against XML 1.0 or XML 1.1 syntax rules * @return an iterator over the atomic sequence comprising the typed value. The objects * returned by this SequenceIterator will all be of type {@link net.sf.saxon.value.AtomicValue} */ public SequenceIterator getTypedValue(CharSequence value, NamespaceResolver resolver, NameChecker nameChecker) throws ValidationException { throw new ValidationException("Cannot validate a string against an external object type"); }
config.checkTypeDerivationIsOK(xsiType, schemaType, 0); } catch (SchemaException e) { ValidationException ve = new ValidationException("The specified xsi:type " + xsiType.getDescription() + " is not validly derived from the required type " + schemaType.getDescription()); ve.setConstraintReference(1, "cvc-elt", "4.3"); ve.setErrorCode(instr.isXSLT() ? "XTTE1515" : "XQDY0027"); ve.setLocator((Locator)instr); throw ve;
o.getStringValueCS(), DummyNamespaceResolver.getInstance(), context.getConfiguration().getNameChecker()); if (err != null) { throw new ValidationException("Attribute value " + Err.wrap(o.getStringValueCS(), Err.VALUE) + " does not the match the required type " + schemaType.getDescription() + ". " + } catch (ValidationException e) { XPathException err = XPathException.makeXPathException(e); err.setErrorCode(e.getErrorCodeLocalPart()); err.setXPathContext(context); err.setLocator(this);
/** * Constructor supplying a double * @param in the value of the DecimalValue */ public DecimalValue(double in) throws ValidationException { try { value = stripTrailingZeros(new BigDecimal(in)); } catch (NumberFormatException err) { // Must be a special value such as NaN or infinity ValidationException e = new ValidationException( "Cannot convert double " + Err.wrap(in+"", Err.VALUE) + " to decimal"); e.setErrorCode("FOCA0002"); throw e; } typeLabel = BuiltInAtomicType.DECIMAL; }
/** * Returns the String representation of this Exception * @return the String representation of this Exception **/ public String toString() { StringBuffer sb = new StringBuffer("ValidationException: "); String message = getMessage(); if (message != null) { sb.append(message); } return sb.toString(); }
if (err.getLineNumber() == -1) { err.setLocator(locator);
return targetType.getTypedValue(value.getStringValueCS(), nsResolver, rules); } catch (ValidationException e) { e.setErrorCode("FORG0001"); throw e;
public int getColumnNumber() { SourceLocator loc = getLocator(); if (columnNumber == -1 && loc != null && loc != this) { return loc.getColumnNumber(); } else{ return columnNumber; } }
/** * Receive notification of the end of a document */ public void endDocument () throws SAXException { // System.err.println("RCH: end document"); try { flush(); receiver.endDocument(); receiver.close(); } catch (ValidationException err) { err.setLocator(locator); throw new SAXException(err); } catch (XPathException err) { throw new SAXException(err); } }
XPathException err = new XPathException(e); err.setXPathContext(context); if (e.getLineNumber() == -1) { err.setLocator(this); } else { err.setLocator(e); err.setErrorCode(e.getErrorCodeLocalPart()); throw err; } catch (XPathException e) {
ValidationFailure vf = new ValidationFailure(err.getMessage()); vf.setErrorCode(err.getErrorCodeLocalPart()); if (vf.getErrorCode() == null) { vf.setErrorCode("FORG0001");
/** * Get the location of the error in terms of a path expressed as a string * * @return the location, as a path. The result format is similar to that of the fn:path() function */ /*@Nullable*/ public String getPath() { AbsolutePath ap = getAbsolutePath(); if (ap == null) { NodeInfo node = getNode(); if (node != null) { return Navigator.getPath(node); } else { return null; } } else { return ap.getPathUsingAbbreviatedUris(); } }