Parse only when XML content changes....
3 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Rajeshwari_M
Posted On:   Tuesday, December 11, 2007 06:14 AM

Hi all,
I'm a newbie to XML... I'm trying to read one large XML file. Contents of file will not change often. I'm planning to use JAXP for parsing. Our application wont change the content. we use this file for searching alone.

My concern is, if I give string to search, everytime xml file should not get parsed as this adds overhead/Performance impact. Is there any way, XML will be parsed only when updates are there ??

Thanks
Raji..

Re: Parse only when XML content changes....

Posted By:   Simon_Ablett  
Posted On:   Tuesday, December 11, 2007 10:52 AM

Either change the XML schema to incorporate a version number - probably as an attribute on the root element. Then either use SAX to load the file one element at a time or apply an XSL/T file to extract the relevant bit. Alternatively, if you don't want to read the file at all, use its date-time stamp or have the creator write a semaphore file with the associated date-change information.

Re: Parse only when XML content changes....

Posted By:   Roseanne_Zhang  
Posted On:   Tuesday, December 11, 2007 10:28 AM

"Contents of file will not change often"


What does that mean? average once/month or once/hour?


I think your strategy should depend on the frequency...

Re: Parse only when XML content changes....

Posted By:   Robert_Lybarger  
Posted On:   Tuesday, December 11, 2007 08:51 AM

XML itself doesn't have such "features." You will need to determine ahead of time whether to parse the file or not based on, for example, the modification time of the file being different. Then, you will need some way to cache (save into memory, for example) the file data to speed up the next search. There's no "one way" to really attack this; it somewhat depends on what the overall requirements are for the application. I'd probably ensure there's enough memory available and then just cache the DOM tree (or possibly my own object-tree version of it, using whichever data structures are fast at reading) as a first-pass attempt, with a check to see if I need to re-parse the file.
About | Sitemap | Contact