Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » XML Data source - column mapping - xpath problem with attribute and position predicates
XML Data source - column mapping - xpath problem with attribute and position predicates [message #660426] Fri, 18 March 2011 11:43 Go to next message
Silvestr Peknik is currently offline Silvestr PeknikFriend
Messages: 4
Registered: March 2011
Junior Member
Hello,

I have XML data source and i am creating data set. Part of the xml that i want to bind to columns causes troubles to me or to BIRT.

I have XML containing number of "customfield" elements like the one below. They are differentiated by "id" attribute. They can also contain number of values (customfieldvalue element) which have no id and differ just in position and text().

<customfields>
<customfield id="cf10062">
<customfieldname>Tester</customfieldname>
<customfieldvalues>
<customfieldvalue>sipe01</customfieldvalue>
<customfieldvalue>sipe02</customfieldvalue>
</customfieldvalues>
</customfield>
...
</customfields>

The problem i face is that BIRT has problem with XPATH query that contains both attribute predicate and position.

/customfields/customfield[1]/customfieldvalues/customfieldva lue[2]
==> returns "sipe02"

/customfields/customfield[@id="cf10062"]/customfieldvalues/customfieldvalue[2]
==> returns something strange (squares and empty characters? not sure)

Can anyone tell what is wrong?

Thanks a lot,
Silvestr

[Updated on: Fri, 18 March 2011 15:59]

Report message to a moderator

Re: XML Data source - column mapping - xpath does not understand position / element predicate [message #660492 is a reply to message #660426] Fri, 18 March 2011 15:03 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

On problem one, currently the xml driver only supports attributes
filters. On problem two It looks like the cdata section is getting
treated like binary data. Any chance you can log a bug for this?

Jason


On 3/18/2011 7:43 AM, Silvestr Peknik wrote:
> I have XML data source and i am creating data set. Part of the xml that
> i want to bind to columns causes troubles to me or to BIRT.
>
> Problem 1:
>
> <customfields>
> <customfield id="cf10062">
> <customfieldname>Tester</customfieldname>
> <customfieldvalues>
> <customfieldvalue>sipe04</customfieldvalue>
> </customfieldvalues>
> </customfield>
> ... other elements
> </customfields>
>
> I wanted to bind a column to following xpath:
>
> /customfields/customfield[customfieldname="Tester"]/customfieldvalues/customfieldvalue
>
>
> This one does not work - nothing gets selected. Using @id works:
>
> /customfields/customfield[@id=cf10062"]/customfieldvalues/customfieldvalue
>
> returns "sipe04".
>
> Both are valid as far as i can see and should point to the "sipe04"
> value. Why doesnt the first one work?
>
> Problem 2:
>
> <customfields>
> <customfield id="cf10000">
> <customfieldname>Flagged</customfieldname>
> <customfieldvalues>
> <customfieldvalue><![CDATA[Impediment]]></customfieldvalue >
> <customfieldvalue><![CDATA[Test description
> insufficient]]></customfieldvalue>
> </customfieldvalues>
> </customfield>
> ...
> </customfields>
>
> I tried to bind "Test description insufficient" element to a column using:
>
> /customfields/customfield[@id="cf10000"]/customfieldvalues/customfieldvalue[2]
>
>
> but again, no luck. I am not sure what gets returned, in the "Data
> preview" window it shows like squares and empty spaces.
>
> Can anyone help?
Re: XML Data source - column mapping - xpath problem with attribute and position predicates [message #660496 is a reply to message #660426] Fri, 18 March 2011 16:16 Go to previous messageGo to next message
Silvestr Peknik is currently offline Silvestr PeknikFriend
Messages: 4
Registered: March 2011
Junior Member
I've updated the problem description.

I'll check how it behaves when there are normal text nodes, no cdata.
Re: XML Data source - column mapping - xpath problem with attribute and position predicates [message #660547 is a reply to message #660426] Sat, 19 March 2011 07:03 Go to previous messageGo to next message
Silvestr Peknik is currently offline Silvestr PeknikFriend
Messages: 4
Registered: March 2011
Junior Member
Ok, update without CDATA:

XML:

<item>
<customs>
<custom id="2">
<name>Rick</name>
<values>
<value>3</value>
<value>4</value>
</values>
</custom>
</customs>
</item>

/customs/custom[1]/values/value[1]
returns "3"

/customs/custom[@id="2"]/values/value[1]
does not return anything

/customs/custom[@id="2"]/values/value
returns "3"


Is this a bug or am i missing something?
Re: XML Data source - column mapping - xpath problem with attribute and position predicates [message #660839 is a reply to message #660547] Mon, 21 March 2011 21:50 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

This does look like a bug can you log it?

Jason

On 3/19/2011 3:04 AM, Silvestr Peknik wrote:
> Ok, update without CDATA:
>
> XML:
>
> <item>
> <customs>
> <custom id="2">
> <name>Rick</name>
> <values>
> <value>3</value>
> <value>4</value>
> </values>
> </custom>
> </customs>
> </item>
>
> /customs/custom[1]/values/value[1]
> returns "3"
>
> /customs/custom[@id="2"]/values/value[1]
> does not return anything
>
> /customs/custom[@id="2"]/values/value
> returns "3"
>
>
> Is this a bug or am i missing something?
>
Re: XML Data source - column mapping - xpath problem with attribute and position predicates [message #660866 is a reply to message #660426] Tue, 22 March 2011 07:10 Go to previous message
Silvestr Peknik is currently offline Silvestr PeknikFriend
Messages: 4
Registered: March 2011
Junior Member
Reported as
https://bugs.eclipse.org/bugs/show_bug.cgi?id=340628
Previous Topic:BIRT and The Java Heap
Next Topic:Installing BIRT
Goto Forum:
  


Current Time: Wed Apr 24 21:31:36 GMT 2024

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

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

Back to the top