Jump to content

How do i parse XML file and store data into mysql database


Recommended Posts

Can any body help me out regarding parsing an XML file and storing the XML consents with attribute values  into mysql database..???

 

Here is my XML file

 

<?xml version="1.0" encoding="UTF-8" ?>

<root>

 

<sports section="sports">

<headline>

Canadian coach Nayyar hopes to enjoy his Pune stay

</headline>

 

<Story>

 

SPORTS REPORTER sports@gomantakimes.com
Ram Nayyar, Canadian of Indian origin, is here on a mission-cum-vacation. Vacation - because nothing can be better than touring your native land. And mission - because he is the coach of the Canadian badminton team. 
“The weather in India is not new to me,” he said. “I thought my team might face some problem, but they took it very well surprisingly. The heat doesn’t seem to be bothering them.”  Another common problem that athletes touring India face is food. “Organisers have made good arrangement here at the Athletes Village. I am fond of Indian food, which is also available here. So these kids have their pasta and potatoes, while I enjoy my desi food,” he said in his typical Punjabi accented Hindi. 
Born in Chandigarh and brought up in Canada, Nayyar took to badminton at an early age. Contested in quite a number of tournaments in Canada but later on studies kept him too busy.
“Though I used to travel to India a lot, it used to be only to meet relatives. Only once or twice I participated in tournaments while vacationing in India,” Nayyar said, remembering his days as a player. 
“Later I pursued a degree in law but was not satisfied with it. 
I then took up coaching,” he said. He has been coaching the junior team for the last 18 years.
His team comprising of two boys and four girls wouldn’t have to look far for a guide to tell them about India.
 “ I am taking these kids around the city today, we’ll be visiting Camp and other areas of interest,” he said, gleaming  with obvious joy.

 

</Story>

 

</sports>

 

 

<politics section="politics">

<headline>

Ponting breaks jinx with century as Aussies recover

</headline>

<Story>Bengaluru: Australian captian Ricky Ponting broke the jinx of a dismal track record on Indian soil by cracking a masterly 123 but India just about managed to restore the balance in the first cricket Test by two late scalps on Thursday. Ponting, under enormous pressure to overcome the jinx of a poor average in India, notched up his maiden ton in India and his 36th overall to steer the visitors to 254 for four in their first innings at close on the opening day. 
Electing to bat, the Australians suffered a huge jolt when they lost the dangerous Matthew Hayden (0) in the third ball of the day off paceman Zaheer Khan but Ponting and Simon Katich (66) steadied the ship with a resolute 166-run second wicket stand. 
The Australian captain dispelled all doubts about his ability to score runs on the slow tracks here with a solid batting exhibition which frustrated the home team on what seemed to be a good batting track. 
Michael Hussey (46) was at the crease at stumps on the opening day, which saw the Australians losing Michael Clarke (11) in the last over of the day to allow the Indians come back onto the game to some extent. With just four specialist bowlers in their ranks, the hosts found the going tough in hot and humid conditions but the wickets of Ponting and Clarke late in the day came as a relief. 
Ponting began on a rather sedate note and started playing his shots only after the post lunch session. He looked the more aggressive in the partnership of 166 with Katich although Ishant Sharma struck his pads on a couple of occasions and forced a nasty inside edge while the Australian was on 78. Ponting hit 13 boundaries during his 243-ball knock, which formed the cornerstone of the Australian innings. 
Harbhajan Singh, who had claimed the wicket of the Australian captain on eight occasions, brought an end to Ponting’s innings by trapping him leg before much to the delight of the Indians. Paceman Zaheer got rid of Clarke in the last over of the day, trapping him in front of the wicket with an incoming delivery. 
The Aussies owed their recovery to Ponting and Katich who came into the team in place of Phil Jaques. Katich was cautious before lunch but started to unleash a few strokes after the  break and never really seemed troubled by the two spinners Harbhajan and Kumble. 
The Indians could not have asked for a better start to the four-match Test series with pace spearhead Zaheer Khan removing Hayden (0) in the  third ball. Hayden edged a fuller length delivery bowled close to off stump and Dhoni accepted a low catch in front of him.
 But that turned out to be the only moment of success for the hosts as both Ponting and Katich ensured that there were no further setbacks with some sensible batting. PTI

</Story>

</politics>

 

<entertainment section="entertainment">

<headline>

Organisers worried despite damaged ring being repaired

</headline>

 

<Story>

Irfan sports@gomantaktimes.com Pune: Come October 13, junior pugilists from around the former British colonies will take the virgin competition ring that almost got destroyed when a three ton  equipment fell on it a few days ago. There will be enthralling bouts no doubt at the 3rd Commonwealth Youth Games in Shiv Chhatrapati Sports City, Balewadi, but with the time running out fast the caretakers are busy in giving final touches to the boxing venue after that mishap. When a lighting equipment attached to the roof fell on the ring, it damaged the wooden flooring of the raised structure.
“We would have finished the job a much earlier, but our work got delayed. 
A very heavy lighting material fell from the top and damaged a portion of the wooden layer covering the cemented platform,” said Bharat Kumar, deputy boxing competition manager. Kumar is also the executive secretary of the Maharashtra Amateur Boxing Association (MABA).
Competition Manager Jay Kowli also confirmed the incidence. “Yes something did happen but I wasn’t there at that time. So, I don’t know what exactly was the damage,” said Kowli.
With the first competition bout slated for Monday the organisers are hoping that everything goes as planned. “The damage has been rectified and we don’t see any problem in conducting the competition in a smooth way,” Kumar said.
However, Kowli kept his fingers crossed, “We are conducting a bout on Friday on a trial basis. I hope there are no further hassles but at this point I can’t confirm that the ring is 100 percent fit for the competition,” Kowli added. 
Kowli and Bharat Kumar were disappointed with the fact that no boxer from Maharashtra would be there to light up the ring, “We have good talent in Maharashtra and the boxers are as good as any other but they failed to make the final cut for want of better training facilities and infrastructure,” said Kumar.
“We gave enough support to our two boys, Salman Shaikh and Akola’s Yogesh Nishad in the camp for CYG probables, but they failed to make it. We can help the boxers toa certain extent. We tried whatever we could have done with limited avenues and facilities,” he added.
Kowli hopes for the best. “We hope CYG will change face of boxing in the state for better. Our boxers will certainly learn and cheer the boxers here,” he added.

</Story>

 

</entertainment>

 

</root>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.