Thursday, May 19, 2011

How to add a attribute of XML as a html element attribute using XSLT

Once you work with XSLT you may come across a situation where you need to directly apply a value of a XML attribute as the value of a HTML attribute.There are two options to figure the things out.

myXML.xml










Target html










In the above case the value of the attribute boxSize is directly applied as the value of the attribute size of input element in HTML format.This can be achieved as below two methods.

method 1











method 2




As you see method 2 is more easy and it is the simple way to get the job done.Thank you.Hope this helps.

Wednesday, May 11, 2011

How to choose a XML parser

There are many XML parsers out there.So here I am going to give some pros and cons of those.SAX,StAX,DOM,JAXB are the XML parsers that I took into consideration.

Parsing Mechanism

Features

JAXB

High memory usage

DOM

High memory usage

StAX

XML schema can not be validated.
Low memory usage

SAX

XML schema can be validated
Low memory usage

Hope this will give you some hints about what to choose.Thank you.

Wednesday, February 9, 2011

Contributing to a open source project with SVN

SVN

SVN is referred as subversion.Now I am going to tell you how you can use this SVN for your contributions to an open source project in simple ways.I assumed you use unix platform as your working environment.

Checking out a project.

For contributing an open source project you need to have the code base of the project which is available in the relevant organisation's repository and you can find out the url of that repository browsing through their official cite.

  1. Open an terminal
  2. cd Desktop
  3. type svn checkout url
ex: svn checkout https://docbook.svn.sf.net/svnroot/docbook/trunk for checking out the trunk of DocBook project


Then you will get the trunk of that source code in to your Desktop.

Creating a patch

Once you checked out the source you can do necessary editing of the source code and developing your own code for the project.Then you need to inform the community of that project regarding what changes you have made to the source code simply by using the following command in the terminal being in the necessary folder which is the folder where your code is in.

svn diff > a.patch

or

svn diff > a.diff

then the changes will be in your working folder as the file a.patch or a.diff.Then you can send this file to the community.

Come on visitors try SVN for your contribution.