BizTalk Utilities CV ,   Jobs ,   Code library  
 
javax.xml.transform.dom.DOMSource Class
javax.xml.transform.dom.DOMResult Class
javax.xml.parsers.SAXParserFactory Class
javax.xml.parsers.SAXParser Class
javax.xml.parsers.DocumentBuilderFactory Class
javax.xml.parsers.DocumentBuilder Class
SAX 2.0 Features and Properties
MSMQ Mode Tool
XML for Software Configuration
XML - Basics.
RTF to XML converter 1.2
Retriving XML from a Oracle Table using the XDK for PL/SQL
'AspDoc' - Documenting your ASP code with XML
Password Encryption
Inserting Data in XML format into a table using Oracle XML SQL Utility
Java Architecture for XML Binding
XML to JTree
QuickBooks XML SDK
x++: The World's First Full XML-Based Programming Language Released!
Mobile Internet
<< XSLT
.NET and XML >>

By :Mark Wilson
I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :03/24/2008
Times viewed :116

 

The javax.xml.transform.ErrorListener Class

Members

Signature

Public methods

void

error(TransformerException exception)

void

fatalError(TransformerException exception)

void

warning(TransformerException exception)

Overview

This interface is analogous to ErrorHandler in SAX, and provides error notification for transformation. Use the setErrorListener method to register an instance of the implmentation with the Transformer. The Transformer then reports all errors and warnings through this interface.

If an application does not register an ErrorListener, errors are reported to System.err.

For transformation errors, a Transformer must use this interface instead of throwing an exception: it is up to the application to decide whether to throw an exception for different types of errors and warnings. Note however that the Transformer is not required to continue with the transformation after a call to fatalError.

Transformers may use this mechanism to report XML parsing errors as well as transformation errors.

Method Overviews

Important methods of this class are error(TransformerException exception), fatalError(TransformerException exception), warning(TransformerException exception).

Example of how to use ErrorListener

package topxml;

import javax.xml.transform.ErrorListener;

import javax.xml.transform.TransformerException;

public class ErrorListenerImpl implements ErrorListener

{

  public ErrorListenerImpl()

  {

  }

  /**

   * Receive notification of a recoverable error.

   * @param exception

   */

  public void             error(TransformerException exception)

  {

    System.out.println("Error occurred :"+exception.getMessage());

  }

   /**

   * Receive notification of a non-recoverable error.

   * @param exception

   */

  public void             fatalError(TransformerException exception)

  {

    System.out.println("Fatal Error occurred :"+exception.getMessage());

  }

   /**

   * Receive notification of a warning.

   * @param exception

   */

  public void             warning(TransformerException exception)

  {

    System.out.println("Warning occurred :"+exception.getMessage());

  }

}

Use this ErrorListenerImpl class for any errors during transformation.

transformer.setErrorListener(new ErrorListenerImpl());

String sourcesystemURI = "E:\\topxml\\persoan.xml"; //this file doesn’t exist

During transformation the error output will be :

Fatal Error occurred :File "file:///E:/topxml/persoan.xml" not found.


Rate this article on a scale of 1 to 10

Your vote :  


 

Recent Jobs

Software Developers Needed in Charl
Sr. Software Engineer - Analytics
Immediate Mainframe openings for Ch
Immediate TANDEM-TAL openings for C
Immediate ASP.NET/C# Openings for C

View all Jobs (Add yours)
View all CV (Add yours)



conference calling
swimming pool builder
spfxmasks
water softener
Teleconference
Host Department NOLIMIT Web Hosting
MSN
sunglasses


    Email TopXML  

Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP