-
Jan 11th, 2013, 03:43 AM
#1
How to read xml attribute and value using staxEventItemReader
Hi,
I have problem in
1.Mapping tag which contains attribute and value..for e.g
<aid IdScope="Sender">20110421000008</aid >
Here how to read IdScope attribute and its value.
2.I am getting duplicate entry exception for following as unstructAddressLine tag is repeated.
<UnstructAddress>
<UnstructAddressLine>kabban park street</UnstructAddressLine>
<UnstructAddressLine>shivaji nagar</UnstructAddressLine>
<UnstructAddressLine>dharwad</UnstructAddressLine>
</UnstructAddress>
please help me to resolve these things.
Thanks in advance
sanjeev
-
Jan 15th, 2013, 09:00 AM
#2
1. Take a look at XStreamMarshaller#setUseAttributeFor(Map<Class, String>) where the Class is the class that was previously aliased and the String is the name of the attribute.
2. Take a look at how to map collections (which I'm assuming UnstructAddress is) via XStreamMarshaller#setImplicitCollection.
You can read more about mapping at the XStream level here: http://xstream.codehaus.org/alias-tutorial.html
-
Jan 19th, 2013, 04:33 AM
#3
Thanks minella,
I went through the tutorial, there its mentioned about how to create xml from objects,my requirement is opposite.
could you please tell How do i map the attribute and value of an element in configuration file.so that it will be helpful in reading xml.
Thanks in advance..
Sanjeev
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules