1
<?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

3
  • thanks for your clue,but am new to xml and Xpath please explain me little more about xpath, that how to help my requirement Commented Jan 28, 2014 at 11:01
  • I don't know how your java looks, so I can't provide you with a specific solution (you can google that on your own), but in your case if you want to retrieve all of the eventful nodes you'll probably want an xpath pattern along the lines of //eventful or if you want only the first one you can specify it like this //eventful[1], afterwards you process it according to the xpath implementation of your choice... Commented Jan 28, 2014 at 11:08
  • thank u vry much can i able to fetch data with xml tags Commented Jan 28, 2014 at 14:25

1 Answer 1

1

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/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.