Hala Rowan
Hala Rowan

Reputation: 159

Fetch Specfic xml data from large xml file in java

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<eventsearch>  
<eventful>     // I want this part of data -------->Starting
<ObjectId>1</ObjectId>
<event>
<eventid>E0-001-057799040-8</eventid>
<title>Book Fair</title>
<start_time>2013-07-07 19:00:00</start_time>
<venue>Chennai, IN</venue>
<city>Chennai</city>
<state>Tamil N?du</state>
<country>India</country>
</event>
<event>
<eventid>E0-001-061380034-0</eventid>
<title>Master Class for Test Professionals - Effective Review of Test Cases</title>
<start_time>2013-10-18 09:00:00</start_time>
<venue>CleanSoft Academy</venue>
<city>Chennai</city>
<state>Tamil N?du</state>
<country>India</country>
</event>
<event>
<eventid>E0-001-055516202-1@2013060709</eventid>
<title>Six Sigma Green Belt Certification Training (Weekend)</title>
<start_time>2013-06-07 09:00:00</start_time>
<venue>Hotel Southern Crest</venue>
<city>Chennai</city>
<state>Tamil N?du</state>
<country>India</country>
</event>
</eventful> //-------------------------->Ending
<ObjectId>2</ObjectId>
<eventb>
<eventid/>
<title>UCL visit to Chennai, India - British Council EDUK Exhibition</title>
<city>Chennai</city>
<country>India</country>
</eventb>
<eventb>
<eventid/>
<title>Learn Ethical Hacking at BRISK Launching BISE V/2</title>
<city>Chennai</city>
<country>India</country>
</eventb>
</eventsearch>

I have an large xml files means, I merging all xml files using DOM for send to client,so it seems to be large now I want particular part from xml file how can I able achieve this please help me,I post my xml file above

Upvotes: 1

Views: 250

Answers (1)

Sean Dey
Sean Dey

Reputation: 24

Use XML perser

import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;

watch out the following URL

http://www.mkyong.com/java/how-to-read-xml-file-in-java-dom-parser/

Upvotes: 1

Related Questions