Possible Duplicate:
how to read a xml file using java?
I want to the all value of between <connection><host><username>.....</connection> between them.I am using saxbuilder but dont know hot to get the value.
<config>
<global>
<install>
/install>
<crypt>
</crypt>
<disable_local_modules>false</disable_local_modules>
<resources>
<db>
</db>
<default_setup>
**<connection>**
<host><![CDATA[localhost]]></host>
<username><![CDATA[root]]></username>
<password><![CDATA[root]]></password>
<dbname><![CDATA[magento]]></dbname>
<initStatements><![CDATA[SET NAMES utf8]]></initStatements>
<model><![CDATA[mysql4]]></model>
<type><![CDATA[pdo_mysql]]></type>
<pdoType><![CDATA[]]></pdoType>
<active>1</active>
**</connection>**
</default_setup>
</resources>
<session_save><![CDATA[db]]></session_save>
</global>
</config>
There are many ways to read XML: The built-in DOM and SAX parsers, jdom or even JAXB (which maps XML to objects).
But in your cases the best option is to use commons-configuration. Read the user guide – it is rather simple.