Package ca.uhn.hl7v2.validation

Examples of ca.uhn.hl7v2.validation.ValidationException


        }           
        catch (SAXException se)
        {
            log.error("Unable to parse message - please verify that it's a valid xml document");
            log.error("SAXException: ", se);
            validationErrors.add(new ValidationException("Unable to parse message - please verify that it's a valid xml document" + " [SAXException] " + se.getMessage()));
           
        }
        catch (IOException e)
        {
            log.error("Unable to parse message - please verify that it's a valid xml document");
            log.error("IOException: ", e);
            validationErrors.add(new ValidationException("Unable to parse message - please verify that it's a valid xml document" + " [IOException] " + e.getMessage()));
        }
        return (ValidationException[]) validationErrors.toArray(new ValidationException[0]);

    }
View Full Code Here


        {
            return schemaFilename;
        }
        else
        {
            ValidationException e = new ValidationException("Unable to retrieve a valid schema to use for message validation - please check logs");
            validationErrors.add(e);
            return "";
        }
    }
View Full Code Here

    private boolean validateNamespace(Document domDocumentToValidate, List validationErrors) {
        // start by verifying the default namespace if this isn't correct the rest will fail anyway
        if (domDocumentToValidate.getDocumentElement().getNamespaceURI() == null)
        {
            ValidationException e = new ValidationException("The default namespace of the xml document is not specified - should be urn:hl7-org:v2xml");
            validationErrors.add(e);
            log.error("The default namespace of the xml document is not specified - should be urn:hl7-org:v2xml");
        }
        else
        {
            if (! domDocumentToValidate.getDocumentElement().getNamespaceURI().equals("urn:hl7-org:v2xml"))
            {
                ValidationException e = new ValidationException("The default namespace of the xml document (" + domDocumentToValidate.getDocumentElement().getNamespaceURI() + ") is incorrect - should be urn:hl7-org:v2xml");
                validationErrors.add(e);
                log.error("The default namespace of the xml document (" + domDocumentToValidate.getDocumentElement().getNamespaceURI() + ") is incorrect - should be urn:hl7-org:v2xml");
             }
             else
             {
View Full Code Here

        }

        /** Warning. */
        public void warning(SAXParseException ex) {

            validationErrors.add(new ValidationException("[Warning] "+
                           getLocationString(ex)+": "+
                           ex.getMessage() + " "));
        }
View Full Code Here

        }

        /** Error. */
        public void error(SAXParseException ex) {

            validationErrors.add(new ValidationException("[Error] "+
                           getLocationString(ex)+": "+
                           ex.getMessage() + " "));
        }
View Full Code Here

        }

        /** Fatal error. */
        public void fatalError(SAXParseException ex) throws SAXException {

            validationErrors.add(new ValidationException("[Fatal Error] "+
                           getLocationString(ex)+": "+
                           ex.getMessage() + " "));
        }
View Full Code Here

                Class c;
                try {
                    c = Class.forName(contextClassName);
                    ourContext = (ValidationContext) c.newInstance();
                } catch (Exception e) {
                    throw new ValidationException(e);
                }
            }
        }
        return ourContext;
    }
View Full Code Here

                    log.debug(shortList.length + " non-conformances");
                    for (int j = 0; j < shortList.length; j++) {
                        problems.add(shortList[j]);
                    }
                } catch (ProfileException e) {
                    problems.add(new ValidationException("Can't validate", e));
                }
            }           
        } catch (HL7Exception e) {
            problems.add(new ValidationException("Can't validate", e));
        }
       
        return (ValidationException[]) problems.toArray(new ValidationException[0]);
    }
View Full Code Here

            throw new ProfileException("Error retreiving profile " + id, e);
        }
       
        ValidationException[] result = new ValidationException[exceptions.length];
        for (int i = 0; i < exceptions.length; i++) {
            result[i] = new ValidationException(exceptions[i].getMessage(), exceptions[i]);
        }
        return result;
    }
View Full Code Here

    return failed(msg, Location.UNKNOWN);
  }

 
  protected ValidationException[] failed(String msg, Location location) {
    ValidationException ve = new ValidationException(msg, severity);
    ve.setError(getErrorCode());
    ve.setLocation(location);
    return new ValidationException[] { ve };
  }
View Full Code Here

TOP

Related Classes of ca.uhn.hl7v2.validation.ValidationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.