Example #1
0
 /*
  * Validates the specified input.
  *
  * <p/>
  * This is just a convenience method of:
  * <pre>
  * validate(source,null);
  * </pre>
  *
  * @see #setErrorHandler(ErrorHandler)
  */
 public void validate(javax.xml.transform.Source source)
 {        //throws SAXException, IOException {
     validate(source, null);
 }
Example #2
0
 /*
  * Validates the specified input and send the augmented validation
  * result to the specified output.
  *
  * <p/>
  * This method places the following restrictions on the types of
  * the {@link Source}/{@link Result} accepted.
  *
  * <h4>{@link Source}/{@link Result} accepted:</h4>
  * <table border='1'>
  * <thead>
  *  <tr>
  *   <td></td>
  *   <td>{@link javax.xml.transform.sax.SAXSource}</td>
  *   <td>{@link javax.xml.transform.dom.DOMSource}</td>
  *   <td>{@link javax.xml.transform.stax.StAXSource}</td>
  *   <td>{@link javax.xml.transform.stream.StreamSource}</td>
  *  </tr>
  * </thead>
  * <tbody>
  *  <tr>
  *   <td><tt>null</tt></td>
  *   <td>OK</td>
  *   <td>OK</td>
  *   <td>OK</td>
  *   <td>OK</td>
  *  </tr>
  *  <tr>
  *   <td>{@link javax.xml.transform.sax.SAXResult}</td>
  *   <td>OK</td>
  *   <td>Err</td>
  *   <td>Err</td>
  *   <td>Err</td>
  *  </tr>
  *  <tr>
  *   <td>{@link javax.xml.transform.dom.DOMResult}</td>
  *   <td>Err</td>
  *   <td>OK</td>
  *   <td>Err</td>
  *   <td>Err</td>
  *  </tr>
  *  <tr>
  *   <td>{@link javax.xml.transform.stax.StAXResult}</td>
  *   <td>Err</td>
  *   <td>Err</td>
  *   <td>OK</td>
  *   <td>Err</td>
  *  </tr>
  *  <tr>
  *   <td>{@link javax.xml.transform.stream.StreamResult}</td>
  *   <td>Err</td>
  *   <td>Err</td>
  *   <td>Err</td>
  *   <td>OK</td>
  *  </tr>
  * </tbody>
  * </table>
  *
  * <p/>
  * To validate one {@link Source} into another kind of {@link Result}, use the identity transformer
  * (see {@link javax.xml.transform.TransformerFactory#newTransformer()}).
  *
  * <p/>
  * Errors found during the validation is sent to the specified
  * {@link ErrorHandler}.
  *
  * <p/>
  * If a document is valid, or if a document contains some errors
  * but none of them were fatal and the {@link ErrorHandler} didn't
  * throw any exception, then the method returns normally.
  *
  * @param source
  *      XML to be validated. Must not be null.
  *
  * @param result
  *      The {@link Result} object that receives (possibly augmented)
  *      XML. This parameter can be null if the caller is not interested
  *      in it.
  *
  *      Note that when a {@link javax.xml.transform.dom.DOMResult} is used,
  *      a validator might just pass the same DOM node from
  *      {@link javax.xml.transform.dom.DOMSource} to
  *      {@link javax.xml.transform.dom.DOMResult}
  *      (in which case <tt>source.getNode()==result.getNode()</tt>),
  *      it might copy the entire DOM tree, or it might alter the
  *      node given by the source.
  *
  * @throws IllegalArgumentException
  *      If the {@link Result} type doesn't match the {@link Source} type,
  *      or if the specified source is not a
  *      {@link javax.xml.transform.sax.SAXSource},
  *      {@link javax.xml.transform.dom.DOMSource},
  *      {@link javax.xml.transform.stax.StAXSource} or
  *      {@link javax.xml.transform.stream.StreamSource}.
  *
  * @throws SAXException
  *      If the {@link ErrorHandler} throws a {@link SAXException} or
  *      if a fatal error is found and the {@link ErrorHandler} returns
  *      normally.
  *
  * @throws IOException
  *      If the validator is processing a
  *      {@link javax.xml.transform.sax.SAXSource} and the
  *      underlying {@link org.xml.sax.XMLReader} throws an
  *      {@link IOException}.
  *
  * @throws NullPointerException
  *      If the <tt>source</tt> parameter is null.
  *
  * @see #validate(Source)
  */
 public abstract void validate(javax.xml.transform.Source source, javax.xml.transform.Result result);