Hello again,
I would just like to add an other observation:
If I add
Map<T,T> map ;
to my 'Book', I get the 'expected' result for the map property ,
i.e. iterating with "/*" as XPath results in the following:
title = "Book Title"
authors[1] = "First Author"
authors[2] = "Second Author"
map = {key1=value1, key2=value2, key3=value3}
This looks somewhat inconsistent to me?
Greetings Harald
Harald Finster wrote:
> Hello,
>
> this is my first posting to this list, so forgive me, if I am
> asking dump questions. (At least I had a look at the archive.)
>
> I would like to ask, if it is possible to get containers
> (e.g. Lists) 'as they are' in an iteration.
>
> Consider the following bean:
>
> public class Book {
> String title;
> List<Writer> authors;
> }
>
> Iterating this bean with
>
> JXPathContext context = JXPathContext.newContext(book);
> i = context.iteratePointers("/*");
>
> results in the following:
>
> title = "Book Title"
> authors[1] = "First Author"
> authors[2] = "Second Author"
> ...
>
> i.e. the List is iterated instead of being returned as a List-Object.
> Obviously, each list-item is regarded as a direct child of the root
> of the Book object.
>
> Is there any way to avoid this behavior?
> i.e. is it possible to get something like
>
> title = "Book Title"
> authors = [ "First Author", "Second Author" ... ] i.e. List<Author>
>
>
>
> In XML-notation the difference would be like this:
>
> The current behavior of 'iterate':
>
> <book>
> <title>Book Title</title>
> <authors>First Author</authors>
> <authors>Second Author</authors>
> </book>
>
>
> what I would like to see is an equivalent of:
>
> <book>
> <title>Book Title</title>
> <authors>
> <1>First Author</1>
> <2>Second Author</2>
> </authors>
> </book>
>
>
> By the way: in contrast to 'iterate' 'getValue("authors") returns
> List<Author>
>
>
> I would be grateful for any thoughts and suggestions.
>
> With kind regards
>
> Harald
>
>
--
Dr.-Ing. Harald Finster / Aachen Germany
http://www.finster-stahlart.de industrial history and architecture
http://www.astrid-aix.de gallery: watercolours and oil paintings
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]