Skip to main content



      Home
Home » Archived » BIRT » Xpath issue with xml datasource(predicate seems not to be working)
Xpath issue with xml datasource [message #1047744] Tue, 23 April 2013 11:40 Go to next message
Eclipse UserFriend
Hi all,

I have some trouble using xpath expression with a strange xml source.

My source is :

<?xml version="1.0" encoding="utf-8"?>
<INVOIC02>
<IDOC BEGIN="1">
<E1EDK01 SEGMENT="1">
<BSART>CRME</BSART>
</E1EDK01>
<E1EDKA1 SEGMENT="1">
<PARVW>RS</PARVW>
<PARTN>000155W</PARTN>
</E1EDKA1>
<E1EDK03 SEGMENT="1">
<IDDAT>012</IDDAT>
<DATUM>20120606</DATUM>
</E1EDK03>
<E1EDK03 SEGMENT="1">
<IDDAT>Z01</IDDAT>
<DATUM>20010612</DATUM>
</E1EDK03>
<E1EDKT1 SEGMENT="1">
<TDID>Z001</TDID>
<E1EDKT2 SEGMENT="057">057</E1EDKT2>
</E1EDKT1>
<E1EDKT1 SEGMENT="1">
<TDID>Z002</TDID>
<E1EDKT2 SEGMENT="1">
<TDLINE>913091</TDLINE>
</E1EDKT2>
</E1EDKT1>
<E1EDKT1 SEGMENT="1">
<TDID>Z003</TDID>
<E1EDKT2 SEGMENT="057 23219677534">
<TDLINE>057 23219677534</TDLINE>
</E1EDKT2>
</E1EDKT1>
<E1EDKT1 SEGMENT="1">
<TDID>Z004</TDID>
<E1EDKT2 SEGMENT="F/2D601955">
<TDLINE>F/2D601955</TDLINE>
</E1EDKT2>
</E1EDKT1>
<E1EDKT1 SEGMENT="1">
<TDID>Z005</TDID>
<E1EDKT2 SEGMENT="1">
<TDLINE>xxxxxxx/yyyyy zzz</TDLINE>
</E1EDKT2>
</E1EDKT1>
<E1EDS01 SEGMENT="1">
<SUMID>Z20</SUMID>
<SUMME>0000000.00</SUMME>
</E1EDS01>
<E1EDS01 SEGMENT="1">
<SUMID>Z01</SUMID>
<SUMME>00114.45</SUMME>
</E1EDS01>
<E1EDS01 SEGMENT="1">
<SUMID>010</SUMID>
<SUMME>00000114.45</SUMME>
</E1EDS01>

</IDOC>
</INVOIC02>

I try to map some of the rows.

you may see that some elements have same name but content is specialized with a child element.

for example :

My row mapping is /INVOIC02/IDOC
I need the three last SUMME fields as 3 column values :
field1 : the text() value of SUMME child of the E1EDS01 element that has a child SUMID elements that contains "Z20".
field2 : the text() value of SUMME child of the E1EDS01 element that has a child SUMID elements that contains "Z01".
field3 : the text() value of SUMME child of the E1EDS01 element that has a child SUMID elements that contains "010".

I have tried to use the xpath like
/E1EDS01[SUMID/text()="Z01"]/SUMME
/E1EDS01/SUMME[../SUMID/text()="Z01"]

I even have tried /E1EDS01/SUMID[text()="Z01"]/following-sibling::*[1]

it works in any xpath evaluator but not when birt works out the dataset.
When I try /E1EDS01[2]/SUMME I do get the correct value but I cannot rely on position. This only tells me that my source is ok.
How could I find these fields using xpath in a dataset column mapping ?

Thanks
Cyril

[Updated on: Tue, 23 April 2013 11:42] by Moderator

Re: Xpath issue with xml datasource [message #1048658 is a reply to message #1047744] Wed, 24 April 2013 15:46 Go to previous message
Eclipse UserFriend
The XML ODA driver uses a SAX parser. It only has access to the parent node to avoid unbound memory usage. You could possibly transform the XML to a more usable structure for BIRT before passing it in.
Previous Topic:BIRT 4.2 classpath problem
Next Topic:Help with xpath please
Goto Forum:
  


Current Time: Fri Apr 25 07:29:03 EDT 2025

Powered by FUDForum. Page generated in 0.02595 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top