Wednesday, December 29, 2010

Sax Parser...A simple way to access xml documents

Sax parser allow us to access a xml document and we can predefine how the program should behave once certain events are occurred in the xml document when the parser parse the xml document from top to bottom.

A simple java code that helps you to access a xml document through your implementation

package sax;

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

public class SaxHelperSanja {

public static void main(String args[]) {



try {

SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser saxParser = factory.newSAXParser();
DefaultHandler handler = new DefaultHandler() {


public void startElement(String uri, String localName,
String qName, Attributes attributes)
throws SAXException {
/*this method is called once the parser meets a start element and you should implement here how your code should behave when a start element is found.The name of the start element is the parameter qName and the attributes of that element is under attributes parameter.*/
}

public void endElement(String uri, String localName,
String qName)
throws SAXException {
/*this method is called once the parser meets an end element and you should implement here how your code should behave when an end element is found.The name of the end element is the parameter qName.*/
}

public void characters(char ch[], int start, int length)
throws SAXException {
/* this method is called once the parser encounters text under an element.*/
}
};

// for specifying the xml document
saxParser.parse("/home/sanjaya/Desktop/a.xml", handler);

} catch (Exception e) {
e.printStackTrace();
}
}
}

there are startDocument() and endDocument() methods that are called when the parser begins the parsing of the xml document and ends the parsing of the document.In the above code I have not included them as I think they are not vital as the once I have mentioned above.Anyway feel free to use these two methods if you really need.

Hey that's the simple sax parsing.enjoy....

Tuesday, December 28, 2010

I am back

I was so busy since march as I was fully dealt with completing the gsoc project.And glad to say that I completed it successfully.Soon after I completed the project I wanted to get some vacation and really had a wonderful time in my home having played with my friends until my final year at university begins.Then once again It was and still a tough time as exams are near by.Anyway I think that the time I was away from blogging is too much and thereby I though I must update it.So here I am back again...........

Monday, April 26, 2010

My GSoC proposal has been accepted

I am so happy to mention that my gsoc proposal for apache xerces project has been accepted.I really work hard for last two months in order to gain a better back ground knowledge on the project and to create a proper proposal.Now it begins the harder time and I have to be prepared to face it.By the way I have to arrange a small party for my friends as well.I mean a tea party.Don't take it too serious.
Thank you Ishan sharma for helping me and keep your good habbits going.By the way my mentor is Michael as I have mentioned in my past blog posts and he is a simple man who enjoys the life.I try to gain maximum out of him to make this project a success.And I wish to contact Hiranya ayya as he is more familier about Xerces and I hope he will support me .Until my next blog post here I am going.Bye.

Wednesday, March 31, 2010

Apache Xerces Project as my GSOC 2010 project

I am really busy in these days as I'm creating the background for the project "Implementing a streamable subset of XPointer xpointer() scheme for XInclude" which is one of the Apache Xerces project idea for GSOC 2010.
While I was creating the Member Describer plugin for Anjuta IDE I worked with libxml parser and I had a determination to implement my own xml parser one day.So I think working with this apache project will give me a great support to achieve my target one day.On the other hand this apache project will help to motivate my open source development capabilities as well.
So far I had a self study on prevailing XPath expressions and I also went through the xerces source code by checking out the xerces trunk.Anyway I hope that I will be lucky enough to hold this project and to actively support the fully development with the help from Michael who is the assigned mentor for this project.

Wednesday, February 24, 2010

Heading towards the NDB project

I am spending my third week @ ironone as an intern and these days we are getting ready for the NDB project which will most probably be commenced from 1st march.Today and yesterday we gathered the requirements from the messy files given by NDB and reorganized them in a proper manner so that they are easy to be clarified when necessary.
It is really nice to be with ironees so that I can learn their procedure in certain certain cases and there are plenty of things to be learnt when consider how they face difficult situations.
We had several meetings with the project group and there we deal with the troublesome situations what we faced and find out the solutions for what the majority of the project team agreed on.Anyway We are fully focused on the project and try our best to make the event a success.

Sunday, February 7, 2010

First day @ ironone as an intern

I am writing this while being in the Ironone premises on my first day.We had a brief introduction about how the things are going in here and it seems that this is a great place for someone to being an intern.The team of iron one are very friendly and they are willing to help always.I am not going on details as our lunch time has already begun.I have got my new mail address here which is sanjayal@irononetech.com.