BizTalk Utilities CV ,   Jobs ,   Code library  
 
Home Page
XALAN
org.apache.xalan.transformer.XalanProperties Class
org.apache.xalan.transformer.TrAXFilter Class
org.apache.xalan.transformer.TransformerIdentityImpl Class
org.apache.xalan.processor.TransformerFactoryImpl Class
org.apache.xalan.lib.sql.XConnection Class
javax.xml.transform.sax.TemplatesHandler Class
XALAN Getting Started with XSLTC
The Usage of XALAN
Overview of XALAN - Java
<< WCF, WS, SOAP
XHTML >>

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 :580

 

Xalan: The org.apache.xalan.xsltc.trax.DOM2SAX Class

Extends: java.lang.Object

Implements: org.xml.sax.XMLReader, org.xml.sax.Locator

Members

Signature

Public methods

int

getColumnNumber()

ContentHandler

getContentHandler()

DTDHandler

getDTDHandler()

EntityResolver

getEntityResolver()

ErrorHandler

getErrorHandler()

boolean

getFeature(java.lang.String name)

int

getLineNumber()

java.lang.Object

getProperty(java.lang.String name)

java.lang.String

getPublicId()

java.lang.String

getSystemId()

void

parse()

void

parse(InputSource unused)

void

parse(java.lang.String sysId)

void

setContentHandler(ContentHandler handler)

void

setDTDHandler(DTDHandler handler)

void

setEntityResolver(EntityResolver resolver)

void

setErrorHandler(ErrorHandler handler)

void

setFeature(java.lang.String name, boolean value)

void

setProperty(java.lang.String name, java.lang.Object value)

Overview

The main purpose of this class is to provide bridge from DOM to SAX. This can be guessed from the name of this class. Most of the methods in this class are used internally. However, I have given examples of those methods useful to the User. This class implements org.xmlsax.XMLReader so by default it allows an application to set and query features and properties in the parser, to register event handlers for document processing, and to initiate a document parse.

Method Overviews

As I have mentioned earlier, methods in this class are used internally. Also I have mentioned that this class provides a bridge from DOM to SAX. Sometimes during programming, we need to parser a org.w3c.dom.Document using SAX parser so that we can implement business logic. But this does not occur always. Generally we use Inputsource, File or URIs for parsing in SAX parser. But we occasionally parse org.w3c.dom.Document using SAX Parser. This class provides methods to parser a org.w3c.dom.Document, set  setContentHandler for event handling,  setEntityResolver for associating an EntityResolver, setErrorHandler for associating an ErrorHandler and , setDTDHandler for handling DTD related handlers.

Example of creating an instance of DOM2SAX:

/**

     * This method gives example of how to use DOM2SAX for parsing a org.w3c.dom.Document

     * and associating  a ContentHandler.

     * @param uri String

     */

    public void dom2saxUsingInputSource(String uri){

        try{

            System.out.println("Starting parsing URI :"+uri);

            Document doc = DocumentBuilderAdapter.getDocumentBuilder().parse(uri);

            DOM2SAX dom2SAX = new DOM2SAX(doc);

            dom2SAX.setContentHandler(new ContentHandlerImpl());

            dom2SAX.parse();

        }catch(Exception e){

            e.printStackTrace();

        }

    }

Example of parse ():

This method is used to parse a org.w3c.dom.Document, which is passed as an argument for creating instance of DOM2SAX instance.         

 DOM2SAX dom2SAX = new DOM2SAX(doc);

            dom2SAX.setContentHandler(new ContentHandlerImpl());

            dom2SAX.parse();

Example of ContentHandler(ContentHandler):

This method is used to associate a ContentHandler to the SAX parser.

            dom2SAX.setContentHandler(new ContentHandlerImpl()); // ContentHandlerImpl class implements ContentHandler.

Note: Please see the attached source code for more implementation.


Rate this article on a scale of 1 to 10

Your vote :  


 

Recent Jobs

A great opportunity to Digital Vide
here is a greate opportunity as a S
A great opportunity as a Network En
A Greate Opportunituy as a SQL Deve
An immediate job opportunity as a B

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



Information Online

swimming pool contractor
chicago web site design
conference call
Web Hosting
help desk support
Bvlgari sunglasses
answering service


    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