Problem With parsing the XML file.
Posted: Thu Sep 18, 2008 3:42 am
Hi I Have an XML file in which a row looks something like this,Which is getting interpreted by XML input stage.
<ColumnL>
<Schedule>
<Period>
<Date1>2009.06.24</Date1>
<Date2>2011.06.24</Date2>
</Period>
<Period>
<Date1>2010.06.24</Date1>
<Date2>2012.06.24</Date2>
</Period>
<Period>
<Date1>2011.06.24</Date1>
<Date2>2013.06.24</Date2>
</Period>
<Period>
<Date1>2012.06.25</Date1>
<Date2>2013.06.24</Date2>
</Period>
</Schedule>
</ColumnL>
There are many rows of the type ColumnL.
What my requirement is,to print the Date1 and Date2 text elements of Each Period different ColumnL rows,in a saperate row.So I have taken Period as a repetition element and taken an Xpath expression for the columns as
/ColumnL/Schedule/Date1/text()
/ColumnL/Schedule/Date2/text().
But for each ColumnL in the XML document, the Dates corresponding to first instance of Period is getting repeated.
ie,I am getting the output as
Date1 Date2
2009.06.24 2012.06.24
2009.06.24 2012.06.24
2009.06.24 2012.06.24
where as My required output is
Date1 Date2
2009.06.24 2012.06.24
2011.06.24 2013.06.24
2012.06.25 2013.06.24
I cannot use the indexed Xpath expressions here because I The number of Period elements can vary in each row of ColumnL.
Please suggest me a way to get this problem resolved...[/b]
<ColumnL>
<Schedule>
<Period>
<Date1>2009.06.24</Date1>
<Date2>2011.06.24</Date2>
</Period>
<Period>
<Date1>2010.06.24</Date1>
<Date2>2012.06.24</Date2>
</Period>
<Period>
<Date1>2011.06.24</Date1>
<Date2>2013.06.24</Date2>
</Period>
<Period>
<Date1>2012.06.25</Date1>
<Date2>2013.06.24</Date2>
</Period>
</Schedule>
</ColumnL>
There are many rows of the type ColumnL.
What my requirement is,to print the Date1 and Date2 text elements of Each Period different ColumnL rows,in a saperate row.So I have taken Period as a repetition element and taken an Xpath expression for the columns as
/ColumnL/Schedule/Date1/text()
/ColumnL/Schedule/Date2/text().
But for each ColumnL in the XML document, the Dates corresponding to first instance of Period is getting repeated.
ie,I am getting the output as
Date1 Date2
2009.06.24 2012.06.24
2009.06.24 2012.06.24
2009.06.24 2012.06.24
where as My required output is
Date1 Date2
2009.06.24 2012.06.24
2011.06.24 2013.06.24
2012.06.25 2013.06.24
I cannot use the indexed Xpath expressions here because I The number of Period elements can vary in each row of ColumnL.
Please suggest me a way to get this problem resolved...[/b]