Package org.xml.sax

Examples of org.xml.sax.SAXParseException


    public void testWarningRethrowsException()
        throws Exception
    {
        final SAXConfigurationHandler handler = new SAXConfigurationHandler();
        final SAXParseException spe = new SAXParseException( "", null );
        try
        {
            handler.warning( spe );
        }
        catch( final SAXException se )
View Full Code Here


    public void testErrorRethrowsException()
        throws Exception
    {
        final SAXConfigurationHandler handler = new SAXConfigurationHandler();
        final SAXParseException spe = new SAXParseException( "", null );
        try
        {
            handler.error( spe );
        }
        catch( final SAXException se )
View Full Code Here

    public void testFatalRethrowsException()
        throws Exception
    {
        final SAXConfigurationHandler handler = new SAXConfigurationHandler();
        final SAXParseException spe = new SAXParseException( "", null );
        try
        {
            handler.fatalError( spe );
        }
        catch( final SAXException se )
View Full Code Here

    private void addError(SAXParseException ex) {
        addError(getErrorMessage(ex), ex);
    }

    private static SAXParseException getSAXParseException(XMLParseException ex) {
        return new SAXParseException(ex.getMessage(), ex.getPublicId(), ex.getLiteralSystemId(), ex
            .getLineNumber(), ex.getColumnNumber(), ex.getException());
    }
View Full Code Here

        return msg;
    }

    private static SAXParseException getSAXParseException(XMLParseException ex) {
        return new SAXParseException(ex.getMessage(), ex.getPublicId(), ex.getLiteralSystemId(), -1, -1, ex
            .getException());
    }
View Full Code Here

        assertEquals("org.objectweb.celtix.test.custom", ts.getPackageName());
    }
   
    public void testErrorHandler() {
        TypeSchemaErrorHandler eh = new TypeSchema.TypeSchemaErrorHandler();
        SAXParseException spe = new SAXParseException(null, null, null, 0, 0);
       
        try {
            eh.error(spe);
            fail("Expected SAXParseException not thrown.");
        } catch (SAXParseException ex) {
View Full Code Here

   * Assert a {@code SaxError} based on the given {@code SourcePosition}
   * and message.
   */
  protected final void assertParseAlert(SourcePosition pos, String message) {
    assertAlert(new SaxAlert(pos, Severity.ERROR,
                             new SAXParseException(message, null)));
  }
View Full Code Here

            StringBuffer msg = new StringBuffer();
            msg.append("Failed to parse: ").append(file.getAbsolutePath()).append(": ").append(sax.getMessage());

            if (sax instanceof SAXParseException)
            {
               SAXParseException parseException = (SAXParseException) sax;
               msg.append(" [").append(parseException.getLineNumber()).append(",").append(
                     parseException.getColumnNumber()).append("]");
            }

            if (failIfInvalid)
            {
               fail(msg.toString());
View Full Code Here

     *
     * @param message The error message.
     */
    private SAXParseException makeException (String message)
    {
  SAXParseException e;
  if (locator != null) {
      return new SAXParseException(message, locator);
  } else {
      return new SAXParseException(message, null, null, -1, -1);
  }
    }
View Full Code Here

  int length = attributes.getLength();
  if (length != 0) {
      try {
                attSet = AttributeSet.createAttributeSet1(attributes);
      } catch (DOMException ex) {
    throw new SAXParseException(getMessage("XDB-002",
                        new Object[] { ex.getMessage() }), locator, ex);
      }
  }

  //
  // Then create the element, associate its attributes, and
  // stack it for later addition.
  //
        ElementNode e = null;
  try {
            e = (ElementNode) document.createElementEx(qName);
  } catch (DOMException ex) {
      throw new SAXParseException(getMessage("XDB-004",
                    new Object[] { ex.getMessage() }), locator, ex);
  }
  if (attributes instanceof AttributesEx) {
      e.setIdAttributeName(
    ((AttributesEx)attributes).getIdAttributeName());
View Full Code Here

TOP

Related Classes of org.xml.sax.SAXParseException

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.