Announcement Announcement Module
Collapse
No announcement yet.
How to read xml attribute and value using staxEventItemReader Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #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

    Comment


    • #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

      Comment

      Working...
      X