[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: A new approach for SAX-Java Binding

  • From: Boris Kolpackov <boris@codesynthesis.com>
  • To: Santhosh T <santhosh.tekuri@gmail.com>
  • Date: Mon, 25 Jan 2010 10:21:55 +0200

Re:  A new approach for SAX-Java Binding
Hi Santhosh,

Santhosh T <santhosh.tekuri@gmail.com> writes:

> http://code.google.com/p/jlibs/wiki/SAX2JavaBinding
> 
> this shows a new approach to define sax to java binding in very intutive
> manner.
> 
> your comments are welcomed;

This idea might be new to Java, though something like this has been 
available for C++ for several years now (see the C++/Parser[1] 
mapping, for example).

I also think in your architecture you miss one of the main reasons 
why people choose to use SAX over, say, DOM. Which is that they don't
want to (or cannot afford to) build an in-memory representation.
Instead, the XML data is processed as soon as it becomes available
in a pure event-driven or a partially in-memory / partially event-
driven mode. 

In this light, a callback interface like this seems like a more 
natural choice (using your Employee example):

public interface Employee {

  public void name (String name);
  public void age (int age);
  public void experience (int exp);
};

In the C++/Parser mapping I mentioned above this interface as well
as the "SAX routing code" are automatically generated from XML Schema.

The user can then implement this interface to receive the data:

public class EmployeeImpl implements Employee {

  public void name (String name)
  {
    // Handle name.
  }

  public void age (int age)
  {
    // Handle age.
  }

  public void experience (int exp)
  {
    // Handle experience.
  }
};


[1] http://www.codesynthesis.com/products/xsd/c++/parser/

Boris

-- 
Boris Kolpackov, Code Synthesis        http://codesynthesis.com/~boris/blog
Open-source XML data binding for C++   http://codesynthesis.com/products/xsd
XML data binding for embedded systems  http://codesynthesis.com/products/xsde
Command line interface to C++ compiler http://codesynthesis.com/projects/cli


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.