New Article JAXP: Coding for Parser and Transformer Independence


News: New Article JAXP: Coding for Parser and Transformer Independence

  1. This introductory article will educate developers about the JAXP API, and provide them with a strong understanding of the pluggability layer that will allow their applications to switch between parsers at will. Two parsers: SAX (an event-based model) and DOM (a tree-walking model) are comparatively looked at. An overview of XSLT is also given.

    Read JAXP: Coding for Parser and Transformer Independence
  2. Howdy,
    OK article, nothing really groundbreaking there. I like JAXP, use it all the time as a matter of good practice.

    The one thing that's annoyed me about JAXP is the amount of versions out there, especially for a product that's been around a relatively short time. There's 1.0, 1.1, 1.1.1, 1.1.2, "the version with Java XML Pack Fall 01", "the version with Java XML Pack Winter 01", etc etc. What's up with that? ;)
  3. JAXP also seems to have a few functional holes.

    In one glaring example, there's no way to force validation of an XML document against an externally-specified DTD or Schema. The DTD or Schema reference has to be embedded in the document itself, which is sheer lunacy.
  4. If you use JAXP that comes with j2se1.4.0 you can validate using external DTD.
    Where on earth is the code for this article located? Do I have to browse the whole site to find?
  5. You can get an external DTD to be loaded by your XML doc by implementing the "EntityResolver" interface for SAX. Then, override "setEntityResolver" method and specify the URI in which your DTD lies. Return the location of your DTD as an "InputSource" object and then your parser will know to validate against this DTD.
    I used this technique when fishing out a DTD from a database as specified by an EJB parameter. I created a customized SAX parser that would validate against a DTD as specified by a user in a JSP page.

  6. If I remember well it is possible against an external DTD
    with the following code:

    public class SAXExample extends DefaultHandler {
    SAXParserFactory factory = SAXParserFactory.newInstance();
    SAXParser saxParser = factory.newSAXParser();

    DefaultHandler handler = new SAXExample();
    //Sybase code:
    //saxParser.parse( new File(argv[0]), handler);
    saxParser.parse(new InputSource(new File(argv[0]).toURL().toExternalForm()), handler);

  7. I could not find the source code from Sybase site. Henry, Could you please help me out?
  8. All,

    The source code for this article is available here:

    Edgar Tinio
    e-Business Division
    Sybase, Inc.
  9. Let me start introducing myself. I am Mr. Romeo Dagangon, legal age, married; I am living in a remote area here in the PHILIPPINES. I have two children. The one has attended as grade one elementary. One day my daughter have an educational field trip in her school where she studied, Bad news were I hear from the school principal that the bus were on board was accident. GOD MAKE A MIRACLE to my daughter she was the only one who survived on that accident. All of her companion was died on the spot. It was happened last June 26, 2004. She was suffering burned in his body, she has been scheduled surgery operation last July 5, 2004 at around 3:00 PM. The surgery was so successful. THANKS GOD. But I have a big problem the total all in all worth of $200,000.00 US dollars including all medicines and hospital bills. I have been collected from my friends, relatives and from charity here is about $100,000.00 US dollars. In fact, my problem is the remaining balance of $100,000.00 US dollars. I had been made a promissory letter that I pay all remaining balance within six (6) months. But my problem is how can I reach this money coz, I am nominal employee in a small company here in our country. My salary is not enough for the whole month. I am financially debt as of now. I do all my best to tackle this remaining balance but sad to say nothing I can do the way. My country here in the Philippines is very expensive and the economy is not so good and it is very hard to find money. Moreover, our country is running for crisis.

    For your assistance please. We write to solicit for our assistance for this financial problem and excuse me for the embarrassment this letter might cause you as we have not met or known each other before. I have the mandate of my consent to solicit for your assistance for my financial problem. I have no other option, but GOD guided me to reach this money. So, I am writing this letter to every one of us for those who have a golden heart to give their donation. The person who are willing to share their graceful fruit from the god. In fact, to tell you all frankly, this is not a scam, M-L-M, or any ponzi pyramid schemes you know out there. This is a truth/real letter for the safe life of my daughter. Once again, I will be knocked to all of you who have a golden heart to help me to reach this money. It is not a joke. If you think two minded this kind of letter please contact me for verification at mobile no. +63 920-5057434 or email at kimrom02 at yahoo dot com.

    I hope you can understand my situation on this matter. Please forward it to your friends.


    Sincerely yours,
    #775 G1, Sevilla Street
    San Nicolas, Manila