JCollection Homepage

  • Increase font size
  • Default font size
  • Decrease font size
Home Forum
Welcome, Guest
Please Login or Register.    Lost Password?

Amazon: read book language
(1 viewing) (1) Guest
General questions regarding JCollection
Go to bottomPage: 1
TOPIC: Amazon: read book language
#488
Amazon: read book language 1 Year, 5 Months ago  
How i can read one language from request?

The 'language' node has many language sub-nodes.

Code:


<Languages>
  <Language>
    <Name>English</Name>
    <Type>Original Language</Type>
  </Language>
  <Language>
    <Name>English</Name>
    <Type>Published</Type>
  </Language>
</Languages>



The xpath is: /ItemLookupResponse/Items/Item/ItemAttributes/Languages/Language/Name

result in frontend: English, English


The xpath is: /ItemLookupResponse/Items/Item/ItemAttributes/Languages/Language

result in frontend: EnglishOriginal Language, EnglishPublished


How can I get one subnode?

/ItemLookupResponse/Items/Item/ItemAttributes/Languages/Language/Name[position()=1] is not working.


Can you help me please?


Regards from Berlin, Jürgen
gsx750f
Posts: 6
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#490
Re: Amazon: read book language 1 Year, 5 Months ago  
Hi,
I cannot test this at the moment (I will on the weekend) - have you tried .../Language/Name[1]?
I have not implemented the complete XPath syntax, it is just a small something that is XPath-like. To quote the tiny little piece of documentation I added to the sourcecode:
* Implements a small subset of the proper XPath definition:
* node1/node2 -> collect all data values of the form /node1/node2
* @attr -> get attribute named attr
*
* Examples:
* <cast><actor><name>Name1</name></actor><actor><name>Name2></name></actor></cast>
* XPath: cast/actor/name collects Name1, Name2
*
* <link rel="xyz" href="abc">
* XPath: link[@rel="http://xyz"]/@href gives abc
*
* <namevaluepairs><name>name1</name><value>value1</value><value>value2</value><name>name2</name><value>value3</value></namevaluepairs>
* XPath: /namevaluepairs[name=name1]/value gives (value1, value2)

HTH for now,
Thorsten.
tcriess
Posts: 292
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#492
Re: Amazon: read book language 1 Year, 5 Months ago  
PS (as I've mentioned, I cannot properly test it right now):
or: /ItemLookupResponse/Items/Item/ItemAttributes/Languages/Language[1]/Name - I think this is correct
tcriess
Posts: 292
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#494
Re: Amazon: read book language 1 Year, 5 Months ago  
YES! *cool*

Danke für die schnelle Anwort
gsx750f
Posts: 6
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 1

Donations

If you like JCollection, please consider a small donation to help developing the component. If you don't have a PayPal account and still wish to donate, feel free to send an Amazon.de gift certificate (to thorsten.riess@sh-riess.de). Thank you very much!

Amount: 

Flattr

Advertisement