0

Scenario is like i have huge xml file coming in as an input, xml file may contain only one node or it might contain multiple nodes. I have written my Custom reader which extends AbstractItemCountingItemStreamItemReader, over ridden the doOpen() and doRead() accordingly. I have used vtd-xml for unmarshalling. Problem is even my xml file contain only one node doRead() method is getting called multiple times. ideally after evaluating xpath value it should come out of the loop. Please suggest me where i am doing wrong.

vtd-xml-author
  • 3,319
  • 4
  • 22
  • 30
Jay
  • 429
  • 2
  • 8
  • 23
  • you are not giving enough details on your problem? what do you mean by one node or multiple nodes? – vtd-xml-author Dec 09 '15 at 00:07
  • 12345678901 1234567893 12345678 BOOK STLM DSTL 1 – Jay Dec 09 '15 at 07:34
  • This is sample xml file. I can have a single or multiple in input file. Sorry for the inconvenience – Jay Dec 09 '15 at 07:36
  • Having multiple Trns makes it an invalid XML. According to XML spec, you can *only* have one root element per xml file. – vtd-xml-author Dec 09 '15 at 08:23
  • 1
    Can you please update your question with examples of your XML and the code you're using. – Michael Minella Dec 10 '15 at 19:27
  • Hi Michael thanks a lot for the reply. But it was my fault that i was not moving the autoPilot to the parent node properly. Everything is working fine only thing is i have to test the performance. – Jay Dec 12 '15 at 08:57
  • Regarding performance, I wrote a blog a while back and here is the URL that might help you https://ximpleware.wordpress.com/2015/10/12/performance-tuning/ – vtd-xml-author Dec 12 '15 at 20:17
  • @vtd-xml-author i had gone through the blog and measured the performance. I am getting the more time in VTD. It is a complex structured xml and i am using xpath frequently(Not using xpath in loop). This might hit the performance? Please suggest... – Jay Dec 15 '15 at 13:22
  • Did you set the location cache depth to 5? how big is your document? Can you send me a test case so I can offer further suggestions. – vtd-xml-author Dec 15 '15 at 19:44
  • @vtd-xml-author my apologies for late reply... It's 3.4Gb xml file... As i told i am using xpath frequently to get only the required attributes i want to pick from xml... Kindly suggest to improve the performance.. – Jay Dec 24 '15 at 13:51
  • you must be using extended vtd-xml on 64-bit jvm right? is 3.4GB a single XML? – vtd-xml-author Dec 24 '15 at 20:33
  • @vtd-xml-author Yes it is a 64-Bit jvm and it is a single file of size 3.4Gb. – Jay Dec 28 '15 at 08:19
  • so are you using extended vtd-xml? – vtd-xml-author Dec 28 '15 at 22:13
  • @vtd-xml-author Yes i am. – Jay Jan 02 '16 at 08:17
  • did you read the code examples in http://vtd-xml.sourceforge.net/codeSample/cs12.html – vtd-xml-author Jan 02 '16 at 20:52
  • @vtd-xml-author Yes i have red code example, and used MEM_MAPPED, only difference is i am applying xpath for individual attributes – Jay Jan 04 '16 at 04:58
  • What is the problem you are experiencing? What does your xpath look like? – vtd-xml-author Jan 04 '16 at 05:07
  • @vtd-xml-author Performance issue... VTD is performing slower when compared to Stax parsing.. Suppose i have a firstName attribute in one of the child nodes my xpath looks like p.selectXPath("./n:name/text()") where n is the namespace and i made my pilot pointing to the current node – Jay Jan 04 '16 at 05:42
  • Can you post your code? What is the setting ie.JVM heap size etc? Please provide as much info as you can. – vtd-xml-author Jan 04 '16 at 05:48
  • Can't help you if no further info is provided... – vtd-xml-author Feb 03 '16 at 22:05

0 Answers0